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 48c04f5a568..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 51d8c4a6b7f..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 diff --git a/CI/circle_parallel.sh b/CI/circle_parallel.sh index 3487a09bf6e..88d9a4ee7d8 100755 --- a/CI/circle_parallel.sh +++ b/CI/circle_parallel.sh @@ -8,6 +8,10 @@ if [ "$NODE_INDEX" = "1" ]; then cp CI/pom.xml.circleci pom.xml java -version mvn --quiet verify -Psamples +elif [ "$NODE_INDEX" = "2" ]; then + echo "Running node $NODE_INDEX to test ensure-up-to-date" + export GO_FMT_PATH=`which gofmt` + ./bin/utils/ensure-up-to-date else echo "Running node $NODE_INDEX to test CI/pom.xml.circleci.java7 ..." sudo update-java-alternatives -s java-1.7.0-openjdk-amd64 diff --git a/CI/pom.xml.bash b/CI/pom.xml.bash index fea6011599d..4920691edc0 100644 --- a/CI/pom.xml.bash +++ b/CI/pom.xml.bash @@ -920,8 +920,8 @@ - 2.0.2-OpenAPITools.org-1 - 2.0.1 + 2.0.4 + 2.0.4 2.11.1 3.3.0 2.4 diff --git a/CI/pom.xml.circleci b/CI/pom.xml.circleci index c6bf0841c35..8166e88ee24 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,8 +1031,8 @@ - 2.0.2-OpenAPITools.org-1 - 2.0.1 + 2.0.4 + 2.0.4 2.11.1 3.3.0 2.4 diff --git a/CI/pom.xml.circleci.java7 b/CI/pom.xml.circleci.java7 index 6e6227bc937..2f9b8339885 100644 --- a/CI/pom.xml.circleci.java7 +++ b/CI/pom.xml.circleci.java7 @@ -999,8 +999,8 @@ - 2.0.2-OpenAPITools.org-1 - 2.0.1 + 2.0.4 + 2.0.4 2.11.1 3.3.0 2.4 diff --git a/CI/pom.xml.ios b/CI/pom.xml.ios index eaa81180e27..34ab0253c93 100644 --- a/CI/pom.xml.ios +++ b/CI/pom.xml.ios @@ -928,8 +928,8 @@ - 2.0.2-OpenAPITools.org-1 - 2.0.1 + 2.0.4 + 2.0.4 2.11.1 3.3.0 2.4 diff --git a/README.md b/README.md index ee102011cb2..2bf2f1cc0b3 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@
-[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.0`): [![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) @@ -42,8 +42,8 @@ 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, 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** (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** @@ -83,9 +83,8 @@ 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.3.0 (current master, upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.3.0-SNAPSHOT/) | 07.09.2018 | Minor release (breaking changes with fallbacks) +[3.2.3](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.2.3) (latest stable release) | 30.08.2018 | Bugfix release OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0 @@ -141,16 +140,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.2.3/openapi-generator-cli-3.2.3.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.2.3/openapi-generator-cli-3.2.3.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.2.3/openapi-generator-cli-3.2.3.jar ``` After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage. @@ -469,13 +468,16 @@ 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) - [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) @@ -515,7 +517,8 @@ 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 * Elixir: @niku * Elm: @trenneman * Eiffel: @jvelilla @@ -576,6 +579,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 @@ -630,16 +634,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) | | Eiffel | @jvelilla (2017/09) | | Elixir | | -| Elm | | +| Elm | @trenneman (2018/09) | | Erlang | @tsloughter (2017/11) | | Go | @antihax (2017/11) @bvwells (2017/12) @grokify (2018/07) | | 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 | | 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/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-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/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/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/utils/ensure-up-to-date b/bin/utils/ensure-up-to-date index 6e2fd3a1ec2..4f8e213f976 100755 --- a/bin/utils/ensure-up-to-date +++ b/bin/utils/ensure-up-to-date @@ -32,6 +32,8 @@ sleep 5 ./bin/rust-server-petstore.sh > /dev/null 2>&1 ./bin/openapi3/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 # 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..00683182493 --- /dev/null +++ b/bin/utils/export_docs_generators.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +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 \ No newline at end of file diff --git a/bin/utils/export_generator.sh b/bin/utils/export_generator.sh new file mode 100755 index 00000000000..d23912ae669 --- /dev/null +++ b/bin/utils/export_generator.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +if [[ "$1" != "" ]]; then + NAME="$1" +else + echo "Missing argument. Usage e.g.: ./bin/utils/export-generator.sh jaxrs-jersey" + exit 1; +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +java -jar $executable config-help -g $NAME | sed -e 's/CONFIG OPTIONS/CONFIG OPTIONS for \'$NAME'\'$'\n''/g' > docs/generators/$NAME.md + +echo "Back to the [generators list](README.md)" >> docs/generators/$NAME.md \ No newline at end of file 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 9705da54b94..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,12 +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" + "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/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/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/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..9d698abac42 --- /dev/null +++ b/docs/generators/README.md @@ -0,0 +1,109 @@ +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) + - [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..1307004f988 --- /dev/null +++ b/docs/generators/aspnetcore.md @@ -0,0 +1,31 @@ + +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) + + 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..fd0b6856794 --- /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..7cc58fe304b --- /dev/null +++ b/docs/generators/cpp-pistache-server.md @@ -0,0 +1,7 @@ + +CONFIG OPTIONS for cpp-pistache-server + + addExternalLibs + Add the Possibility to fetch and compile external Libraries needed by this Framework. (Default: true) + +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.md b/docs/generators/dart.md new file mode 100644 index 00000000000..8c25a604594 --- /dev/null +++ b/docs/generators/dart.md @@ -0,0 +1,34 @@ + +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 + +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..525c751beaa --- /dev/null +++ b/docs/generators/elm.md @@ -0,0 +1,4 @@ + +CONFIG OPTIONS for elm + +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-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..f0e10ee89ad --- /dev/null +++ b/docs/generators/groovy.md @@ -0,0 +1,110 @@ + +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') + + 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..ee6caf04eb3 --- /dev/null +++ b/docs/generators/java-inflector.md @@ -0,0 +1,107 @@ + +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') + +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..ae07769bc0a --- /dev/null +++ b/docs/generators/java-msf4j.md @@ -0,0 +1,124 @@ + +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') + + 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..0dd350488ca --- /dev/null +++ b/docs/generators/java-pkmst.md @@ -0,0 +1,137 @@ + +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') + + 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..b03f80be645 --- /dev/null +++ b/docs/generators/java-play-framework.md @@ -0,0 +1,134 @@ + +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') + + 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..c0af154ee89 --- /dev/null +++ b/docs/generators/java-undertow-server.md @@ -0,0 +1,107 @@ + +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') + +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..b1a5ca63826 --- /dev/null +++ b/docs/generators/java-vertx.md @@ -0,0 +1,113 @@ + +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') + + 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..492b3b36d35 --- /dev/null +++ b/docs/generators/java.md @@ -0,0 +1,152 @@ + +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') + + 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") + + 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) + + 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. Enable OpenFeign 10.0.1 using '-DuseFeign10=true'. + 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..20e9a3b3e1a --- /dev/null +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -0,0 +1,138 @@ + +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') + + 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..79677413ac1 --- /dev/null +++ b/docs/generators/jaxrs-cxf-client.md @@ -0,0 +1,119 @@ + +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') + + 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..580e9f7b01d --- /dev/null +++ b/docs/generators/jaxrs-cxf.md @@ -0,0 +1,170 @@ + +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') + + 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..d945cbf9111 --- /dev/null +++ b/docs/generators/jaxrs-jersey.md @@ -0,0 +1,130 @@ + +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') + + 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..58069dee7f5 --- /dev/null +++ b/docs/generators/jaxrs-resteasy-eap.md @@ -0,0 +1,128 @@ + +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') + + 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..d0ce94efa1a --- /dev/null +++ b/docs/generators/jaxrs-resteasy.md @@ -0,0 +1,122 @@ + +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') + + 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..ac8041b97ec --- /dev/null +++ b/docs/generators/jaxrs-spec.md @@ -0,0 +1,135 @@ + +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') + + 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..9803e25e0d9 --- /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 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/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..dd284679cd7 --- /dev/null +++ b/docs/generators/spring.md @@ -0,0 +1,161 @@ + +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') + + 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) + + 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..fcb59bebbb8 --- /dev/null +++ b/docs/generators/typescript-angular.md @@ -0,0 +1,58 @@ + +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 ''. + +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-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/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..0a57f093d37 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.2.3" } } 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..1a26d006851 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-rc-1-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..cf1b0e7bb00 100644 --- a/modules/openapi-generator-gradle-plugin/pom.xml +++ b/modules/openapi-generator-gradle-plugin/pom.xml @@ -54,7 +54,7 @@ gradle-maven-plugin 1.0.8 - 4.7 + 4.10-rc-1 -P openApiGeneratorVersion=${project.version} 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..92605e6d186 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.0 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..8d4fd896594 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.2.3 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..6d07d84409b 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.2.3 diff --git a/modules/openapi-generator-maven-plugin/examples/java-client.xml b/modules/openapi-generator-maven-plugin/examples/java-client.xml index 05b285d9ce8..980ef564204 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.2.3 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..d47a5b0899a 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.2.3 diff --git a/modules/openapi-generator-maven-plugin/examples/non-java.xml b/modules/openapi-generator-maven-plugin/examples/non-java.xml index eece8d6efbe..919b933e9fc 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.2.3 diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index 8e72af82bd1..549a2eb33db 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -203,8 +203,8 @@ swagger-core ${swagger-core-version} - - org.openapitools.swagger.parser + + io.swagger.parser.v3 swagger-parser ${swagger-parser-version} 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..a89e849944c 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,6 @@ public interface CodegenConfig { String sanitizeName(String name); + void postProcessFile(File file, String fileType); + } 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..30695d3a3f6 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 @@ -232,6 +232,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."; 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/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 01017af3fad..d7115b9c8db 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); @@ -284,6 +291,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 +781,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 +799,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; } @@ -832,27 +841,19 @@ public class DefaultCodegen implements CodegenConfig { /** * Return the name with escaped characters. * - * @param name the name to be escaped - * @param charactersToAllow characters that are not escaped + * @param name the name to be escaped + * @param charactersToAllow characters that are not escaped * @param appdendixToReplacement String to append to replaced characters. * @return the escaped word *

* throws Runtime exception as word is not escaped properly. + * @deprecated since version 3.2.3, may be removed with the next major release (4.0) + * @see org.openapitools.codegen.utils.StringUtils#escape directly instead + * */ + @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); } /** @@ -1750,7 +1751,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,7 +1770,7 @@ 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(); @@ -1789,11 +1790,7 @@ public class DefaultCodegen implements CodegenConfig { if (p.getWriteOnly() != null) { property.isWriteOnly = p.getWriteOnly(); } - - // use x-nullable - if (p.getExtensions() != null && p.getExtensions().get("x-nullable") != null) { - property.isNullable = Boolean.valueOf(p.getExtensions().get("x-nullable").toString()); - } else if (p.getNullable() != null) { // use nullable defined in OAS3 + if (p.getNullable() != null) { property.isNullable = p.getNullable(); } @@ -2232,14 +2229,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(); @@ -2253,6 +2253,7 @@ public class DefaultCodegen implements CodegenConfig { } } operationId = removeNonNameElementToCamelCase(operationId); + op.path = path; op.operationId = toOperationId(operationId); op.summary = escapeText(operation.getSummary()); @@ -2344,6 +2345,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(); @@ -2621,6 +2631,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 * @@ -2654,10 +2737,7 @@ public class DefaultCodegen implements CodegenConfig { parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition."); } - // x-nullable extension in OAS2 - if (parameter.getExtensions() != null && parameter.getExtensions().get("x-nullable") != null) { - codegenParameter.isNullable = Boolean.valueOf(parameter.getExtensions().get("x-nullable").toString()); - } else if (Boolean.TRUE.equals(parameterSchema.getNullable())) { // use nullable defined in the spec + if (Boolean.TRUE.equals(parameterSchema.getNullable())) { // use nullable defined in the spec codegenParameter.isNullable = true; } @@ -3151,8 +3231,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; } @@ -3181,23 +3261,12 @@ public class DefaultCodegen implements CodegenConfig { * * @param word The word * @return The underscored version of the word + * @deprecated since version 3.2.3, may be removed with the next major release (4.0) + * @see org.openapitools.codegen.utils.StringUtils#underscore */ + @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); } /** @@ -3205,10 +3274,13 @@ public class DefaultCodegen implements CodegenConfig { * * @param word The word * @return The dashized version of the word, e.g. "my-name" + * @deprecated since version 3.2.3, may be removed with the next major release (4.0) + * @see org.openapitools.codegen.utils.StringUtils#dashize */ @SuppressWarnings("static-method") + @Deprecated protected String dashize(String word) { - return underscore(word).replaceAll("[_ ]", "-"); + return org.openapitools.codegen.utils.StringUtils.dashize(word); } /** @@ -3408,6 +3480,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 @@ -3415,9 +3488,12 @@ public class DefaultCodegen implements CodegenConfig { * * @param word string to be camelize * @return camelized string + * @deprecated since version 3.2.3, may be removed with the next major release (4.0) + * @see org.openapitools.codegen.utils.StringUtils#camelize(String) */ + @Deprecated public static String camelize(String word) { - return camelize(word, false); + return org.openapitools.codegen.utils.StringUtils.camelize(word); } /** @@ -3426,80 +3502,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 + * @deprecated since version 3.2.3, may be removed with the next major release (4.0) + * @see org.openapitools.codegen.utils.StringUtils#camelize(String, boolean) */ + @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; @@ -3914,6 +3925,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 @@ -3931,6 +3944,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 @@ -4663,10 +4686,20 @@ public class DefaultCodegen implements CodegenConfig { } private void setParameterNullable(CodegenParameter parameter, CodegenProperty property) { - if (property.getVendorExtensions() != null && property.getVendorExtensions().get("x-nullable") != null) { - parameter.isNullable = Boolean.valueOf(property.getVendorExtensions().get("x-nullable").toString()); - } else { - parameter.isNullable = property.isNullable; - } + 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); } } 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..718a4c86b25 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 @@ -279,6 +279,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { File written = processTemplateToFile(models, templateName, filename); if (written != null) { files.add(written); + config.postProcessFile(written, "model-test"); } } } @@ -295,6 +296,23 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { File written = processTemplateToFile(models, templateName, filename); if (written != null) { files.add(written); + 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); + 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,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { File written = processTemplateToFile(operation, templateName, filename); if (written != null) { files.add(written); + config.postProcessFile(written, "api"); } } @@ -564,6 +575,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { File written = processTemplateToFile(operation, templateName, filename); if (written != null) { files.add(written); + config.postProcessFile(written, "api-test"); } } } @@ -581,6 +593,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { File written = processTemplateToFile(operation, templateName, filename); if (written != null) { files.add(written); + config.postProcessFile(written, "api-doc"); } } } @@ -651,7 +664,9 @@ 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); + config.postProcessFile(written, "supporting-mustache"); } else { InputStream in = null; @@ -665,6 +680,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { } File outputFile = writeInputStreamToFile(outputFilename, in, templateFile); files.add(outputFile); + config.postProcessFile(outputFile, "supporting-common"); } } else { LOGGER.info("Skipped generation of " + outputFilename + " due to rule in .openapi-generator-ignore"); @@ -688,6 +704,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { throw new RuntimeException("Could not generate supporting file '" + openapiGeneratorIgnore + "'", e); } files.add(ignoreFile); + config.postProcessFile(ignoreFile, "openapi-generator-ignore"); } if (generateMetadata) { @@ -696,6 +713,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { try { writeToFile(versionMetadata, ImplementationVersion.read()); files.add(versionMetadataFile); + config.postProcessFile(ignoreFile, "openapi-generator-version"); } catch (IOException e) { throw new RuntimeException("Could not generate supporting file '" + versionMetadata + "'", e); } @@ -762,7 +780,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 +1026,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/languages/AbstractAdaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java index d15b57315da..b395b739ada 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 @@ -44,6 +44,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); @@ -619,7 +620,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg } } } - authMethod.name = camelize(sanitizeName(authMethod.name), true); + authMethod.name = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(authMethod.name), true); } } } 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..2e99417e93a 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 @@ -39,6 +39,7 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.util.*; + public abstract class AbstractCSharpCodegen extends DefaultCodegen implements CodegenConfig { protected boolean optionalAssemblyInfoFlag = true; @@ -600,17 +601,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 +626,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 +649,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 +837,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 +937,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 +945,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 +956,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() { 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..a51e937cca7 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 { @@ -134,7 +137,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 +152,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 +177,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 +194,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 +231,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 +240,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 +311,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 +332,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 @@ -560,7 +563,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 +578,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 +606,45 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege return null; } } + + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String goFmtPath = System.getenv("GO_FMT_PATH"); + if (StringUtils.isEmpty(goFmtPath)) { + return; // skip if GO_FMT_PATH 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()))) { + // currently only support "gofmt -w yourcode.go" + // another way is "go fmt path/to/your/package" + String command = goFmtPath + " -w " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + p.waitFor(); + if (p.exitValue() != 0) { + LOGGER.error("Error running the command ({}): {}", command, p.exitValue()); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}): {}", command, e.getMessage()); + } + LOGGER.info("Successfully executed: " + command); + } + } } 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..ed83be48a39 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); @@ -552,7 +555,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 +590,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 +647,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)) { @@ -876,19 +879,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 +1042,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 +1338,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.*")) { 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..c977c7cb899 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 @@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory; import java.util.Arrays; import java.util.Locale; + abstract class AbstractRubyCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractRubyCodegen.class); @@ -123,7 +124,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 +144,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 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..80528f08ff3 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 @@ -35,6 +35,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); @@ -273,7 +274,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); } 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..77756cf99ff 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 @@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.util.*; + public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractTypeScriptClientCodegen.class); @@ -97,6 +98,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"); @@ -191,27 +193,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 @@ -375,10 +377,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 +403,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 +438,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 +458,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; 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 01de20d8c83..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 + ">"; } } 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 7b16b3db886..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 @@ -40,6 +40,7 @@ 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); @@ -124,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); /* @@ -179,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"); @@ -259,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 @@ -429,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.*")) { 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..8d80c21f5d4 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,16 +28,21 @@ import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.utils.ModelUtils; import io.swagger.v3.oas.models.media.*; +import io.swagger.v3.parser.util.SchemaTypeUtil; +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.io.IOException; import java.util.ArrayList; import java.util.Arrays; 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 +52,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 +130,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 +145,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_FMT_PATH"))) { + LOGGER.info("Environment variable DART_FMT_PATH not defined so the Dart code may not be properly formatted. To define it, try 'export DART_FMT_PATH=/usr/local/bin/dartfmt' (Linux/Mac)"); + } + if (additionalProperties.containsKey(BROWSER_CLIENT)) { this.setBrowserClient(convertPropertyToBooleanAndWriteBack(BROWSER_CLIENT)); } else { @@ -188,9 +199,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 +264,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 +287,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 +422,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 +448,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 +465,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 +508,43 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { return input.replace("*/", "*_/").replace("/*", "/_*"); } + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String dartFmtPath = System.getenv("DART_FMT_PATH"); + if (StringUtils.isEmpty(dartFmtPath)) { + return; // skip if DART_FMT_PATH 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 = dartFmtPath + " -w " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + p.waitFor(); + if (p.exitValue() != 0) { + LOGGER.error("Error running the command ({}): {}", command, p.exitValue()); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}): {}", command, e.getMessage()); + } + LOGGER.info("Successfully executed: " + command); + } + } } 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..f90ad474f45 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java @@ -0,0 +1,217 @@ +/* + * 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.samskivert.mustache.Mustache; +import com.samskivert.mustache.Template; +import io.swagger.models.Model; +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.CodegenConfig; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.CodegenProperty; +import org.openapitools.codegen.CodegenType; +import org.openapitools.codegen.DefaultCodegen; +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.io.IOException; +import java.io.StringWriter; +import java.io.Writer; +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("list"); + modelToIgnore.add("map"); + 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); + } + //objs.put("modelImports", modelImports); + 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..a4d631ab9e2 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; @@ -48,12 +55,15 @@ import java.util.Set; import java.util.TreeSet; 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 X_DISCRIMINATOR_TYPE = "x-discriminator-value"; + private static final String UNION_TYPE = "elmUnionType"; protected String packageName = "openapi"; protected String packageVersion = "1.0.0"; @@ -143,13 +153,56 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { 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 (StringUtils.isEmpty(System.getenv("ELM_FORMAT_PATH"))) { + LOGGER.info("Environment variable ELM_FORMAT_PATH not defined so the Elm code may not be properly formatted. To define it, try 'export ELM_FORMAT_PATH=/usr/local/bin/elm-format' (Linux/Mac)"); + } + + if (additionalProperties.containsKey(ELM_VERSION)) { + final String version = (String) additionalProperties.get(ELM_VERSION); + if ("0.18".equals(version)) { + elmVersion = ElmVersion.ELM_018; + } + } + + switch (elmVersion) { + case ELM_018: + additionalProperties.put("isElm018", true); + break; + case ELM_019: + additionalProperties.put("isElm019", true); + 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")); + + if (ElmVersion.ELM_018.equals(elmVersion)) { + supportingFiles.add(new SupportingFile("DateOnly018.mustache", "src", "DateOnly.elm")); + supportingFiles.add(new SupportingFile("DateTime018.mustache", "src", "DateTime.elm")); + supportingFiles.add(new SupportingFile("elm-package.mustache", "", "elm-package.json")); + supportingFiles.add(new SupportingFile("Main018.mustache", "src", "Main.elm")); + } + if (ElmVersion.ELM_019.equals(elmVersion)) { + supportingFiles.add(new SupportingFile("DateOnly019.mustache", "src", "DateOnly.elm")); + supportingFiles.add(new SupportingFile("DateTime019.mustache", "src", "DateTime.elm")); + supportingFiles.add(new SupportingFile("elm.mustache", "", "elm.json")); + supportingFiles.add(new SupportingFile("Main019.mustache", "src", "Main.elm")); + } } @Override @@ -172,7 +225,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 +241,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; } @@ -278,7 +331,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { 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); + cm.vendorExtensions.put(UNION_TYPE, cm.classname); } else if (cm.isAlias) { this.addEncoderAndDecoder(cm.vendorExtensions, cm.dataType, false, true); } @@ -297,8 +350,8 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { 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.exposures.add(org.openapitools.codegen.utils.StringUtils.camelize(cm.arrayModelType, true) + "Decoder"); + elmImport.exposures.add(org.openapitools.codegen.utils.StringUtils.camelize(cm.arrayModelType, true) + "Encoder"); elmImport.hasExposures = true; elmImports.add(elmImport); } @@ -364,11 +417,11 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { elmImport.moduleName = modulePrefix + property.complexType; 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(DECODER)) { + elmImport.exposures.add((String) property.vendorExtensions.get(DECODER)); } - if (property.vendorExtensions.containsKey(X_ENCODER)) { - elmImport.exposures.add((String) property.vendorExtensions.get(X_ENCODER)); + if (property.vendorExtensions.containsKey(ENCODER)) { + elmImport.exposures.add((String) property.vendorExtensions.get(ENCODER)); } elmImport.hasExposures = true; return elmImport; @@ -390,13 +443,13 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { 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 + " ++ \""); } 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()); @@ -408,7 +461,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { 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()); @@ -472,6 +525,23 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { return "(Just " + value + ")"; } + private String paramToString(final CodegenParameter param) { + final String paramName = param.paramName; + if (param.isString) { + return paramName; + } + if (ElmVersion.ELM_018.equals(elmVersion)) { + return "toString " + paramName; + } + if (param.isInteger || param.isLong) { + return "String.fromInt " + paramName; + } + if (param.isFloat || param.isDouble) { + return "String.fromFloat " + paramName; + } + throw new RuntimeException("Parameter '" + paramName + "' cannot be converted to a string"); + } + @Override public String getSchemaType(Schema p) { String openAPIType = super.getSchemaType(p); @@ -506,7 +576,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { 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); + property.vendorExtensions.put(UNION_TYPE, property.datatypeWithEnum); } return property; @@ -534,7 +604,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { if (isMapContainer) { isPrimitiveType = isPrimitiveDataType(dataType); } - final String baseName = camelize(dataType, true); + final String baseName = org.openapitools.codegen.utils.StringUtils.camelize(dataType, true); String encoderName; String decoderName; if (isPrimitiveType) { @@ -544,11 +614,11 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { encoderName = baseName + "Encoder"; decoderName = baseName + "Decoder"; } - 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); } } @@ -558,4 +628,41 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { 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 elmFmtPath = System.getenv("ELM_FORMAT_PATH"); + if (StringUtils.isEmpty(elmFmtPath)) { + return; // skip if ELM_FORMAT_PATH env variable is not defined + } + + // only process files with elm extension + if ("elm".equals(FilenameUtils.getExtension(file.toString()))) { + // currently only support "elm-format -w yourcode.elm" + String command = elmFmtPath + " --yes " + file.toString(); + if (ElmVersion.ELM_018.equals(elmVersion)) { + command += " --elm-version=0.18"; + } + + try { + Process p = Runtime.getRuntime().exec(command); + p.waitFor(); + if (p.exitValue() != 0) { + LOGGER.error("Error running the command ({}): {}", command, p.exitValue()); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}): {}", command, e.getMessage()); + } + LOGGER.info("Successfully executed: " + command); + } + } } 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..abdf447104c 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/"; @@ -66,6 +71,10 @@ public class GoClientCodegen extends AbstractGoCodegen { public void processOpts() { super.processOpts(); + if (StringUtils.isEmpty(System.getenv("GO_FMT_PATH"))) { + LOGGER.info("Environment variable GO_FMT_PATH not defined so Go code may not be properly formatted. To define it, try 'export GO_FMT_PATH=/usr/local/bin/gofmt' (Linux/Mac)"); + } + if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); } else { 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..ed6cfc92b0d 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"; @@ -85,6 +90,10 @@ public class GoServerCodegen extends AbstractGoCodegen { public void processOpts() { super.processOpts(); + if (StringUtils.isEmpty(System.getenv("GO_FMT_PATH"))) { + LOGGER.info("Environment variable GO_FMT_PATH not defined so Go code may not be properly formatted. To define it, try 'export GO_FMT_PATH=/usr/local/bin/gofmt' (Linux/Mac)"); + } + if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); } else { 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..a17db9ebd1e 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 @@ -35,6 +35,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); @@ -616,8 +617,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 +1078,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 +1124,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 +1133,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; } 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..62029b6065a 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 @@ -45,6 +45,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); @@ -453,7 +454,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf } } 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 +479,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,9 +495,9 @@ 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)); + op.vendorExtensions.put("x-formName", "Form" + org.openapitools.codegen.utils.StringUtils.camelize(op.operationId)); for(CodegenParameter param : op.formParams) { - param.vendorExtensions.put("x-formPrefix", camelize(op.operationId, true)); + param.vendorExtensions.put("x-formPrefix", org.openapitools.codegen.utils.StringUtils.camelize(op.operationId, true)); } return op; } @@ -554,9 +555,9 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf } // From the model name, compute the prefix for the fields. - String prefix = camelize(model.classname, true); + String prefix = org.openapitools.codegen.utils.StringUtils.camelize(model.classname, true); for(CodegenProperty prop : model.vars) { - prop.name = toVarName(prefix + camelize(fixOperatorChars(prop.name))); + prop.name = toVarName(prefix + org.openapitools.codegen.utils.StringUtils.camelize(fixOperatorChars(prop.name))); } // Create newtypes for things with non-object types 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..302e4cc4be2 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())); } @@ -333,7 +355,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 +368,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 +461,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 +602,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..2bbb3596124 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_BEAUTIFY_PATH"))) { + LOGGER.info("Environment variable JS_BEAUTIFY_PATH not defined so the JS code may not be properly formatted. To define it, try 'export JS_BEAUTIFY_PATH=/usr/local/bin/js-beautify' (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 jsBeautifyPath = System.getenv("JS_BEAUTIFY_PATH"); + if (StringUtils.isEmpty(jsBeautifyPath)) { + return; // skip if JS_BEAUTIFY_PATH env variable is not defined + } + + // only process files with js extension + if ("js".equals(FilenameUtils.getExtension(file.toString()))) { + String command = jsBeautifyPath + " -r -f " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + p.waitFor(); + if (p.exitValue() != 0) { + LOGGER.error("Error running the command ({}): {}", command, p.exitValue()); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}): {}", command, e.getMessage()); + } + LOGGER.info("Successfully executed: " + command); + } + } + } 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..3693f398074 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -0,0 +1,516 @@ +/* + * 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 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; + + +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"; + + 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"); + } + } + + } + + @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("kotlin.Array")) { + int end = returnType.lastIndexOf(">"); + if (end > 0) { + dataTypeAssigner.setReturnType(returnType.substring("kotlin.Array<".length(), end).trim()); + dataTypeAssigner.setReturnContainer("List"); + } + } else if (returnType.startsWith("kotlin.collections.Map")) { + int end = returnType.lastIndexOf(">"); + if (end > 0) { + dataTypeAssigner.setReturnType(returnType.substring("kotlin.collections.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)); + } + } +} 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/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..2def779b8c0 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("PERLTIDY_PATH"))) { + LOGGER.info("Environment variable PERLTIDY_PATH not defined so the Perl code may not be properly formatted. To define it, try 'export PERLTIDY_PATH=/usr/local/bin/perltidy' (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,33 @@ 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("PERLTIDY_PATH"); + if (StringUtils.isEmpty(perlTidyPath)) { + return; // skip if PERLTIDY_PATH 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); + p.waitFor(); + if (p.exitValue() != 0) { + LOGGER.error("Error running the command ({}): {}", command, p.exitValue()); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}): {}", command, e.getMessage()); + } + LOGGER.info("Successfully executed: " + command); + } + } } 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..94db6594f16 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 @@ -42,6 +42,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); @@ -436,7 +437,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 +469,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 +489,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 +510,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 +524,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 +532,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 +544,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 +584,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]+", "")); } /** 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..a226d786163 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 @@ -31,10 +31,10 @@ 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); @@ -246,12 +246,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 +405,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 +433,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 +444,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 +464,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 +476,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)); } /** 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..dc84d632ff5 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 @@ -29,6 +29,7 @@ import java.util.Iterator; import java.util.Locale; import java.util.Map; + public class RubyClientCodegen extends AbstractRubyCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(RubyClientCodegen.class); public static final String GEM_NAME = "gemName"; @@ -215,6 +216,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 +251,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 +262,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 +329,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 +361,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 +385,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 +413,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 +426,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 +447,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..4b41f4bf64d 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())); @@ -354,6 +363,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 +453,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 +603,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 +616,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 +675,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..1140d25ecc2 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 @@ -32,6 +32,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); @@ -382,7 +383,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 +441,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 +450,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 +476,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 +499,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 +580,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 +604,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 +618,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 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..e4b37b98c4d 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 @@ -32,6 +32,7 @@ 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); @@ -472,7 +473,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 +510,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 +549,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 +559,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 +567,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 +587,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 +610,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 +698,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 +722,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 +736,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); } 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..17ad3c37e78 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.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/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/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/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/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..bf74b39c617 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 @@ -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} @@ -294,12 +292,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..69aac87b279 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 @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -287,15 +285,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..93f2d9e2c9b 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 @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -212,7 +210,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} @@ -318,7 +316,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..178dd691ad8 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 @@ -517,7 +517,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 +542,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 +589,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 +659,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 +983,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 +1100,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 +1120,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 +1183,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..9af817bc272 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 @@ -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 { @@ -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/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..aa0c15d8b38 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 @@ -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 @@ -245,7 +243,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..540c54c6813 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 @@ -95,8 +95,7 @@ - - src/main/java + src/main/java @@ -108,8 +107,7 @@ - - src/test/java + src/test/java @@ -155,7 +153,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} @@ -259,7 +257,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..10d84edafc2 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 @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -290,7 +288,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..155a8128e30 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 @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -212,7 +210,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} com.squareup.retrofit @@ -241,17 +239,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 +258,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/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..3028604c360 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 @@ -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 @@ -262,7 +260,6 @@ ${retrofit-version} {{/useRxJava2}} - {{#usePlayWS}} @@ -291,22 +288,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 +331,6 @@ provided {{/parcelableModel}} - junit @@ -331,29 +345,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..b8d7e513d6b 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 @@ -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} @@ -271,7 +269,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 41b81a004c5..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 @@ -545,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()])); } diff --git a/modules/openapi-generator/src/main/resources/Java/pom.mustache b/modules/openapi-generator/src/main/resources/Java/pom.mustache index 0c1501e115c..275a5c869a4 100644 --- a/modules/openapi-generator/src/main/resources/Java/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pom.mustache @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -327,7 +325,7 @@ UTF-8 - 1.5.17 + 1.5.21 1.19.4 {{#supportJava6}} 2.5 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/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/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/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/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..f97f0ea9258 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 @@ -134,6 +134,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/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/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..b02bd50172e 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 @@ -29,6 +30,7 @@ org.openapitools.codegen.languages.GoServerCodegen 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 @@ -90,4 +92,4 @@ org.openapitools.codegen.languages.TypeScriptAureliaClientCodegen 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/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 2cc6d3eba27..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 @@ -23,7 +23,7 @@ RUN apk add --update \ 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/apirouter.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirouter.cpp.mustache index e3ade84f9ab..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" @@ -18,7 +18,7 @@ namespace {{this}} { } {{prefix}}ApiRouter::~{{prefix}}ApiRouter(){ - qDebug() << "~ApiRouter()";{{#apiInfo}}{{#apis}} + {{#apiInfo}}{{#apis}} delete {{classname}}ApiHandler;{{/apis}}{{/apiInfo}} } @@ -62,11 +62,7 @@ bool {{prefix}}ApiRouter::handleRequestAndExtractPathParam(QHttpEngine::Socket * { auto completePath = QString("%1 %2").arg("{{httpMethod}}").arg("{{{basePathWithoutHost}}}{{{path}}}").toLower(); if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { - QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); - completePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); - completePath.append("[\\/]?$"); - QRegularExpression pathExpr( completePath ); - QRegularExpressionMatch match = pathExpr.match( reqPath ); + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); if ( match.hasMatch() ){ {{#pathParams}} QString {{baseName}} = match.captured(QString("{{baseName}}").toLower()); 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 5634db060b2..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 @@ -76,6 +77,14 @@ private : } 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/model-body.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-body.mustache index 1e298f57b07..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 @@ -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}} 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..2959ee7c9e4 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}} @@ -242,27 +246,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/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..6507390a0f7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/class.mustache @@ -0,0 +1,26 @@ +part '{{classFilename}}.jser.dart'; + +class {{classname}} { + {{#vars}}{{#description}} /* {{{description}}} */{{/description}} + 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..db68c114211 --- /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/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..43c1c0725ce --- /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, Map 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..debb73bbcec --- /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..da078742947 100644 --- a/modules/openapi-generator/src/main/resources/elm/Byte.mustache +++ b/modules/openapi-generator/src/main/resources/elm/Byte.mustache @@ -16,4 +16,3 @@ byteDecoder = byteEncoder : Byte -> Encode.Value byteEncoder model = Encode.string model - diff --git a/modules/openapi-generator/src/main/resources/elm/DateOnly.mustache b/modules/openapi-generator/src/main/resources/elm/DateOnly018.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/elm/DateOnly.mustache rename to modules/openapi-generator/src/main/resources/elm/DateOnly018.mustache diff --git a/modules/openapi-generator/src/main/resources/elm/DateOnly019.mustache b/modules/openapi-generator/src/main/resources/elm/DateOnly019.mustache new file mode 100644 index 00000000000..c18b180ba11 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/elm/DateOnly019.mustache @@ -0,0 +1,34 @@ +module DateOnly exposing (DateOnly, dateOnlyDecoder, dateOnlyEncoder) + +import Iso8601 +import Json.Decode as Decode exposing (Decoder) +import Json.Encode as Encode +import Result +import Time + + +type alias DateOnly = + Time.Posix + + +dateOnlyDecoder : Decoder DateOnly +dateOnlyDecoder = + Decode.string + |> Decode.andThen decodeIsoString + + +dateOnlyEncoder : DateOnly -> Encode.Value +dateOnlyEncoder model = + Iso8601.fromTime model + |> String.left 10 + |> Encode.string + + +decodeIsoString : String -> Decoder DateOnly +decodeIsoString str = + case Iso8601.toTime (str ++ "T00:00:00.000Z") of + Result.Ok posix -> + Decode.succeed posix + + Result.Err _ -> + Decode.fail <| "Invalid date: " ++ str diff --git a/modules/openapi-generator/src/main/resources/elm/DateTime.mustache b/modules/openapi-generator/src/main/resources/elm/DateTime018.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/elm/DateTime.mustache rename to modules/openapi-generator/src/main/resources/elm/DateTime018.mustache diff --git a/modules/openapi-generator/src/main/resources/elm/DateTime019.mustache b/modules/openapi-generator/src/main/resources/elm/DateTime019.mustache new file mode 100644 index 00000000000..28882c8cfa6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/elm/DateTime019.mustache @@ -0,0 +1,32 @@ +module DateTime exposing (DateTime, dateTimeDecoder, dateTimeEncoder) + +import Iso8601 +import Json.Decode as Decode exposing (Decoder) +import Json.Encode as Encode +import Result +import Time + + +type alias DateTime = + Time.Posix + + +dateTimeDecoder : Decoder DateTime +dateTimeDecoder = + Decode.string + |> Decode.andThen decodeIsoString + + +dateTimeEncoder : DateTime -> Encode.Value +dateTimeEncoder model = + Encode.string <| Iso8601.fromTime model + + +decodeIsoString : String -> Decoder DateTime +decodeIsoString str = + case Iso8601.toTime str of + Result.Ok posix -> + Decode.succeed posix + + Result.Err _ -> + Decode.fail <| "Invalid date: " ++ str diff --git a/modules/openapi-generator/src/main/resources/elm/Main.mustache b/modules/openapi-generator/src/main/resources/elm/Main018.mustache similarity index 57% rename from modules/openapi-generator/src/main/resources/elm/Main.mustache rename to modules/openapi-generator/src/main/resources/elm/Main018.mustache index b0a2ce0b52c..23274d541c1 100644 --- a/modules/openapi-generator/src/main/resources/elm/Main.mustache +++ b/modules/openapi-generator/src/main/resources/elm/Main018.mustache @@ -1,9 +1,6 @@ -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 Html exposing (Html) main : Program Never Model Msg @@ -15,29 +12,49 @@ main = , subscriptions = subscriptions } + + +-- MODEL + + type alias Model = - { status : Maybe Int + { value : Int } -init : (Model, Cmd Msg) + +init : ( Model, Cmd Msg ) init = - ( Model Nothing, Cmd.none ) + ( 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/Main019.mustache b/modules/openapi-generator/src/main/resources/elm/Main019.mustache new file mode 100644 index 00000000000..7c9ddd056d3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/elm/Main019.mustache @@ -0,0 +1,61 @@ +module Main exposing (main) + +import Browser +import Html exposing (Html) + + +main : Program () Model Msg +main = + Browser.element + { 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..8a20470d27d 100644 --- a/modules/openapi-generator/src/main/resources/elm/aliasDecoder.mustache +++ b/modules/openapi-generator/src/main/resources/elm/aliasDecoder.mustache @@ -1,6 +1,6 @@ {{classVarName}}Decoder : Decoder {{classname}} {{classVarName}}Decoder = - decode {{classname}} + {{#isElm018}}decode{{/isElm018}}{{#isElm019}}Decode.succeed{{/isElm019}} {{classname}} {{#allVars}} {{^discriminatorValue}} |> {{>fieldDecoder}} {{/discriminatorValue}} diff --git a/modules/openapi-generator/src/main/resources/elm/aliasEncoder.mustache b/modules/openapi-generator/src/main/resources/elm/aliasEncoder.mustache index 662453c3cec..7889f1f0355 100644 --- a/modules/openapi-generator/src/main/resources/elm/aliasEncoder.mustache +++ b/modules/openapi-generator/src/main/resources/elm/aliasEncoder.mustache @@ -4,4 +4,4 @@ {{#allVars}} {{#-first}}[{{/-first}}{{^-first}},{{/-first}} {{>fieldEncoder}} {{/allVars}} - ] + ] \ No newline at end of file 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.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..ccd982a96c6 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}}withDefault Encode.null (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..2fdecbf47a1 100644 --- a/modules/openapi-generator/src/main/resources/elm/model.mustache +++ b/modules/openapi-generator/src/main/resources/elm/model.mustache @@ -1,9 +1,9 @@ {{>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}}, {{classVarName}}Decoder, {{classVarName}}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}} diff --git a/modules/openapi-generator/src/main/resources/elm/modelTypeArray.mustache b/modules/openapi-generator/src/main/resources/elm/modelTypeArray.mustache index 7d3c6d437a4..30f67fc37fb 100644 --- a/modules/openapi-generator/src/main/resources/elm/modelTypeArray.mustache +++ b/modules/openapi-generator/src/main/resources/elm/modelTypeArray.mustache @@ -4,9 +4,9 @@ type alias {{classname}} = {{classVarName}}Decoder : Decoder {{classname}} {{classVarName}}Decoder = - Decode.list {{vendorExtensions.x-decoder}} + Decode.list {{vendorExtensions.elmDecoder}} {{classVarName}}Encoder : {{classname}} -> Encode.Value -{{classVarName}}Encoder model = - Encode.list (List.map {{vendorExtensions.x-encoder}} model) +{{classVarName}}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..728c7a729ff 100644 --- a/modules/openapi-generator/src/main/resources/elm/modelTypeDiscriminator.mustache +++ b/modules/openapi-generator/src/main/resources/elm/modelTypeDiscriminator.mustache @@ -21,7 +21,7 @@ type {{classname}} _ -> Decode.fail <| "Trying to decode {{classname}}, but {{{discriminatorName}}} " - ++ toString {{{discriminatorName}}} ++ " is not supported." + ++ {{{discriminatorName}}} ++ " is not supported." {{classVarName}}Encoder : {{classname}} -> Encode.Value diff --git a/modules/openapi-generator/src/main/resources/elm/modelTypePrimitive.mustache b/modules/openapi-generator/src/main/resources/elm/modelTypePrimitive.mustache index a1d872f1451..7c671f24a90 100644 --- a/modules/openapi-generator/src/main/resources/elm/modelTypePrimitive.mustache +++ b/modules/openapi-generator/src/main/resources/elm/modelTypePrimitive.mustache @@ -4,9 +4,9 @@ type alias {{classname}} {{classVarName}}Decoder : Decoder {{classname}} {{classVarName}}Decoder = - {{vendorExtensions.x-decoder}} + {{vendorExtensions.elmDecoder}} {{classVarName}}Encoder : {{classname}} -> Encode.Value {{classVarName}}Encoder = - {{vendorExtensions.x-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..4b1efba70ec 100644 --- a/modules/openapi-generator/src/main/resources/elm/unionDecoder.mustache +++ b/modules/openapi-generator/src/main/resources/elm/unionDecoder.mustache @@ -1,5 +1,5 @@ -{{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 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/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..041fcb4ccad --- /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}}{{{dataType}}}{{/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..aead2978801 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache @@ -0,0 +1,25 @@ +/** + * {{{description}}} +{{#vars}} + * @param {{name}} {{{description}}} +{{/vars}} + */ +data class {{classname}} ( +{{#requiredVars}} +{{>dataClassReqVar}}{{^-last}}, +{{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}}, +{{/hasOptional}}{{/hasRequired}}{{#optionalVars}}{{>dataClassOptVar}}{{^-last}}, +{{/-last}}{{/optionalVars}} +) { +{{#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..52b6ae1157d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache @@ -0,0 +1,4 @@ +{{#useBeanValidation}}{{#required}} + @get:NotNull {{/required}}{{>beanValidationModel}}{{/useBeanValidation}}{{#swaggerAnnotations}} + @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swaggerAnnotations}} + @JsonProperty("{{{baseName}}}") 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..e09ea971bea --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache @@ -0,0 +1,4 @@ +{{#useBeanValidation}}{{#required}} + @get:NotNull {{/required}}{{>beanValidationModel}}{{/useBeanValidation}}{{#swaggerAnnotations}} + @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swaggerAnnotations}} + @JsonProperty("{{{baseName}}}") 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/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..0b6649b8945 --- /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}}: {{{dataType}}} {{/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/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..976950e27e8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/optionalDataType.mustache @@ -0,0 +1 @@ +{{#useOptional}}{{#required}}{{{dataType}}}{{/required}}{{^required}}Optional<{{{dataType}}}>{{/required}}{{/useOptional}}{{^useOptional}}{{{dataType}}}{{/useOptional}} \ 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/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/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/.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..b9993c0410c 100644 --- a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache @@ -58,7 +58,7 @@ class ObjectSerializer if ($value !== null && !in_array($openAPIType, [{{&primitives}}], true) && method_exists($openAPIType, 'getAllowableEnumValues') - && !in_array($value, $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'"); } @@ -220,6 +220,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 +233,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 +277,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..7ecf4fc9286 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 [ 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_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/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/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/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/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/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index 2666cc2c6dd..672dd0be08a 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 @@ -38,33 +38,12 @@ import org.testng.Assert; import org.testng.annotations.Test; import java.lang.reflect.Method; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; 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"); @@ -311,6 +290,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 +446,60 @@ public class DefaultCodegenTest { verifyPersonDiscriminator(personModel.discriminator); } + @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)); + } + }); + } + private void verifyPersonDiscriminator(CodegenDiscriminator discriminator) { CodegenDiscriminator test = new CodegenDiscriminator(); test.setPropertyName("$_type"); @@ -429,4 +522,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/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/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/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 2e43257eaa2..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 @@ -268,8 +268,7 @@ public class RubyClientCodegenTest { CodegenParameter name = op.formParams.get(0); Assert.assertFalse(name.isNullable); CodegenParameter status = op.formParams.get(1); - // TODO comment out the following as there seems to be an issue with swagger parser not brining over the - // vendor extensions of the form parameter when creating the schema + // 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/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/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/pom.xml b/pom.xml index 75dcc5d5dc4..f15719c499f 100644 --- a/pom.xml +++ b/pom.xml @@ -947,6 +947,18 @@ samples/server/petstore/springboot + + springboot-virtualan + + + env + java + + + + samples/server/petstore/springboot-virtualan + + spring-cloud @@ -1005,8 +1017,11 @@ + 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 @@ -1048,6 +1063,7 @@ + samples/client/petstore/elm samples/client/petstore/elixir samples/client/petstore/erlang-client @@ -1133,8 +1149,8 @@ 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 2.4 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..c791c986fbb 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.2.3-SNAPSHOT \ No newline at end of file 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/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..fb4236a0466 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 @@ -52,7 +52,7 @@ import org.openapitools.client.auth.OAuth; 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; @@ -107,7 +107,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) { @@ -895,7 +895,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 */ 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..9f14cab573a 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 @@ -1,6 +1,6 @@ /* * 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 -- + * 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 -- * * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r @@ -15,21 +15,19 @@ package org.openapitools.client; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapter; import com.google.gson.internal.bind.util.ISO8601Utils; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.google.gson.JsonElement; import io.gsonfire.GsonFireBuilder; -import io.gsonfire.TypeSelector; +import okio.ByteString; +import org.openapitools.client.model.*; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import org.threeten.bp.format.DateTimeFormatter; -import org.openapitools.client.model.*; -import okio.ByteString; - import java.io.IOException; import java.io.StringReader; import java.lang.reflect.Type; @@ -37,8 +35,8 @@ 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; public class JSON { private Gson gson; @@ -51,8 +49,10 @@ 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) { @@ -64,7 +64,7 @@ public class JSON { } private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { - Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase()); + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase(Locale.ROOT)); if(null == clazz) { throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); } 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..d30884309a8 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 @@ -103,7 +104,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 +114,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/model/ModelReturn.java b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java index db937fd8170..54a34f836ac 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 @@ -1,6 +1,6 @@ /* * 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 -- + * 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 -- * * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r @@ -13,16 +13,11 @@ package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; + +import java.util.Objects; /** * Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r @@ -30,7 +25,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) { @@ -74,7 +70,7 @@ public class ModelReturn { 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(); 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 @@ + 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..a0d457cabac 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.0-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..416ec5e2de5 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.0-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..d78e2c34001 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.0-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..d8ec0c8c437 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.0-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..01c3271f934 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.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ 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..6d94c9c2e12 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-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..8c9cf6f6e6f --- /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-09-12T15:26:49.382+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..4c579f7091e --- /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 | + **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(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 | + +### 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 | + +### 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 | + +### 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 | + **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 | + **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..6ce926d59ba --- /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 | + +### 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 | + +### 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..15c7568a8e7 --- /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 | + +### 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. | + +### 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 | + **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** +> 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 | + **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..c0108e390f6 --- /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..477fbbf8374 --- /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 []; + } +} \ No newline at end of file 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..2b9fa763b00 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/api_response.dart @@ -0,0 +1,34 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'api_response.jser.dart'; + +class ApiResponse { + + final int code; + + final String type; + + 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..2f5e7bd9c50 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/category.dart @@ -0,0 +1,31 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'category.jser.dart'; + +class Category { + + final int id; + + 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..a00485ad2ad --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/order.dart @@ -0,0 +1,43 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'order.jser.dart'; + +class Order { + + final int id; + + final int petId; + + final int quantity; + + final DateTime shipDate; + /* Order Status */ + final String status; + //enum statusEnum { placed, approved, delivered, }; + 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..971c63a6719 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/pet.dart @@ -0,0 +1,45 @@ +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 { + + final int id; + + final Category category; + + final String name; + + final List photoUrls; + + final List tags; + /* pet status in the store */ + 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..7b294b3008b --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/tag.dart @@ -0,0 +1,31 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'tag.jser.dart'; + +class Tag { + + final int id; + + 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..fddc756616a --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/user.dart @@ -0,0 +1,49 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'user.jser.dart'; + +class User { + + final int id; + + final String username; + + final String firstName; + + final String lastName; + + final String email; + + final String password; + + final String phone; + /* User Status */ + 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..6d94c9c2e12 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-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..a6db0333f31 --- /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-09-12T15:26:47.853+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..4c579f7091e --- /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 | + **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(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 | + +### 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 | + +### 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 | + +### 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 | + **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 | + **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..6ce926d59ba --- /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 | + +### 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 | + +### 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..15c7568a8e7 --- /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 | + +### 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. | + +### 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 | + **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** +> 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 | + **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..c0108e390f6 --- /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..477fbbf8374 --- /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 []; + } +} \ No newline at end of file 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..2b9fa763b00 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/api_response.dart @@ -0,0 +1,34 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'api_response.jser.dart'; + +class ApiResponse { + + final int code; + + final String type; + + 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..2f5e7bd9c50 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/category.dart @@ -0,0 +1,31 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'category.jser.dart'; + +class Category { + + final int id; + + 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..a00485ad2ad --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/order.dart @@ -0,0 +1,43 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'order.jser.dart'; + +class Order { + + final int id; + + final int petId; + + final int quantity; + + final DateTime shipDate; + /* Order Status */ + final String status; + //enum statusEnum { placed, approved, delivered, }; + 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..971c63a6719 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/pet.dart @@ -0,0 +1,45 @@ +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 { + + final int id; + + final Category category; + + final String name; + + final List photoUrls; + + final List tags; + /* pet status in the store */ + 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..7b294b3008b --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/tag.dart @@ -0,0 +1,31 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'tag.jser.dart'; + +class Tag { + + final int id; + + 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..fddc756616a --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/user.dart @@ -0,0 +1,49 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'user.jser.dart'; + +class User { + + final int id; + + final String username; + + final String firstName; + + final String lastName; + + final String email; + + final String password; + + final String phone; + /* User Status */ + 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..6d94c9c2e12 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.0-SNAPSHOT \ No newline at end of file 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..6d94c9c2e12 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.0-SNAPSHOT \ No newline at end of file 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..6d94c9c2e12 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.0-SNAPSHOT \ No newline at end of file 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..6d94c9c2e12 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-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..6fa9abf67ae --- /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 | + **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(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 | + +### 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 | + +### 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 | + +### 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 | + **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 | + **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..cc0c2ac2d35 --- /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 | + +### 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 | + +### 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..0dec271be5c --- /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 | + +### 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. | + +### 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 | + **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** +> 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 | + **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..83af6ca8e62 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/pet_api.dart @@ -0,0 +1,389 @@ +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..3fc1364a102 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/store_api.dart @@ -0,0 +1,181 @@ +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..52202df0ea4 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/user_api.dart @@ -0,0 +1,358 @@ +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..5599d392539 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/api_response.dart @@ -0,0 +1,42 @@ +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, Map 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..bcc59c0e893 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/category.dart @@ -0,0 +1,39 @@ +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, Map 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..8fa9908b07e --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/order.dart @@ -0,0 +1,60 @@ +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, Map 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..ab265f9d6e1 --- /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, Map 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..ce683e031c4 --- /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, Map 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..faa02b1ad13 --- /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, Map 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..6d94c9c2e12 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-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..6fa9abf67ae --- /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 | + **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(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 | + +### 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 | + +### 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 | + +### 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 | + **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 | + **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..cc0c2ac2d35 --- /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 | + +### 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 | + +### 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..0dec271be5c --- /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 | + +### 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. | + +### 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 | + **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** +> 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 | + **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..83af6ca8e62 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api/pet_api.dart @@ -0,0 +1,389 @@ +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..3fc1364a102 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api/store_api.dart @@ -0,0 +1,181 @@ +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..52202df0ea4 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api/user_api.dart @@ -0,0 +1,358 @@ +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..5599d392539 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/api_response.dart @@ -0,0 +1,42 @@ +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, Map 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..bcc59c0e893 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/category.dart @@ -0,0 +1,39 @@ +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, Map 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..8fa9908b07e --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/order.dart @@ -0,0 +1,60 @@ +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, Map 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..ab265f9d6e1 --- /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, Map 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..ce683e031c4 --- /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, Map 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..faa02b1ad13 --- /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, Map 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..6d94c9c2e12 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-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..6fa9abf67ae --- /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 | + **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(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 | + +### 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 | + +### 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 | + +### 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 | + **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 | + **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..cc0c2ac2d35 --- /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 | + +### 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 | + +### 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..0dec271be5c --- /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 | + +### 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. | + +### 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 | + **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** +> 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 | + **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..83af6ca8e62 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart @@ -0,0 +1,389 @@ +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..3fc1364a102 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/api/store_api.dart @@ -0,0 +1,181 @@ +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..52202df0ea4 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/api/user_api.dart @@ -0,0 +1,358 @@ +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..5599d392539 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/model/api_response.dart @@ -0,0 +1,42 @@ +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, Map 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..bcc59c0e893 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/model/category.dart @@ -0,0 +1,39 @@ +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, Map 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..8fa9908b07e --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/model/order.dart @@ -0,0 +1,60 @@ +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, Map 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..ab265f9d6e1 --- /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, Map 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..ce683e031c4 --- /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, Map 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..faa02b1ad13 --- /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, Map 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..da078742947 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Byte.elm @@ -0,0 +1,18 @@ +module Byte exposing (Byte, byteDecoder, byteEncoder) + +import Json.Decode as Decode exposing (Decoder) +import Json.Encode as Encode + + +type alias Byte = + String + + +byteDecoder : Decoder Byte +byteDecoder = + Decode.string + + +byteEncoder : Byte -> Encode.Value +byteEncoder 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..b392f467ca5 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Data/ApiResponse.elm @@ -0,0 +1,44 @@ +{- + 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, apiResponseDecoder, apiResponseEncoder) + +import Json.Decode as Decode exposing (Decoder) +import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Encode as Encode +import Maybe exposing (map, withDefault) + + +{-| Describes the result of uploading an image resource +-} +type alias ApiResponse = + { code : Maybe Int + , type_ : Maybe String + , message : Maybe String + } + + +apiResponseDecoder : Decoder ApiResponse +apiResponseDecoder = + decode 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 = + 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) ) + ] 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..c47b3e1fa62 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Data/Category.elm @@ -0,0 +1,41 @@ +{- + 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, categoryDecoder, categoryEncoder) + +import Json.Decode as Decode exposing (Decoder) +import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Encode as Encode +import Maybe exposing (map, withDefault) + + +{-| A category for a pet +-} +type alias Category = + { id : Maybe Int + , name : Maybe String + } + + +categoryDecoder : Decoder Category +categoryDecoder = + decode Category + |> optional "id" (Decode.nullable Decode.int) Nothing + |> optional "name" (Decode.nullable Decode.string) Nothing + + +categoryEncoder : Category -> Encode.Value +categoryEncoder model = + Encode.object + [ ( "id", withDefault Encode.null (map Encode.int model.id) ) + , ( "name", withDefault Encode.null (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..8703f63c8ed --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Data/Order_.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.Order_ exposing (Order_, Status(..), orderDecoder, orderEncoder) + +import DateTime exposing (DateTime, dateTimeDecoder, dateTimeEncoder) +import Json.Decode as Decode exposing (Decoder) +import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Encode as Encode +import Maybe exposing (map, withDefault) + + +{-| 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 + + +orderDecoder : Decoder Order_ +orderDecoder = + 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 dateTimeDecoder) Nothing + |> optional "status" (Decode.nullable statusDecoder) Nothing + |> optional "complete" (Decode.nullable Decode.bool) (Just False) + + +orderEncoder : Order_ -> Encode.Value +orderEncoder 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) ) + ] + + +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..76fb0e4d0a2 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Data/Pet.elm @@ -0,0 +1,94 @@ +{- + OpenAPI Petstore + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + 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(..), petDecoder, petEncoder) + +import Data.Category exposing (Category, categoryDecoder, categoryEncoder) +import Data.Tag exposing (Tag, tagDecoder, tagEncoder) +import Json.Decode as Decode exposing (Decoder) +import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Encode as Encode +import Maybe exposing (map, withDefault) + + +{-| 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 + + +petDecoder : Decoder Pet +petDecoder = + decode Pet + |> optional "id" (Decode.nullable Decode.int) Nothing + |> optional "category" (Decode.nullable categoryDecoder) Nothing + |> required "name" Decode.string + |> required "photoUrls" (Decode.list Decode.string) + |> optional "tags" (Decode.nullable (Decode.list tagDecoder)) Nothing + |> optional "status" (Decode.nullable statusDecoder) Nothing + + +petEncoder : Pet -> Encode.Value +petEncoder model = + Encode.object + [ ( "id", withDefault Encode.null (map Encode.int model.id) ) + , ( "category", withDefault Encode.null (map categoryEncoder 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) ) + ] + + +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..338eaa7ad27 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Data/Tag.elm @@ -0,0 +1,41 @@ +{- + 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, tagDecoder, tagEncoder) + +import Json.Decode as Decode exposing (Decoder) +import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Encode as Encode +import Maybe exposing (map, withDefault) + + +{-| A tag for a pet +-} +type alias Tag = + { id : Maybe Int + , name : Maybe String + } + + +tagDecoder : Decoder Tag +tagDecoder = + decode Tag + |> optional "id" (Decode.nullable Decode.int) Nothing + |> optional "name" (Decode.nullable Decode.string) Nothing + + +tagEncoder : Tag -> Encode.Value +tagEncoder model = + Encode.object + [ ( "id", withDefault Encode.null (map Encode.int model.id) ) + , ( "name", withDefault Encode.null (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..2b873692d2d --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Data/User.elm @@ -0,0 +1,59 @@ +{- + 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, userDecoder, userEncoder) + +import Json.Decode as Decode exposing (Decoder) +import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Encode as Encode +import Maybe exposing (map, withDefault) + + +{-| 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 + } + + +userDecoder : Decoder User +userDecoder = + 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 + + +userEncoder : User -> Encode.Value +userEncoder 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) ) + ] 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..59551c7aa71 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/DateOnly.elm @@ -0,0 +1,32 @@ +module DateOnly exposing (DateOnly, dateOnlyDecoder, dateOnlyEncoder) + +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 + + +dateOnlyDecoder : Decoder DateOnly +dateOnlyDecoder = + Decode.string + |> Decode.andThen decodeIsoString + + +dateOnlyEncoder : DateOnly -> Encode.Value +dateOnlyEncoder model = + Encode.string <| toFormattedString "yyyy-MM-dd" model + + +decodeIsoString : String -> Decoder DateOnly +decodeIsoString str = + case fromIsoString str of + Result.Ok date -> + Decode.succeed date + + Result.Err msg -> + Decode.fail msg 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..d3638500a89 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/DateTime.elm @@ -0,0 +1,32 @@ +module DateTime exposing (DateTime, dateTimeDecoder, dateTimeEncoder) + +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 + + +dateTimeDecoder : Decoder DateTime +dateTimeDecoder = + Decode.string + |> Decode.andThen decodeIsoString + + +dateTimeEncoder : DateTime -> Encode.Value +dateTimeEncoder model = + Encode.string <| toIsoString model + + +decodeIsoString : String -> Decoder DateTime +decodeIsoString str = + case fromIsoString str of + Result.Ok date -> + Decode.succeed date + + Result.Err msg -> + Decode.fail msg 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..948ab5d3c01 --- /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 exposing (ApiResponse, apiResponseDecoder) +import Data.Pet exposing (Pet, petDecoder, petEncoder) +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 <| petEncoder 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 petDecoder) + , 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 petDecoder) + , 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 petDecoder + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +updatePet : Pet -> Http.Request () +updatePet model = + { method = "PUT" + , url = basePath ++ "/pet" + , headers = [] + , body = Http.jsonBody <| petEncoder 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 apiResponseDecoder + , 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..2e98105a2f4 --- /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_ exposing (Order_, orderDecoder, orderEncoder) +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 orderDecoder + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +placeOrder : Order_ -> Http.Request Order_ +placeOrder model = + { method = "POST" + , url = basePath ++ "/store/order" + , headers = [] + , body = Http.jsonBody <| orderEncoder model + , expect = Http.expectJson orderDecoder + , 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..e6bbbb32ed5 --- /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 exposing (User, userDecoder, userEncoder) +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 <| userEncoder 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 <| userEncoder 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 <| userEncoder 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 userDecoder + , 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 <| userEncoder 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..da078742947 100644 --- a/samples/client/petstore/elm/src/Byte.elm +++ b/samples/client/petstore/elm/src/Byte.elm @@ -16,4 +16,3 @@ byteDecoder = byteEncoder : Byte -> Encode.Value byteEncoder 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..9bb9480a8ae 100644 --- a/samples/client/petstore/elm/src/Data/ApiResponse.elm +++ b/samples/client/petstore/elm/src/Data/ApiResponse.elm @@ -13,7 +13,7 @@ module Data.ApiResponse exposing (ApiResponse, apiResponseDecoder, apiResponseEncoder) 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) @@ -29,13 +29,12 @@ type alias ApiResponse = apiResponseDecoder : Decoder ApiResponse apiResponseDecoder = - decode ApiResponse + 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 = Encode.object @@ -43,5 +42,3 @@ apiResponseEncoder model = , ( "type", withDefault Encode.null (map Encode.string model.type_) ) , ( "message", withDefault Encode.null (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..01b80800072 100644 --- a/samples/client/petstore/elm/src/Data/Category.elm +++ b/samples/client/petstore/elm/src/Data/Category.elm @@ -13,7 +13,7 @@ module Data.Category exposing (Category, categoryDecoder, categoryEncoder) 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) @@ -28,17 +28,14 @@ type alias Category = categoryDecoder : Decoder Category categoryDecoder = - decode Category + Decode.succeed Category |> optional "id" (Decode.nullable Decode.int) Nothing |> optional "name" (Decode.nullable Decode.string) Nothing - categoryEncoder : Category -> Encode.Value categoryEncoder model = Encode.object [ ( "id", withDefault Encode.null (map Encode.int model.id) ) , ( "name", withDefault Encode.null (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..3985c150336 100644 --- a/samples/client/petstore/elm/src/Data/Order_.elm +++ b/samples/client/petstore/elm/src/Data/Order_.elm @@ -14,7 +14,7 @@ module Data.Order_ exposing (Order_, Status(..), orderDecoder, orderEncoder) import DateTime exposing (DateTime, dateTimeDecoder, dateTimeEncoder) 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) @@ -37,10 +37,9 @@ type Status | Delivered - orderDecoder : Decoder Order_ orderDecoder = - decode Order_ + Decode.succeed Order_ |> optional "id" (Decode.nullable Decode.int) Nothing |> optional "petId" (Decode.nullable Decode.int) Nothing |> optional "quantity" (Decode.nullable Decode.int) Nothing @@ -49,7 +48,6 @@ orderDecoder = |> optional "complete" (Decode.nullable Decode.bool) (Just False) - orderEncoder : Order_ -> Encode.Value orderEncoder model = Encode.object @@ -62,24 +60,24 @@ orderEncoder model = ] - 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 +91,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..f0968e4c1db 100644 --- a/samples/client/petstore/elm/src/Data/Pet.elm +++ b/samples/client/petstore/elm/src/Data/Pet.elm @@ -15,7 +15,7 @@ module Data.Pet exposing (Pet, Status(..), petDecoder, petEncoder) import Data.Category exposing (Category, categoryDecoder, categoryEncoder) import Data.Tag exposing (Tag, tagDecoder, tagEncoder) 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) @@ -38,10 +38,9 @@ type Status | Sold - petDecoder : Decoder Pet petDecoder = - decode Pet + Decode.succeed Pet |> optional "id" (Decode.nullable Decode.int) Nothing |> optional "category" (Decode.nullable categoryDecoder) Nothing |> required "name" Decode.string @@ -50,37 +49,36 @@ petDecoder = |> optional "status" (Decode.nullable statusDecoder) Nothing - petEncoder : Pet -> Encode.Value petEncoder model = Encode.object [ ( "id", withDefault Encode.null (map Encode.int model.id) ) , ( "category", withDefault Encode.null (map categoryEncoder 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) ) + , ( "photoUrls", Encode.list Encode.string model.photoUrls ) + , ( "tags", withDefault Encode.null (map (Encode.list tagEncoder) model.tags) ) , ( "status", withDefault Encode.null (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 +92,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..21c76a52eee 100644 --- a/samples/client/petstore/elm/src/Data/Tag.elm +++ b/samples/client/petstore/elm/src/Data/Tag.elm @@ -13,7 +13,7 @@ module Data.Tag exposing (Tag, tagDecoder, tagEncoder) 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) @@ -28,17 +28,14 @@ type alias Tag = tagDecoder : Decoder Tag tagDecoder = - decode Tag + Decode.succeed Tag |> optional "id" (Decode.nullable Decode.int) Nothing |> optional "name" (Decode.nullable Decode.string) Nothing - tagEncoder : Tag -> Encode.Value tagEncoder model = Encode.object [ ( "id", withDefault Encode.null (map Encode.int model.id) ) , ( "name", withDefault Encode.null (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..3f08ec51625 100644 --- a/samples/client/petstore/elm/src/Data/User.elm +++ b/samples/client/petstore/elm/src/Data/User.elm @@ -13,7 +13,7 @@ module Data.User exposing (User, userDecoder, userEncoder) 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) @@ -34,7 +34,7 @@ type alias User = userDecoder : Decoder User userDecoder = - decode User + 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,7 +45,6 @@ userDecoder = |> optional "userStatus" (Decode.nullable Decode.int) Nothing - userEncoder : User -> Encode.Value userEncoder model = Encode.object @@ -58,5 +57,3 @@ userEncoder model = , ( "phone", withDefault Encode.null (map Encode.string model.phone) ) , ( "userStatus", withDefault Encode.null (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..c18b180ba11 100644 --- a/samples/client/petstore/elm/src/DateOnly.elm +++ b/samples/client/petstore/elm/src/DateOnly.elm @@ -1,14 +1,14 @@ module DateOnly exposing (DateOnly, dateOnlyDecoder, dateOnlyEncoder) -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 @@ -19,14 +19,16 @@ dateOnlyDecoder = dateOnlyEncoder : DateOnly -> Encode.Value dateOnlyEncoder model = - Encode.string <| toFormattedString "yyyy-MM-dd" model + Iso8601.fromTime model + |> String.left 10 + |> Encode.string 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 diff --git a/samples/client/petstore/elm/src/DateTime.elm b/samples/client/petstore/elm/src/DateTime.elm index d3638500a89..28882c8cfa6 100644 --- a/samples/client/petstore/elm/src/DateTime.elm +++ b/samples/client/petstore/elm/src/DateTime.elm @@ -1,14 +1,14 @@ module DateTime exposing (DateTime, dateTimeDecoder, dateTimeEncoder) -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 @@ -19,14 +19,14 @@ dateTimeDecoder = dateTimeEncoder : DateTime -> Encode.Value dateTimeEncoder model = - Encode.string <| toIsoString model + Encode.string <| Iso8601.fromTime model 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 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..0a3b1e89891 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.Pet exposing (Pet, petDecoder, petEncoder) import Dict import Http import Json.Decode as Decode @@ -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 ()) @@ -85,7 +85,7 @@ 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 @@ -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,7 +124,7 @@ 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 diff --git a/samples/client/petstore/elm/src/Request/Store.elm b/samples/client/petstore/elm/src/Request/Store.elm index 2e98105a2f4..54899538425 100644 --- a/samples/client/petstore/elm/src/Request/Store.elm +++ b/samples/client/petstore/elm/src/Request/Store.elm @@ -58,7 +58,7 @@ 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 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..c791c986fbb 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.2.3-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..1ccb557da3b 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: 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..c6eba3fe6ba 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_fake.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_fake.go @@ -12,12 +12,12 @@ package petstore import ( "context" + "github.com/antihax/optional" "io/ioutil" "net/http" "net/url" - "strings" - "github.com/antihax/optional" "os" + "strings" ) // Linger please @@ -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 } @@ -645,8 +645,8 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl } /* -FakeApiService Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +FakeApiService Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param number None * @param double None @@ -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 @@ -748,7 +748,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa localVarFileOk := false localVarFile, localVarFileOk = localVarOptionals.Binary.Value().(*os.File) if !localVarFileOk { - return nil, reportError("binary should be *os.File") + return nil, reportError("binary should be *os.File") } } if localVarFile != nil { @@ -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..1299f93292b 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_pet.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_pet.go @@ -12,13 +12,13 @@ package petstore import ( "context" + "fmt" + "github.com/antihax/optional" "io/ioutil" "net/http" "net/url" - "strings" - "fmt" - "github.com/antihax/optional" "os" + "strings" ) // Linger please @@ -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 @@ -100,16 +100,16 @@ PetApiService Deletes a pet * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param petId Pet id to delete * @param optional nil or *DeletePetOpts - Optional Parameters: - * @param "ApiKey" (optional.String) - + * @param "ApiKey" (optional.String) - */ 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 @@ -652,7 +652,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt localVarFileOk := false localVarFile, localVarFileOk = localVarOptionals.File.Value().(*os.File) if !localVarFileOk { - return localVarReturnValue, nil, reportError("file should be *os.File") + return localVarReturnValue, nil, reportError("file should be *os.File") } } if localVarFile != nil { @@ -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..ac46e305161 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_store.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_store.go @@ -12,11 +12,11 @@ package petstore import ( "context" + "fmt" "io/ioutil" "net/http" "net/url" "strings" - "fmt" ) // Linger please @@ -34,7 +34,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or */ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = 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..cee7c24f24a 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_user.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_user.go @@ -12,11 +12,11 @@ package petstore import ( "context" + "fmt" "io/ioutil" "net/http" "net/url" "strings" - "fmt" ) // Linger please @@ -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..16c86d291fa 100644 --- a/samples/client/petstore/go/go-petstore-withXml/client.go +++ b/samples/client/petstore/go/go-petstore-withXml/client.go @@ -319,17 +319,17 @@ func (c *APIClient) prepareRequest( } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { - if strings.Contains(contentType, "application/xml") { - if err = xml.Unmarshal(b, v); err != nil { - return err - } - return nil - } else if strings.Contains(contentType, "application/json") { - if err = json.Unmarshal(b, v); err != nil { - return err - } - return nil + if strings.Contains(contentType, "application/xml") { + if err = xml.Unmarshal(b, v); err != nil { + return err } + return nil + } else if strings.Contains(contentType, "application/json") { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } return errors.New("undefined response type") } @@ -481,4 +481,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/model_200_response.go b/samples/client/petstore/go/go-petstore-withXml/model_200_response.go index c595db80775..5bbdc75815e 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_200_response.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_200_response.go @@ -12,6 +12,6 @@ package petstore // Model for testing model name starting with number type Model200Response struct { - Name int32 `json:"name,omitempty" xml:"name"` + Name int32 `json:"name,omitempty" xml:"name"` Class string `json:"class,omitempty" xml:"class"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_class.go b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_class.go index afa3de3d955..81330598575 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_class.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_class.go @@ -11,6 +11,6 @@ package petstore type AdditionalPropertiesClass struct { - MapProperty map[string]string `json:"map_property,omitempty" xml:"map_property"` + MapProperty map[string]string `json:"map_property,omitempty" xml:"map_property"` MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty" xml:"map_of_map_property"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_animal.go b/samples/client/petstore/go/go-petstore-withXml/model_animal.go index 69c91c1b357..1bc1eb6974d 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_animal.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_animal.go @@ -12,5 +12,5 @@ package petstore type Animal struct { ClassName string `json:"className" xml:"className"` - Color string `json:"color,omitempty" xml:"color"` + Color string `json:"color,omitempty" xml:"color"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_api_response.go b/samples/client/petstore/go/go-petstore-withXml/model_api_response.go index 9f617359fd8..df2771ad2cb 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_api_response.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_api_response.go @@ -11,7 +11,7 @@ package petstore type ApiResponse struct { - Code int32 `json:"code,omitempty" xml:"code"` - Type string `json:"type,omitempty" xml:"type"` + Code int32 `json:"code,omitempty" xml:"code"` + Type string `json:"type,omitempty" xml:"type"` Message string `json:"message,omitempty" xml:"message"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_array_test_.go b/samples/client/petstore/go/go-petstore-withXml/model_array_test_.go index 3a0f7178d2b..256e8a1e67e 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_array_test_.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_array_test_.go @@ -11,7 +11,7 @@ package petstore type ArrayTest struct { - ArrayOfString []string `json:"array_of_string,omitempty" xml:"array_of_string"` - ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty" xml:"array_array_of_integer"` - ArrayArrayOfModel [][]ReadOnlyFirst `json:"array_array_of_model,omitempty" xml:"array_array_of_model"` + ArrayOfString []string `json:"array_of_string,omitempty" xml:"array_of_string"` + ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty" xml:"array_array_of_integer"` + ArrayArrayOfModel [][]ReadOnlyFirst `json:"array_array_of_model,omitempty" xml:"array_array_of_model"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_capitalization.go b/samples/client/petstore/go/go-petstore-withXml/model_capitalization.go index 66c5fc6c148..d20471c50db 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_capitalization.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_capitalization.go @@ -11,11 +11,11 @@ package petstore type Capitalization struct { - SmallCamel string `json:"smallCamel,omitempty" xml:"smallCamel"` - CapitalCamel string `json:"CapitalCamel,omitempty" xml:"CapitalCamel"` - SmallSnake string `json:"small_Snake,omitempty" xml:"small_Snake"` - CapitalSnake string `json:"Capital_Snake,omitempty" xml:"Capital_Snake"` + SmallCamel string `json:"smallCamel,omitempty" xml:"smallCamel"` + CapitalCamel string `json:"CapitalCamel,omitempty" xml:"CapitalCamel"` + SmallSnake string `json:"small_Snake,omitempty" xml:"small_Snake"` + CapitalSnake string `json:"Capital_Snake,omitempty" xml:"Capital_Snake"` SCAETHFlowPoints string `json:"SCA_ETH_Flow_Points,omitempty" xml:"SCA_ETH_Flow_Points"` - // Name of the pet + // Name of the pet ATT_NAME string `json:"ATT_NAME,omitempty" xml:"ATT_NAME"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_cat.go b/samples/client/petstore/go/go-petstore-withXml/model_cat.go index f59648881a6..8c74e6abfb2 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_cat.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_cat.go @@ -12,6 +12,6 @@ package petstore type Cat struct { ClassName string `json:"className" xml:"className"` - Color string `json:"color,omitempty" xml:"color"` - Declawed bool `json:"declawed,omitempty" xml:"declawed"` + Color string `json:"color,omitempty" xml:"color"` + Declawed bool `json:"declawed,omitempty" xml:"declawed"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_category.go b/samples/client/petstore/go/go-petstore-withXml/model_category.go index 2da34c43a24..65a6dc484f9 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_category.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_category.go @@ -11,6 +11,6 @@ package petstore type Category struct { - Id int64 `json:"id,omitempty" xml:"id"` + Id int64 `json:"id,omitempty" xml:"id"` Name string `json:"name,omitempty" xml:"name"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_dog.go b/samples/client/petstore/go/go-petstore-withXml/model_dog.go index 8191c278bb6..3c763bf1020 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_dog.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_dog.go @@ -12,6 +12,6 @@ package petstore type Dog struct { ClassName string `json:"className" xml:"className"` - Color string `json:"color,omitempty" xml:"color"` - Breed string `json:"breed,omitempty" xml:"breed"` + Color string `json:"color,omitempty" xml:"color"` + Breed string `json:"breed,omitempty" xml:"breed"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_enum_arrays.go b/samples/client/petstore/go/go-petstore-withXml/model_enum_arrays.go index f4c7e5495cc..a5d44a6460b 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_enum_arrays.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_enum_arrays.go @@ -11,6 +11,6 @@ package petstore type EnumArrays struct { - JustSymbol string `json:"just_symbol,omitempty" xml:"just_symbol"` - ArrayEnum []string `json:"array_enum,omitempty" xml:"array_enum"` + JustSymbol string `json:"just_symbol,omitempty" xml:"just_symbol"` + ArrayEnum []string `json:"array_enum,omitempty" xml:"array_enum"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_enum_class.go b/samples/client/petstore/go/go-petstore-withXml/model_enum_class.go index 9d3dd60a946..3888784a7fb 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_enum_class.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_enum_class.go @@ -9,6 +9,7 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package petstore + type EnumClass string // List of EnumClass @@ -16,4 +17,4 @@ const ( ABC EnumClass = "_abc" EFG EnumClass = "-efg" XYZ EnumClass = "(xyz)" -) \ No newline at end of file +) diff --git a/samples/client/petstore/go/go-petstore-withXml/model_enum_test_.go b/samples/client/petstore/go/go-petstore-withXml/model_enum_test_.go index 02c6c920c31..2767b949dc0 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_enum_test_.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_enum_test_.go @@ -11,9 +11,9 @@ package petstore type EnumTest struct { - EnumString string `json:"enum_string,omitempty" xml:"enum_string"` - EnumStringRequired string `json:"enum_string_required" xml:"enum_string_required"` - EnumInteger int32 `json:"enum_integer,omitempty" xml:"enum_integer"` - EnumNumber float64 `json:"enum_number,omitempty" xml:"enum_number"` - OuterEnum OuterEnum `json:"outerEnum,omitempty" xml:"outerEnum"` + EnumString string `json:"enum_string,omitempty" xml:"enum_string"` + EnumStringRequired string `json:"enum_string_required" xml:"enum_string_required"` + EnumInteger int32 `json:"enum_integer,omitempty" xml:"enum_integer"` + EnumNumber float64 `json:"enum_number,omitempty" xml:"enum_number"` + OuterEnum OuterEnum `json:"outerEnum,omitempty" xml:"outerEnum"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_file_schema_test_class.go b/samples/client/petstore/go/go-petstore-withXml/model_file_schema_test_class.go index 6debdd3639b..88e64fca3f7 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_file_schema_test_class.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_file_schema_test_class.go @@ -11,6 +11,6 @@ package petstore type FileSchemaTestClass struct { - File File `json:"file,omitempty" xml:"file"` + File File `json:"file,omitempty" xml:"file"` Files []File `json:"files,omitempty" xml:"files"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_format_test_.go b/samples/client/petstore/go/go-petstore-withXml/model_format_test_.go index dbd780a794e..5c7f570bb98 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_format_test_.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_format_test_.go @@ -9,23 +9,24 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package petstore + import ( "os" "time" ) type FormatTest struct { - Integer int32 `json:"integer,omitempty" xml:"integer"` - Int32 int32 `json:"int32,omitempty" xml:"int32"` - Int64 int64 `json:"int64,omitempty" xml:"int64"` - Number float32 `json:"number" xml:"number"` - Float float32 `json:"float,omitempty" xml:"float"` - Double float64 `json:"double,omitempty" xml:"double"` - String string `json:"string,omitempty" xml:"string"` - Byte string `json:"byte" xml:"byte"` - Binary *os.File `json:"binary,omitempty" xml:"binary"` - Date string `json:"date" xml:"date"` + Integer int32 `json:"integer,omitempty" xml:"integer"` + Int32 int32 `json:"int32,omitempty" xml:"int32"` + Int64 int64 `json:"int64,omitempty" xml:"int64"` + Number float32 `json:"number" xml:"number"` + Float float32 `json:"float,omitempty" xml:"float"` + Double float64 `json:"double,omitempty" xml:"double"` + String string `json:"string,omitempty" xml:"string"` + Byte string `json:"byte" xml:"byte"` + Binary *os.File `json:"binary,omitempty" xml:"binary"` + Date string `json:"date" xml:"date"` DateTime time.Time `json:"dateTime,omitempty" xml:"dateTime"` - Uuid string `json:"uuid,omitempty" xml:"uuid"` - Password string `json:"password" xml:"password"` + Uuid string `json:"uuid,omitempty" xml:"uuid"` + Password string `json:"password" xml:"password"` } 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..2985ade4731 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 @@ -11,8 +11,8 @@ package petstore 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"` + 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"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_mixed_properties_and_additional_properties_class.go b/samples/client/petstore/go/go-petstore-withXml/model_mixed_properties_and_additional_properties_class.go index 099ebd1c28a..8575adb7f4a 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_mixed_properties_and_additional_properties_class.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_mixed_properties_and_additional_properties_class.go @@ -9,12 +9,13 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package petstore + import ( "time" ) type MixedPropertiesAndAdditionalPropertiesClass struct { - Uuid string `json:"uuid,omitempty" xml:"uuid"` - DateTime time.Time `json:"dateTime,omitempty" xml:"dateTime"` - Map map[string]Animal `json:"map,omitempty" xml:"map"` + Uuid string `json:"uuid,omitempty" xml:"uuid"` + DateTime time.Time `json:"dateTime,omitempty" xml:"dateTime"` + Map map[string]Animal `json:"map,omitempty" xml:"map"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_name.go b/samples/client/petstore/go/go-petstore-withXml/model_name.go index 684f282beb7..b042cac97aa 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_name.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_name.go @@ -12,8 +12,8 @@ package petstore // Model for testing model name same as property name type Name struct { - Name int32 `json:"name" xml:"name"` - SnakeCase int32 `json:"snake_case,omitempty" xml:"snake_case"` - Property string `json:"property,omitempty" xml:"property"` - Var123Number int32 `json:"123Number,omitempty" xml:"123Number"` + Name int32 `json:"name" xml:"name"` + SnakeCase int32 `json:"snake_case,omitempty" xml:"snake_case"` + Property string `json:"property,omitempty" xml:"property"` + Var123Number int32 `json:"123Number,omitempty" xml:"123Number"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_order.go b/samples/client/petstore/go/go-petstore-withXml/model_order.go index c4a731b72ca..762fe102257 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_order.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_order.go @@ -9,16 +9,17 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package petstore + import ( "time" ) type Order struct { - Id int64 `json:"id,omitempty" xml:"id"` - PetId int64 `json:"petId,omitempty" xml:"petId"` - Quantity int32 `json:"quantity,omitempty" xml:"quantity"` + Id int64 `json:"id,omitempty" xml:"id"` + PetId int64 `json:"petId,omitempty" xml:"petId"` + Quantity int32 `json:"quantity,omitempty" xml:"quantity"` ShipDate time.Time `json:"shipDate,omitempty" xml:"shipDate"` // Order Status - Status string `json:"status,omitempty" xml:"status"` - Complete bool `json:"complete,omitempty" xml:"complete"` + Status string `json:"status,omitempty" xml:"status"` + Complete bool `json:"complete,omitempty" xml:"complete"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_outer_composite.go b/samples/client/petstore/go/go-petstore-withXml/model_outer_composite.go index 0a6cc434b97..69cc503584c 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_outer_composite.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_outer_composite.go @@ -11,7 +11,7 @@ package petstore type OuterComposite struct { - MyNumber float32 `json:"my_number,omitempty" xml:"my_number"` - MyString string `json:"my_string,omitempty" xml:"my_string"` - MyBoolean bool `json:"my_boolean,omitempty" xml:"my_boolean"` + MyNumber float32 `json:"my_number,omitempty" xml:"my_number"` + MyString string `json:"my_string,omitempty" xml:"my_string"` + MyBoolean bool `json:"my_boolean,omitempty" xml:"my_boolean"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_outer_enum.go b/samples/client/petstore/go/go-petstore-withXml/model_outer_enum.go index c6b28556bf2..05d6dbe7430 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_outer_enum.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_outer_enum.go @@ -9,11 +9,12 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package petstore + type OuterEnum string // List of OuterEnum const ( - PLACED OuterEnum = "placed" - APPROVED OuterEnum = "approved" + PLACED OuterEnum = "placed" + APPROVED OuterEnum = "approved" DELIVERED OuterEnum = "delivered" -) \ No newline at end of file +) diff --git a/samples/client/petstore/go/go-petstore-withXml/model_pet.go b/samples/client/petstore/go/go-petstore-withXml/model_pet.go index eb0d4085f77..98af34e7d0b 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_pet.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_pet.go @@ -11,11 +11,11 @@ package petstore type Pet struct { - Id int64 `json:"id,omitempty" xml:"id"` - Category Category `json:"category,omitempty" xml:"category"` - Name string `json:"name" xml:"name"` + Id int64 `json:"id,omitempty" xml:"id"` + Category Category `json:"category,omitempty" xml:"category"` + Name string `json:"name" xml:"name"` PhotoUrls []string `json:"photoUrls" xml:"photoUrls"` - Tags []Tag `json:"tags,omitempty" xml:"tags"` + Tags []Tag `json:"tags,omitempty" xml:"tags"` // pet status in the store Status string `json:"status,omitempty" xml:"status"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_tag.go b/samples/client/petstore/go/go-petstore-withXml/model_tag.go index fb2232a6bf4..d850a48bb3c 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_tag.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_tag.go @@ -11,6 +11,6 @@ package petstore type Tag struct { - Id int64 `json:"id,omitempty" xml:"id"` + Id int64 `json:"id,omitempty" xml:"id"` Name string `json:"name,omitempty" xml:"name"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_user.go b/samples/client/petstore/go/go-petstore-withXml/model_user.go index 27f1f67e427..d4fa07b4fc5 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_user.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_user.go @@ -11,13 +11,13 @@ package petstore type User struct { - Id int64 `json:"id,omitempty" xml:"id"` - Username string `json:"username,omitempty" xml:"username"` + Id int64 `json:"id,omitempty" xml:"id"` + Username string `json:"username,omitempty" xml:"username"` FirstName string `json:"firstName,omitempty" xml:"firstName"` - LastName string `json:"lastName,omitempty" xml:"lastName"` - Email string `json:"email,omitempty" xml:"email"` - Password string `json:"password,omitempty" xml:"password"` - Phone string `json:"phone,omitempty" xml:"phone"` + LastName string `json:"lastName,omitempty" xml:"lastName"` + Email string `json:"email,omitempty" xml:"email"` + Password string `json:"password,omitempty" xml:"password"` + Phone string `json:"phone,omitempty" xml:"phone"` // User Status UserStatus int32 `json:"userStatus,omitempty" xml:"userStatus"` } diff --git a/samples/client/petstore/go/go-petstore/.openapi-generator/VERSION b/samples/client/petstore/go/go-petstore/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 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 +3.3.0-SNAPSHOT \ No newline at end of file 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..0d70b48b5bd 100644 --- a/samples/client/petstore/go/go-petstore/api_fake.go +++ b/samples/client/petstore/go/go-petstore/api_fake.go @@ -11,12 +11,12 @@ package petstore import ( "context" + "github.com/antihax/optional" "io/ioutil" "net/http" "net/url" - "strings" - "github.com/antihax/optional" "os" + "strings" ) // Linger please @@ -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 } @@ -644,8 +644,8 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl } /* -FakeApiService Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +FakeApiService Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param number None * @param double None @@ -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 @@ -747,7 +747,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa localVarFileOk := false localVarFile, localVarFileOk = localVarOptionals.Binary.Value().(*os.File) if !localVarFileOk { - return nil, reportError("binary should be *os.File") + return nil, reportError("binary should be *os.File") } } if localVarFile != nil { @@ -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..b371ddde18a 100644 --- a/samples/client/petstore/go/go-petstore/api_pet.go +++ b/samples/client/petstore/go/go-petstore/api_pet.go @@ -11,13 +11,13 @@ package petstore import ( "context" + "fmt" + "github.com/antihax/optional" "io/ioutil" "net/http" "net/url" - "strings" - "fmt" - "github.com/antihax/optional" "os" + "strings" ) // Linger please @@ -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 @@ -99,16 +99,16 @@ PetApiService Deletes a pet * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param petId Pet id to delete * @param optional nil or *DeletePetOpts - Optional Parameters: - * @param "ApiKey" (optional.String) - + * @param "ApiKey" (optional.String) - */ 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 @@ -651,7 +651,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt localVarFileOk := false localVarFile, localVarFileOk = localVarOptionals.File.Value().(*os.File) if !localVarFileOk { - return localVarReturnValue, nil, reportError("file should be *os.File") + return localVarReturnValue, nil, reportError("file should be *os.File") } } if localVarFile != nil { @@ -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..aec376817ac 100644 --- a/samples/client/petstore/go/go-petstore/api_store.go +++ b/samples/client/petstore/go/go-petstore/api_store.go @@ -11,11 +11,11 @@ package petstore import ( "context" + "fmt" "io/ioutil" "net/http" "net/url" "strings" - "fmt" ) // Linger please @@ -33,7 +33,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or */ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = 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..cb7115ff81a 100644 --- a/samples/client/petstore/go/go-petstore/api_user.go +++ b/samples/client/petstore/go/go-petstore/api_user.go @@ -11,11 +11,11 @@ package petstore import ( "context" + "fmt" "io/ioutil" "net/http" "net/url" "strings" - "fmt" ) // Linger please @@ -33,7 +33,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = 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..c7e168b3f11 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -318,17 +318,17 @@ func (c *APIClient) prepareRequest( } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { - if strings.Contains(contentType, "application/xml") { - if err = xml.Unmarshal(b, v); err != nil { - return err - } - return nil - } else if strings.Contains(contentType, "application/json") { - if err = json.Unmarshal(b, v); err != nil { - return err - } - return nil + if strings.Contains(contentType, "application/xml") { + if err = xml.Unmarshal(b, v); err != nil { + return err } + return nil + } else if strings.Contains(contentType, "application/json") { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } return errors.New("undefined response type") } @@ -480,4 +480,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/model_200_response.go b/samples/client/petstore/go/go-petstore/model_200_response.go index f918cabaaae..33a3b87bb11 100644 --- a/samples/client/petstore/go/go-petstore/model_200_response.go +++ b/samples/client/petstore/go/go-petstore/model_200_response.go @@ -11,6 +11,6 @@ package petstore // Model for testing model name starting with number type Model200Response struct { - Name int32 `json:"name,omitempty"` + Name int32 `json:"name,omitempty"` Class string `json:"class,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_additional_properties_class.go b/samples/client/petstore/go/go-petstore/model_additional_properties_class.go index 1d06dde3d04..ed93d44f1a3 100644 --- a/samples/client/petstore/go/go-petstore/model_additional_properties_class.go +++ b/samples/client/petstore/go/go-petstore/model_additional_properties_class.go @@ -10,6 +10,6 @@ package petstore type AdditionalPropertiesClass struct { - MapProperty map[string]string `json:"map_property,omitempty"` + MapProperty map[string]string `json:"map_property,omitempty"` MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_animal.go b/samples/client/petstore/go/go-petstore/model_animal.go index 39d0d2d1ec3..e0eee1befe0 100644 --- a/samples/client/petstore/go/go-petstore/model_animal.go +++ b/samples/client/petstore/go/go-petstore/model_animal.go @@ -11,5 +11,5 @@ package petstore type Animal struct { ClassName string `json:"className"` - Color string `json:"color,omitempty"` + Color string `json:"color,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_api_response.go b/samples/client/petstore/go/go-petstore/model_api_response.go index 12732fa32c6..f58619cf62b 100644 --- a/samples/client/petstore/go/go-petstore/model_api_response.go +++ b/samples/client/petstore/go/go-petstore/model_api_response.go @@ -10,7 +10,7 @@ package petstore type ApiResponse struct { - Code int32 `json:"code,omitempty"` - Type string `json:"type,omitempty"` + Code int32 `json:"code,omitempty"` + Type string `json:"type,omitempty"` Message string `json:"message,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_array_test_.go b/samples/client/petstore/go/go-petstore/model_array_test_.go index f8819800934..02381e8f911 100644 --- a/samples/client/petstore/go/go-petstore/model_array_test_.go +++ b/samples/client/petstore/go/go-petstore/model_array_test_.go @@ -10,7 +10,7 @@ package petstore type ArrayTest struct { - ArrayOfString []string `json:"array_of_string,omitempty"` - ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty"` - ArrayArrayOfModel [][]ReadOnlyFirst `json:"array_array_of_model,omitempty"` + ArrayOfString []string `json:"array_of_string,omitempty"` + ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty"` + ArrayArrayOfModel [][]ReadOnlyFirst `json:"array_array_of_model,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_capitalization.go b/samples/client/petstore/go/go-petstore/model_capitalization.go index 8284ba9c765..25b313e7f30 100644 --- a/samples/client/petstore/go/go-petstore/model_capitalization.go +++ b/samples/client/petstore/go/go-petstore/model_capitalization.go @@ -10,11 +10,11 @@ package petstore type Capitalization struct { - SmallCamel string `json:"smallCamel,omitempty"` - CapitalCamel string `json:"CapitalCamel,omitempty"` - SmallSnake string `json:"small_Snake,omitempty"` - CapitalSnake string `json:"Capital_Snake,omitempty"` + SmallCamel string `json:"smallCamel,omitempty"` + CapitalCamel string `json:"CapitalCamel,omitempty"` + SmallSnake string `json:"small_Snake,omitempty"` + CapitalSnake string `json:"Capital_Snake,omitempty"` SCAETHFlowPoints string `json:"SCA_ETH_Flow_Points,omitempty"` - // Name of the pet + // Name of the pet ATT_NAME string `json:"ATT_NAME,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_cat.go b/samples/client/petstore/go/go-petstore/model_cat.go index 58b3deeb938..aa9d3d47e65 100644 --- a/samples/client/petstore/go/go-petstore/model_cat.go +++ b/samples/client/petstore/go/go-petstore/model_cat.go @@ -11,6 +11,6 @@ package petstore type Cat struct { ClassName string `json:"className"` - Color string `json:"color,omitempty"` - Declawed bool `json:"declawed,omitempty"` + Color string `json:"color,omitempty"` + Declawed bool `json:"declawed,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_category.go b/samples/client/petstore/go/go-petstore/model_category.go index e0e9479465e..5adb0714a4e 100644 --- a/samples/client/petstore/go/go-petstore/model_category.go +++ b/samples/client/petstore/go/go-petstore/model_category.go @@ -10,6 +10,6 @@ package petstore type Category struct { - Id int64 `json:"id,omitempty"` + Id int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_dog.go b/samples/client/petstore/go/go-petstore/model_dog.go index 3f791ca1947..22466bd3b07 100644 --- a/samples/client/petstore/go/go-petstore/model_dog.go +++ b/samples/client/petstore/go/go-petstore/model_dog.go @@ -11,6 +11,6 @@ package petstore type Dog struct { ClassName string `json:"className"` - Color string `json:"color,omitempty"` - Breed string `json:"breed,omitempty"` + Color string `json:"color,omitempty"` + Breed string `json:"breed,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_enum_arrays.go b/samples/client/petstore/go/go-petstore/model_enum_arrays.go index ab4dce92ebb..2c138a6014e 100644 --- a/samples/client/petstore/go/go-petstore/model_enum_arrays.go +++ b/samples/client/petstore/go/go-petstore/model_enum_arrays.go @@ -10,6 +10,6 @@ package petstore type EnumArrays struct { - JustSymbol string `json:"just_symbol,omitempty"` - ArrayEnum []string `json:"array_enum,omitempty"` + JustSymbol string `json:"just_symbol,omitempty"` + ArrayEnum []string `json:"array_enum,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_enum_class.go b/samples/client/petstore/go/go-petstore/model_enum_class.go index 534ce432881..0e4612e430f 100644 --- a/samples/client/petstore/go/go-petstore/model_enum_class.go +++ b/samples/client/petstore/go/go-petstore/model_enum_class.go @@ -8,6 +8,7 @@ */ package petstore + type EnumClass string // List of EnumClass @@ -15,4 +16,4 @@ const ( ABC EnumClass = "_abc" EFG EnumClass = "-efg" XYZ EnumClass = "(xyz)" -) \ No newline at end of file +) diff --git a/samples/client/petstore/go/go-petstore/model_enum_test_.go b/samples/client/petstore/go/go-petstore/model_enum_test_.go index f85f31501a0..d5d8061f44b 100644 --- a/samples/client/petstore/go/go-petstore/model_enum_test_.go +++ b/samples/client/petstore/go/go-petstore/model_enum_test_.go @@ -10,9 +10,9 @@ package petstore type EnumTest struct { - EnumString string `json:"enum_string,omitempty"` - EnumStringRequired string `json:"enum_string_required"` - EnumInteger int32 `json:"enum_integer,omitempty"` - EnumNumber float64 `json:"enum_number,omitempty"` - OuterEnum OuterEnum `json:"outerEnum,omitempty"` + EnumString string `json:"enum_string,omitempty"` + EnumStringRequired string `json:"enum_string_required"` + EnumInteger int32 `json:"enum_integer,omitempty"` + EnumNumber float64 `json:"enum_number,omitempty"` + OuterEnum OuterEnum `json:"outerEnum,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_file_schema_test_class.go b/samples/client/petstore/go/go-petstore/model_file_schema_test_class.go index 487f766c649..11fd46b364e 100644 --- a/samples/client/petstore/go/go-petstore/model_file_schema_test_class.go +++ b/samples/client/petstore/go/go-petstore/model_file_schema_test_class.go @@ -10,6 +10,6 @@ package petstore type FileSchemaTestClass struct { - File File `json:"file,omitempty"` + File File `json:"file,omitempty"` Files []File `json:"files,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_format_test_.go b/samples/client/petstore/go/go-petstore/model_format_test_.go index d723bdfee39..fb348fa3fad 100644 --- a/samples/client/petstore/go/go-petstore/model_format_test_.go +++ b/samples/client/petstore/go/go-petstore/model_format_test_.go @@ -8,23 +8,24 @@ */ package petstore + import ( "os" "time" ) type FormatTest struct { - Integer int32 `json:"integer,omitempty"` - Int32 int32 `json:"int32,omitempty"` - Int64 int64 `json:"int64,omitempty"` - Number float32 `json:"number"` - Float float32 `json:"float,omitempty"` - Double float64 `json:"double,omitempty"` - String string `json:"string,omitempty"` - Byte string `json:"byte"` - Binary *os.File `json:"binary,omitempty"` - Date string `json:"date"` + Integer int32 `json:"integer,omitempty"` + Int32 int32 `json:"int32,omitempty"` + Int64 int64 `json:"int64,omitempty"` + Number float32 `json:"number"` + Float float32 `json:"float,omitempty"` + Double float64 `json:"double,omitempty"` + String string `json:"string,omitempty"` + Byte string `json:"byte"` + Binary *os.File `json:"binary,omitempty"` + Date string `json:"date"` DateTime time.Time `json:"dateTime,omitempty"` - Uuid string `json:"uuid,omitempty"` - Password string `json:"password"` + Uuid string `json:"uuid,omitempty"` + Password string `json:"password"` } 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..b5b43c81bf2 100644 --- a/samples/client/petstore/go/go-petstore/model_map_test_.go +++ b/samples/client/petstore/go/go-petstore/model_map_test_.go @@ -10,8 +10,8 @@ package petstore 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"` + 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"` } diff --git a/samples/client/petstore/go/go-petstore/model_mixed_properties_and_additional_properties_class.go b/samples/client/petstore/go/go-petstore/model_mixed_properties_and_additional_properties_class.go index 0ad92e96f8e..38e4143f653 100644 --- a/samples/client/petstore/go/go-petstore/model_mixed_properties_and_additional_properties_class.go +++ b/samples/client/petstore/go/go-petstore/model_mixed_properties_and_additional_properties_class.go @@ -8,12 +8,13 @@ */ package petstore + import ( "time" ) type MixedPropertiesAndAdditionalPropertiesClass struct { - Uuid string `json:"uuid,omitempty"` - DateTime time.Time `json:"dateTime,omitempty"` - Map map[string]Animal `json:"map,omitempty"` + Uuid string `json:"uuid,omitempty"` + DateTime time.Time `json:"dateTime,omitempty"` + Map map[string]Animal `json:"map,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_name.go b/samples/client/petstore/go/go-petstore/model_name.go index dde1b92eb6a..86590a3c181 100644 --- a/samples/client/petstore/go/go-petstore/model_name.go +++ b/samples/client/petstore/go/go-petstore/model_name.go @@ -11,8 +11,8 @@ package petstore // Model for testing model name same as property name type Name struct { - Name int32 `json:"name"` - SnakeCase int32 `json:"snake_case,omitempty"` - Property string `json:"property,omitempty"` - Var123Number int32 `json:"123Number,omitempty"` + Name int32 `json:"name"` + SnakeCase int32 `json:"snake_case,omitempty"` + Property string `json:"property,omitempty"` + Var123Number int32 `json:"123Number,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_order.go b/samples/client/petstore/go/go-petstore/model_order.go index c81d67ae0fa..3e884ceea65 100644 --- a/samples/client/petstore/go/go-petstore/model_order.go +++ b/samples/client/petstore/go/go-petstore/model_order.go @@ -8,16 +8,17 @@ */ package petstore + import ( "time" ) type Order struct { - Id int64 `json:"id,omitempty"` - PetId int64 `json:"petId,omitempty"` - Quantity int32 `json:"quantity,omitempty"` + 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"` + Status string `json:"status,omitempty"` + Complete bool `json:"complete,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_outer_composite.go b/samples/client/petstore/go/go-petstore/model_outer_composite.go index 0ebb526267e..8e8e5bc5e20 100644 --- a/samples/client/petstore/go/go-petstore/model_outer_composite.go +++ b/samples/client/petstore/go/go-petstore/model_outer_composite.go @@ -10,7 +10,7 @@ package petstore type OuterComposite struct { - MyNumber float32 `json:"my_number,omitempty"` - MyString string `json:"my_string,omitempty"` - MyBoolean bool `json:"my_boolean,omitempty"` + MyNumber float32 `json:"my_number,omitempty"` + MyString string `json:"my_string,omitempty"` + MyBoolean bool `json:"my_boolean,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_outer_enum.go b/samples/client/petstore/go/go-petstore/model_outer_enum.go index 903d31e8269..ab6136a8f3f 100644 --- a/samples/client/petstore/go/go-petstore/model_outer_enum.go +++ b/samples/client/petstore/go/go-petstore/model_outer_enum.go @@ -8,11 +8,12 @@ */ package petstore + type OuterEnum string // List of OuterEnum const ( - PLACED OuterEnum = "placed" - APPROVED OuterEnum = "approved" + PLACED OuterEnum = "placed" + APPROVED OuterEnum = "approved" DELIVERED OuterEnum = "delivered" -) \ No newline at end of file +) diff --git a/samples/client/petstore/go/go-petstore/model_pet.go b/samples/client/petstore/go/go-petstore/model_pet.go index 4930dbb92e8..c94259ec0b4 100644 --- a/samples/client/petstore/go/go-petstore/model_pet.go +++ b/samples/client/petstore/go/go-petstore/model_pet.go @@ -10,11 +10,11 @@ package petstore type Pet struct { - Id int64 `json:"id,omitempty"` - Category Category `json:"category,omitempty"` - Name string `json:"name"` + Id int64 `json:"id,omitempty"` + Category Category `json:"category,omitempty"` + Name string `json:"name"` PhotoUrls []string `json:"photoUrls"` - Tags []Tag `json:"tags,omitempty"` + Tags []Tag `json:"tags,omitempty"` // pet status in the store Status string `json:"status,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_tag.go b/samples/client/petstore/go/go-petstore/model_tag.go index 37a2b63d445..022ac82645f 100644 --- a/samples/client/petstore/go/go-petstore/model_tag.go +++ b/samples/client/petstore/go/go-petstore/model_tag.go @@ -10,6 +10,6 @@ package petstore type Tag struct { - Id int64 `json:"id,omitempty"` + Id int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/model_user.go b/samples/client/petstore/go/go-petstore/model_user.go index caff75ebc2c..6e203d3491b 100644 --- a/samples/client/petstore/go/go-petstore/model_user.go +++ b/samples/client/petstore/go/go-petstore/model_user.go @@ -10,13 +10,13 @@ package petstore type User struct { - Id int64 `json:"id,omitempty"` - Username string `json:"username,omitempty"` + 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"` + 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/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/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..6d94c9c2e12 --- /dev/null +++ b/samples/client/petstore/java/feign10x/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.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..f41fb1dec4f --- /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..4f644cb493c --- /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, 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) + */ + @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, default to $) + * @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, default to $) + * @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..5819866038b --- /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..e7c2ded72fb --- /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, default to null) + * @param status Updated status of the pet (optional, default to null) + */ + @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, default to null) + * @param file file to upload (optional, default to null) + * @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, default to null) + * @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..164df7fcc30 --- /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..cb4a80decb6 --- /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..6819bd7fe7d --- /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 = 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 = "") + 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..f0b2d5cd99f --- /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 = 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/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..2121c5c2793 --- /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 = null; + + 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..60f4d2b07b2 --- /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 = 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/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..d16a676db3d --- /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 = 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/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..290c475cb54 --- /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 = 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/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..b7beed2df53 --- /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 = 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/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..3b1b51c26a3 --- /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 = null; + + /** + * 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..122f370cef9 --- /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 = null; + + /** + * 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 = null; + + /** + * 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 = 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; + } + + @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 = 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 = "") + 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..de08419d1db --- /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 = 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 File 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 = "") + 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..ddd9bfbf678 --- /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 = null; + + @JsonProperty("foo") + private String foo = null; + + /** + * 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..f67fb22c45c --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * 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 org.openapitools.client.model.StringBooleanMap; + +/** + * 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 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 = "") + 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 = "") + 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/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..a12b7048008 --- /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 = null; + + @JsonProperty("dateTime") + private OffsetDateTime dateTime = null; + + @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..edef1b3e626 --- /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 = 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/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..2f89b60db0b --- /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 = 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/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..4adcfed3c3d --- /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 = 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/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..1f55823fcf4 --- /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 = 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 = "") + 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..7372bf2d2fd --- /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 = null; + + 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..cff13953de0 --- /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 = 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; + } + + @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 = 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 = "") + 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..0abe10bcfc2 --- /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 = 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 = "") + 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..183260074e2 --- /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 = null; + + @JsonProperty("category") + private Category category = null; + + @JsonProperty("name") + private String name = null; + + @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 = 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 = "") + 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..17bd805fa5c --- /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 = null; + + @JsonProperty("baz") + private String baz = null; + + /** + * 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..f0181742543 --- /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 = 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/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..2607dc2a1a5 --- /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 = 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/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..42d73dd62dc --- /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 = 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/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/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/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/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/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-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/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/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/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/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..59801547b04 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 @@ -499,7 +499,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 +524,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 +571,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 +641,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 +965,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 +1082,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 +1102,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 +1165,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..6ca9910ab2a 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 { @@ -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 { @@ -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 { @@ -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..14e85162f7e 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 { @@ -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 { @@ -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 { @@ -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 { 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/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..59801547b04 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 @@ -499,7 +499,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 +524,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 +571,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 +641,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 +965,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 +1082,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 +1102,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 +1165,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..6ca9910ab2a 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 { @@ -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 { @@ -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 { @@ -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..14e85162f7e 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 { @@ -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 { @@ -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 { @@ -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 { 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/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/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/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/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/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/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/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/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/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/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-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/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-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..6d94c9c2e12 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.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..2d5d6ba1369 --- /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 = "null"; // 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 +LocalDate date = new LocalDate(); // LocalDate | None +OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None +String password = "null"; // String | None +String paramCallback = "null"; // 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 | [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] + +### 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("enumHeaderStringArray_example"); // 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) +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] [default to $] [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 = "null"; // String | field1 +String param2 = "null"; // 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 | [default to null] + **param2** | **String**| field2 | [default to null] + +### 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..f3b592d43fe --- /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** | [**StringBooleanMap**](StringBooleanMap.md) | | [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..0005f283293 --- /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("status_example"); // 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("tags_example"); // 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 = "null"; // String | Updated name of the pet +String status = "null"; // 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] [default to null] + **status** | **String**| Updated status of the pet | [optional] [default to null] + +### 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 = "null"; // String | Additional data to pass to server +File file = new File("null"); // 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] [default to null] + **file** | **File**| file to upload | [optional] [default to null] + +### 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("null"); // File | file to upload +String additionalMetadata = "null"; // 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 | [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + +### 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..795bb22a03f --- /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(new List()); // 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(new List()); // 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..1a9ea5cbba4 --- /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, 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) + * @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) + * @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) + * @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..75fff9f67c4 --- /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, default to null) + * @param status Updated status of the pet (optional, default to null) + * @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, default to null) + * @param file file to upload (optional, default to null) + * @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 + ); + + /** + * 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) + * @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 + ); + +} 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..96bdf028335 --- /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 = null; + + @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..93ab5bb6add --- /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 = 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/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..bed98769d85 --- /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 = 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/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..7a342072469 --- /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 = 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/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..2f4d3aadd35 --- /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 = 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/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..c6efc5a533e --- /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 = 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/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..29210dd068e --- /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 = 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/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..32a694a4de1 --- /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 = null; + + /** + * 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..2d835a86ed8 --- /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 = null; + + /** + * 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 = null; + + /** + * 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 = 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; + } + + @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 = 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 + **/ + @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..0b0d2915632 --- /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 = 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 File 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 + **/ + @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..dee87cf7fb4 --- /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 = null; + + @JsonProperty("foo") + private String foo = null; + + /** + * 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..aca072ecc75 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,227 @@ +/* + * OpenAPI Petstore + * 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 org.openapitools.client.model.StringBooleanMap; +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 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 + **/ + @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(StringBooleanMap indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @Valid + @ApiModelProperty(value = "") + 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/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..212fd13d413 --- /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 = null; + + @JsonProperty("dateTime") + private OffsetDateTime dateTime = null; + + @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..bcdb67df9de --- /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 = 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/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..8eb69f7d469 --- /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 = 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/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..7fd7e7c0cb4 --- /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 = 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/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..16a25a54a29 --- /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 = 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 + **/ + @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..c3bada4d06f --- /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 = null; + + 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..e109aaa7cbb --- /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 = 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; + } + + @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 = 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 + **/ + @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..f0bf1fbaab2 --- /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 = 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 + **/ + @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..eda15f833c6 --- /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 = null; + + @JsonProperty("category") + private Category category = null; + + @JsonProperty("name") + private String name = null; + + @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 = 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 + **/ + @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..882a50757ad --- /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 = null; + + @JsonProperty("baz") + private String baz = null; + + /** + * 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..0a73668a0ec --- /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 = 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/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..ea23d8f46c2 --- /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 = 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/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..5173076477d --- /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 = 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/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/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/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/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/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/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/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/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/webclient/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java index 460bd563c0f..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 @@ -546,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()])); } 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/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/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/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index dd0f4d4a801..3e1177c6df4 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 [ 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..e842ff253bd 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 [ @@ -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 [ @@ -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 [ @@ -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 [ @@ -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 [ 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..de971b6bc39 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 [ 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..006f6ee82f8 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -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 [ @@ -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 [ @@ -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 [ @@ -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 [ @@ -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 [ 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..c80856bb719 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -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 [ @@ -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 [ @@ -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 [ 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..72ee3b3ef69 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -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 [ @@ -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 [ 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/ObjectSerializer.php b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index 05f6cb4e6f4..29f35933261 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -68,7 +68,7 @@ class ObjectSerializer 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())) { + && !in_array($value, $openAPIType::getAllowableEnumValues(), true)) { $imploded = implode("', '", $openAPIType::getAllowableEnumValues()); throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); } @@ -230,6 +230,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 +243,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 +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/python-asyncio/.openapi-generator/VERSION b/samples/client/petstore/python-asyncio/.openapi-generator/VERSION index c791c986fbb..105bb87d77b 100644 --- a/samples/client/petstore/python-asyncio/.openapi-generator/VERSION +++ b/samples/client/petstore/python-asyncio/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.3-SNAPSHOT \ No newline at end of file +3.2.2-SNAPSHOT \ No newline at end of file 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/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-tornado/.openapi-generator/VERSION b/samples/client/petstore/python-tornado/.openapi-generator/VERSION index c791c986fbb..105bb87d77b 100644 --- a/samples/client/petstore/python-tornado/.openapi-generator/VERSION +++ b/samples/client/petstore/python-tornado/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.3-SNAPSHOT \ No newline at end of file +3.2.2-SNAPSHOT \ No newline at end of file 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/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/.openapi-generator/VERSION b/samples/client/petstore/python/.openapi-generator/VERSION index c791c986fbb..105bb87d77b 100644 --- a/samples/client/petstore/python/.openapi-generator/VERSION +++ b/samples/client/petstore/python/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.3-SNAPSHOT \ No newline at end of file +3.2.2-SNAPSHOT \ No newline at end of file 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/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/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/swift3/default/.openapi-generator/VERSION b/samples/client/petstore/swift3/default/.openapi-generator/VERSION index 4395ff59232..c791c986fbb 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.2.3-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..c791c986fbb 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.2.3-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..c791c986fbb 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.2.3-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..c791c986fbb 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.2.3-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..c791c986fbb 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.2.3-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..c791c986fbb 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.2.3-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/objcCompatible/.openapi-generator/VERSION b/samples/client/petstore/swift4/objcCompatible/.openapi-generator/VERSION index 4395ff59232..c791c986fbb 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.2.3-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/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/promisekit/.openapi-generator/VERSION b/samples/client/petstore/swift4/promisekit/.openapi-generator/VERSION index 4395ff59232..c791c986fbb 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.2.3-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/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/rxswift/.openapi-generator/VERSION b/samples/client/petstore/swift4/rxswift/.openapi-generator/VERSION index 4395ff59232..c791c986fbb 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.2.3-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/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/unwrapRequired/.openapi-generator/VERSION b/samples/client/petstore/swift4/unwrapRequired/.openapi-generator/VERSION index 4395ff59232..c791c986fbb 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.2.3-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/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/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-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/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..ead5db52eaa 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 + 3.3.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..6d94c9c2e12 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 +3.3.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/lib/Api/AnotherFakeApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index dd0f4d4a801..3e1177c6df4 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 [ 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..8a12864eeaf 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 [ @@ -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 [ @@ -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 [ @@ -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 [ @@ -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 [ 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..de971b6bc39 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 [ 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..006f6ee82f8 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 @@ -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 [ @@ -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 [ @@ -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 [ @@ -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 [ @@ -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 [ 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..cd717f9d916 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 @@ -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 [ @@ -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 [ @@ -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 [ 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..f68036d2570 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 @@ -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 [ @@ -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 [ 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/ObjectSerializer.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index 05f6cb4e6f4..29f35933261 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -68,7 +68,7 @@ class ObjectSerializer 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())) { + && !in_array($value, $openAPIType::getAllowableEnumValues(), true)) { $imploded = implode("', '", $openAPIType::getAllowableEnumValues()); throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); } @@ -230,6 +230,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 +243,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 +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/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..d33c5efd3e9 --- /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: kotlin.Long,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: kotlin.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: kotlin.Array): 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: kotlin.Array): 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: kotlin.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: kotlin.Long,@ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestParam(value="name", required=false) name: kotlin.String ,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) status: kotlin.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: kotlin.Long,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.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..e7bd7fae34e --- /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: kotlin.Long,apiKey: kotlin.String): Unit + + fun findPetsByStatus(status: kotlin.Array): List + + fun findPetsByTags(tags: kotlin.Array): List + + fun getPetById(petId: kotlin.Long): Pet + + fun updatePet(pet: Pet): Unit + + fun updatePetWithForm(petId: kotlin.Long,name: kotlin.String,status: kotlin.String): Unit + + fun uploadFile(petId: kotlin.Long,additionalMetadata: kotlin.String,file: org.springframework.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..e898ab98921 --- /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: kotlin.Long,apiKey: kotlin.String): Unit { + TODO("Implement me") + } + + override fun findPetsByStatus(status: kotlin.Array): List { + TODO("Implement me") + } + + override fun findPetsByTags(tags: kotlin.Array): List { + TODO("Implement me") + } + + override fun getPetById(petId: kotlin.Long): Pet { + TODO("Implement me") + } + + override fun updatePet(pet: Pet): Unit { + TODO("Implement me") + } + + override fun updatePetWithForm(petId: kotlin.Long,name: kotlin.String,status: kotlin.String): Unit { + TODO("Implement me") + } + + override fun uploadFile(petId: kotlin.Long,additionalMetadata: kotlin.String,file: org.springframework.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..686c54b18bb --- /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: kotlin.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 = kotlin.Int::class, + responseContainer = "Map", + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")]) + @RequestMapping( + value = ["/store/inventory"], + produces = ["application/json"], + method = [RequestMethod.GET]) + fun getInventory(): ResponseEntity> { + return ResponseEntity(service.getInventory(), HttpStatus.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: kotlin.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..5eb379cb185 --- /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: kotlin.String): Unit + + fun getInventory(): Map + + fun getOrderById(orderId: kotlin.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..87d2551740d --- /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: kotlin.String): Unit { + TODO("Implement me") + } + + override fun getInventory(): Map { + TODO("Implement me") + } + + override fun getOrderById(orderId: kotlin.Long): Order { + TODO("Implement me") + } + + override fun placeOrder(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..a6f25a4fd38 --- /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: kotlin.Array): 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: kotlin.Array): 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: kotlin.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: kotlin.String): ResponseEntity { + return ResponseEntity(service.getUserByName(username), HttpStatus.OK) + } + + @ApiOperation( + value = "Logs user into the system", + nickname = "loginUser", + notes = "", + response = kotlin.String::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) + @RequestMapping( + value = ["/user/login"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + return ResponseEntity(service.loginUser(username, password), HttpStatus.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: kotlin.String,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity { + return ResponseEntity(service.updateUser(username, user), HttpStatus.OK) + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt new file mode 100644 index 00000000000..4b913ace3db --- /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: kotlin.Array): Unit + + fun createUsersWithListInput(user: kotlin.Array): Unit + + fun deleteUser(username: kotlin.String): Unit + + fun getUserByName(username: kotlin.String): User + + fun loginUser(username: kotlin.String,password: kotlin.String): kotlin.String + + fun logoutUser(): Unit + + fun updateUser(username: kotlin.String,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..9600f607688 --- /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: kotlin.Array): Unit { + TODO("Implement me") + } + + override fun createUsersWithListInput(user: kotlin.Array): Unit { + TODO("Implement me") + } + + override fun deleteUser(username: kotlin.String): Unit { + TODO("Implement me") + } + + override fun getUserByName(username: kotlin.String): User { + TODO("Implement me") + } + + override fun loginUser(username: kotlin.String,password: kotlin.String): kotlin.String { + TODO("Implement me") + } + + override fun logoutUser(): Unit { + TODO("Implement me") + } + + override fun updateUser(username: kotlin.String,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..440495ed85a --- /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: kotlin.String? = null, + + @ApiModelProperty(value = "Updated status of the pet") + @JsonProperty("status") val status: kotlin.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..0b7b3dc8917 --- /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: kotlin.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..36d48aa0938 --- /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: kotlin.Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("name") val name: kotlin.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..9a259e9baa2 --- /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: kotlin.Int? = null, + + @ApiModelProperty(value = "") + @JsonProperty("type") val type: kotlin.String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("message") val message: kotlin.String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt new file mode 100644 index 00000000000..2a7a639a9cf --- /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: kotlin.Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("petId") val petId: kotlin.Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("quantity") val quantity: kotlin.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: kotlin.Boolean? = null +) { + + /** + * Order Status + * Values: placed,approved,delivered + */ + enum class Status(val value: kotlin.String) { + + @JsonProperty("placed") placed("placed"), + + @JsonProperty("approved") approved("approved"), + + @JsonProperty("delivered") delivered("delivered"); + + } + +} + diff --git a/samples/server/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..29665f17797 --- /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: kotlin.String, + + @get:NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("photoUrls") val photoUrls: kotlin.Array, + + @ApiModelProperty(value = "") + @JsonProperty("id") val id: kotlin.Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("category") val category: Category? = null, + + @ApiModelProperty(value = "") + @JsonProperty("tags") val tags: kotlin.Array? = 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: kotlin.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..76b362380bf --- /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: kotlin.Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("name") val name: kotlin.String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt new file mode 100644 index 00000000000..6ebdab0208c --- /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: kotlin.Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("username") val username: kotlin.String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("firstName") val firstName: kotlin.String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("lastName") val lastName: kotlin.String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("email") val email: kotlin.String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("password") val password: kotlin.String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("phone") val phone: kotlin.String? = null, + + @ApiModelProperty(value = "User Status") + @JsonProperty("userStatus") val userStatus: kotlin.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 2cc6d3eba27..b0c591d10f6 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/Dockerfile +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/Dockerfile @@ -23,7 +23,7 @@ RUN apk add --update \ 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/src/handlers/OAIApiRouter.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/handlers/OAIApiRouter.cpp index 2f665944257..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" @@ -29,7 +29,7 @@ OAIApiRouter::OAIApiRouter() { } OAIApiRouter::~OAIApiRouter(){ - qDebug() << "~ApiRouter()"; + delete OAIPetApiApiHandler; delete OAIStoreApiApiHandler; delete OAIUserApiApiHandler; @@ -117,11 +117,7 @@ bool OAIApiRouter::handleRequestAndExtractPathParam(QHttpEngine::Socket *socket) { auto completePath = QString("%1 %2").arg("DELETE").arg("/v2/pet/{petId}").toLower(); if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { - QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); - completePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); - completePath.append("[\\/]?$"); - QRegularExpression pathExpr( completePath ); - QRegularExpressionMatch match = pathExpr.match( reqPath ); + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); if ( match.hasMatch() ){ QString petId = match.captured(QString("petId").toLower()); auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); @@ -133,11 +129,7 @@ bool OAIApiRouter::handleRequestAndExtractPathParam(QHttpEngine::Socket *socket) { auto completePath = QString("%1 %2").arg("GET").arg("/v2/pet/{petId}").toLower(); if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { - QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); - completePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); - completePath.append("[\\/]?$"); - QRegularExpression pathExpr( completePath ); - QRegularExpressionMatch match = pathExpr.match( reqPath ); + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); if ( match.hasMatch() ){ QString petId = match.captured(QString("petId").toLower()); auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); @@ -149,11 +141,7 @@ bool OAIApiRouter::handleRequestAndExtractPathParam(QHttpEngine::Socket *socket) { auto completePath = QString("%1 %2").arg("POST").arg("/v2/pet/{petId}").toLower(); if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { - QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); - completePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); - completePath.append("[\\/]?$"); - QRegularExpression pathExpr( completePath ); - QRegularExpressionMatch match = pathExpr.match( reqPath ); + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); if ( match.hasMatch() ){ QString petId = match.captured(QString("petId").toLower()); auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); @@ -165,11 +153,7 @@ bool OAIApiRouter::handleRequestAndExtractPathParam(QHttpEngine::Socket *socket) { auto completePath = QString("%1 %2").arg("POST").arg("/v2/pet/{petId}/uploadImage").toLower(); if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { - QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); - completePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); - completePath.append("[\\/]?$"); - QRegularExpression pathExpr( completePath ); - QRegularExpressionMatch match = pathExpr.match( reqPath ); + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); if ( match.hasMatch() ){ QString petId = match.captured(QString("petId").toLower()); auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); @@ -181,11 +165,7 @@ bool OAIApiRouter::handleRequestAndExtractPathParam(QHttpEngine::Socket *socket) { auto completePath = QString("%1 %2").arg("DELETE").arg("/v2/store/order/{orderId}").toLower(); if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { - QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); - completePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); - completePath.append("[\\/]?$"); - QRegularExpression pathExpr( completePath ); - QRegularExpressionMatch match = pathExpr.match( reqPath ); + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); if ( match.hasMatch() ){ QString orderId = match.captured(QString("orderId").toLower()); auto reqObj = new OAIStoreApiRequest(socket, OAIStoreApiApiHandler); @@ -197,11 +177,7 @@ bool OAIApiRouter::handleRequestAndExtractPathParam(QHttpEngine::Socket *socket) { auto completePath = QString("%1 %2").arg("GET").arg("/v2/store/order/{orderId}").toLower(); if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { - QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); - completePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); - completePath.append("[\\/]?$"); - QRegularExpression pathExpr( completePath ); - QRegularExpressionMatch match = pathExpr.match( reqPath ); + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); if ( match.hasMatch() ){ QString orderId = match.captured(QString("orderId").toLower()); auto reqObj = new OAIStoreApiRequest(socket, OAIStoreApiApiHandler); @@ -213,11 +189,7 @@ bool OAIApiRouter::handleRequestAndExtractPathParam(QHttpEngine::Socket *socket) { auto completePath = QString("%1 %2").arg("DELETE").arg("/v2/user/{username}").toLower(); if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { - QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); - completePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); - completePath.append("[\\/]?$"); - QRegularExpression pathExpr( completePath ); - QRegularExpressionMatch match = pathExpr.match( reqPath ); + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); if ( match.hasMatch() ){ QString username = match.captured(QString("username").toLower()); auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); @@ -229,11 +201,7 @@ bool OAIApiRouter::handleRequestAndExtractPathParam(QHttpEngine::Socket *socket) { auto completePath = QString("%1 %2").arg("GET").arg("/v2/user/{username}").toLower(); if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { - QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); - completePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); - completePath.append("[\\/]?$"); - QRegularExpression pathExpr( completePath ); - QRegularExpressionMatch match = pathExpr.match( reqPath ); + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); if ( match.hasMatch() ){ QString username = match.captured(QString("username").toLower()); auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); @@ -245,11 +213,7 @@ bool OAIApiRouter::handleRequestAndExtractPathParam(QHttpEngine::Socket *socket) { auto completePath = QString("%1 %2").arg("PUT").arg("/v2/user/{username}").toLower(); if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { - QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); - completePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); - completePath.append("[\\/]?$"); - QRegularExpression pathExpr( completePath ); - QRegularExpressionMatch match = pathExpr.match( reqPath ); + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); if ( match.hasMatch() ){ QString username = match.captured(QString("username").toLower()); auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); 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 35aedba6a84..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 @@ -89,6 +90,14 @@ private : } 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/flaskConnexion-python2/.openapi-generator/VERSION b/samples/server/petstore/flaskConnexion-python2/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 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.0-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/.openapi-generator/VERSION b/samples/server/petstore/flaskConnexion/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 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.0-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/go-api-server/.openapi-generator/VERSION b/samples/server/petstore/go-api-server/.openapi-generator/VERSION index 82602aa4190..c791c986fbb 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.2.3-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/jaxrs-jersey/.openapi-generator/VERSION b/samples/server/petstore/jaxrs-jersey/.openapi-generator/VERSION index 14900cee60e..c791c986fbb 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.2.3-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..5cc52cf8f10 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..d6aca4e4be3 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..15bc0653ec2 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..4bc02b8fc25 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..deaa2ea7aa9 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 @@ -31,7 +31,7 @@ import javax.validation.constraints.*; @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-08-29T07:47:48.785+02:00[Europe/Zurich]") public class PetApi { private final PetApiService delegate; 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..3b79de69e71 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..d93e01928fe 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 @@ -30,7 +30,7 @@ import javax.validation.constraints.*; @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-08-29T07:47:48.785+02:00[Europe/Zurich]") public class StoreApi { private final StoreApiService delegate; 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..952e554c473 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..28589f66e96 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..5531c4f9e67 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 @@ -30,7 +30,7 @@ import javax.validation.constraints.*; @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-08-29T07:47:48.785+02:00[Europe/Zurich]") public class UserApi { private final UserApiService delegate; 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..572a568f050 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..34c1291b795 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Body.java @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.*; + +/** + * Body + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-29T07:47:48.785+02:00[Europe/Zurich]") +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..e57d78b0b71 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Body1.java @@ -0,0 +1,115 @@ +/* + * 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.*; + +/** + * Body1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-29T07:47:48.785+02:00[Europe/Zurich]") +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..47a04f30d1c 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 @@ -24,7 +24,7 @@ import javax.validation.constraints.*; * 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-08-29T07:47:48.785+02:00[Europe/Zurich]") public class Category { @JsonProperty("id") private Long id = null; 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..dae86b07e40 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 @@ -24,7 +24,7 @@ import javax.validation.constraints.*; * 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-08-29T07:47:48.785+02:00[Europe/Zurich]") public class ModelApiResponse { @JsonProperty("code") private Integer code = null; 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..b3e07ef3014 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 @@ -26,7 +26,7 @@ import javax.validation.constraints.*; * 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-08-29T07:47:48.785+02:00[Europe/Zurich]") public class Order { @JsonProperty("id") private Long id = null; 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..92a06e101e7 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 @@ -29,7 +29,7 @@ import javax.validation.constraints.*; * 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-08-29T07:47:48.785+02:00[Europe/Zurich]") public class Pet { @JsonProperty("id") private Long id = null; 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..b2576bd98ae 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 @@ -24,7 +24,7 @@ import javax.validation.constraints.*; * 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-08-29T07:47:48.785+02:00[Europe/Zurich]") public class Tag { @JsonProperty("id") private Long id = null; 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..e417fbd7ca6 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 @@ -24,7 +24,7 @@ import javax.validation.constraints.*; * 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-08-29T07:47:48.785+02:00[Europe/Zurich]") public class User { @JsonProperty("id") private Long id = null; 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..79a5da655de 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..51f64e041a2 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..8496033949e 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..f4a3e112321 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..8adf9550114 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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..63312af2083 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-08-29T07:47:48.785+02:00[Europe/Zurich]") 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/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-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/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/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-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/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/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/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/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/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/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..d33c5efd3e9 --- /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: kotlin.Long,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: kotlin.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: kotlin.Array): 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: kotlin.Array): 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: kotlin.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: kotlin.Long,@ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestParam(value="name", required=false) name: kotlin.String ,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) status: kotlin.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: kotlin.Long,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.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..e7bd7fae34e --- /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: kotlin.Long,apiKey: kotlin.String): Unit + + fun findPetsByStatus(status: kotlin.Array): List + + fun findPetsByTags(tags: kotlin.Array): List + + fun getPetById(petId: kotlin.Long): Pet + + fun updatePet(pet: Pet): Unit + + fun updatePetWithForm(petId: kotlin.Long,name: kotlin.String,status: kotlin.String): Unit + + fun uploadFile(petId: kotlin.Long,additionalMetadata: kotlin.String,file: org.springframework.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..e898ab98921 --- /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: kotlin.Long,apiKey: kotlin.String): Unit { + TODO("Implement me") + } + + override fun findPetsByStatus(status: kotlin.Array): List { + TODO("Implement me") + } + + override fun findPetsByTags(tags: kotlin.Array): List { + TODO("Implement me") + } + + override fun getPetById(petId: kotlin.Long): Pet { + TODO("Implement me") + } + + override fun updatePet(pet: Pet): Unit { + TODO("Implement me") + } + + override fun updatePetWithForm(petId: kotlin.Long,name: kotlin.String,status: kotlin.String): Unit { + TODO("Implement me") + } + + override fun uploadFile(petId: kotlin.Long,additionalMetadata: kotlin.String,file: org.springframework.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..4384a8def7a --- /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: kotlin.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 = kotlin.Int::class, + responseContainer = "Map", + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")]) + @RequestMapping( + value = ["/store/inventory"], + produces = ["application/json"], + method = [RequestMethod.GET]) + fun getInventory(): ResponseEntity> { + return ResponseEntity(service.getInventory(), HttpStatus.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: kotlin.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..5eb379cb185 --- /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: kotlin.String): Unit + + fun getInventory(): Map + + fun getOrderById(orderId: kotlin.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..87d2551740d --- /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: kotlin.String): Unit { + TODO("Implement me") + } + + override fun getInventory(): Map { + TODO("Implement me") + } + + override fun getOrderById(orderId: kotlin.Long): Order { + TODO("Implement me") + } + + override fun placeOrder(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..8564f459f76 --- /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: kotlin.Array): 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: kotlin.Array): 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: kotlin.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: kotlin.String): ResponseEntity { + return ResponseEntity(service.getUserByName(username), HttpStatus.OK) + } + + @ApiOperation( + value = "Logs user into the system", + nickname = "loginUser", + notes = "", + response = kotlin.String::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) + @RequestMapping( + value = ["/user/login"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + return ResponseEntity(service.loginUser(username, password), HttpStatus.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: kotlin.String,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity { + return ResponseEntity(service.updateUser(username, user), HttpStatus.OK) + } +} diff --git a/samples/server/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..4b913ace3db --- /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: kotlin.Array): Unit + + fun createUsersWithListInput(user: kotlin.Array): Unit + + fun deleteUser(username: kotlin.String): Unit + + fun getUserByName(username: kotlin.String): User + + fun loginUser(username: kotlin.String,password: kotlin.String): kotlin.String + + fun logoutUser(): Unit + + fun updateUser(username: kotlin.String,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..9600f607688 --- /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: kotlin.Array): Unit { + TODO("Implement me") + } + + override fun createUsersWithListInput(user: kotlin.Array): Unit { + TODO("Implement me") + } + + override fun deleteUser(username: kotlin.String): Unit { + TODO("Implement me") + } + + override fun getUserByName(username: kotlin.String): User { + TODO("Implement me") + } + + override fun loginUser(username: kotlin.String,password: kotlin.String): kotlin.String { + TODO("Implement me") + } + + override fun logoutUser(): Unit { + TODO("Implement me") + } + + override fun updateUser(username: kotlin.String,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..36d48aa0938 --- /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: kotlin.Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("name") val name: kotlin.String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt new file mode 100644 index 00000000000..9a259e9baa2 --- /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: kotlin.Int? = null, + + @ApiModelProperty(value = "") + @JsonProperty("type") val type: kotlin.String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("message") val message: kotlin.String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt new file mode 100644 index 00000000000..2a7a639a9cf --- /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: kotlin.Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("petId") val petId: kotlin.Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("quantity") val quantity: kotlin.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: kotlin.Boolean? = null +) { + + /** + * Order Status + * Values: placed,approved,delivered + */ + enum class Status(val value: kotlin.String) { + + @JsonProperty("placed") placed("placed"), + + @JsonProperty("approved") approved("approved"), + + @JsonProperty("delivered") delivered("delivered"); + + } + +} + diff --git a/samples/server/petstore/kotlin-springboot/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..29665f17797 --- /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: kotlin.String, + + @get:NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("photoUrls") val photoUrls: kotlin.Array, + + @ApiModelProperty(value = "") + @JsonProperty("id") val id: kotlin.Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("category") val category: Category? = null, + + @ApiModelProperty(value = "") + @JsonProperty("tags") val tags: kotlin.Array? = 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: kotlin.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..76b362380bf --- /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: kotlin.Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("name") val name: kotlin.String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt new file mode 100644 index 00000000000..6ebdab0208c --- /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: kotlin.Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("username") val username: kotlin.String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("firstName") val firstName: kotlin.String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("lastName") val lastName: kotlin.String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("email") val email: kotlin.String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("password") val password: kotlin.String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("phone") val phone: kotlin.String? = null, + + @ApiModelProperty(value = "User Status") + @JsonProperty("userStatus") val userStatus: kotlin.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..4adc9d60f8c 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 */ 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/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/client/mod.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs index 78aa49e0085..3f868e0407c 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs @@ -249,7 +249,7 @@ impl Api for Client where let uri = format!( - "{}/dummy", + "{}//dummy", self.base_path ); diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs index aceb8e42ccc..50b0fc6207f 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs @@ -35,7 +35,7 @@ mod mimetypes; pub use swagger::{ApiError, ContextWrapper}; -pub const BASE_PATH: &'static str = ""; +pub const BASE_PATH: &'static str = "/"; pub const API_VERSION: &'static str = "1.0.0"; 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/rust-server/output/rust-server-test/src/server/mod.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs index 919e430b084..f15596204ed 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs @@ -51,7 +51,7 @@ mod paths { lazy_static! { pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(&[ - r"^/dummy$" + r"^//dummy$" ]).unwrap(); } pub static ID_DUMMY: usize = 0; 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/FakeApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java index 6dfe4160b17..0ba0769182f 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,7 +35,7 @@ public interface FakeApiDelegate { /** * @see FakeApi#fakeOuterBooleanSerialize */ - default ResponseEntity fakeOuterBooleanSerialize( Boolean body) { + default ResponseEntity fakeOuterBooleanSerialize(Boolean body) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { @@ -51,7 +51,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,7 +67,7 @@ public interface FakeApiDelegate { /** * @see FakeApi#fakeOuterNumberSerialize */ - default ResponseEntity fakeOuterNumberSerialize( BigDecimal body) { + default ResponseEntity fakeOuterNumberSerialize(BigDecimal body) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { @@ -83,7 +83,7 @@ public interface FakeApiDelegate { /** * @see FakeApi#fakeOuterStringSerialize */ - default ResponseEntity fakeOuterStringSerialize( String body) { + default ResponseEntity fakeOuterStringSerialize(String body) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { @@ -99,7 +99,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 +107,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 +116,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 +132,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 +153,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 +168,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 +176,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 +185,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/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/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/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/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/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/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..51cb18a3217 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, 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) { + 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=">, $") @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) { + 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, 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) { + 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", defaultValue="null") @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..b7c338d094f --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -0,0 +1,230 @@ +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(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { + result = ApiUtil.getExampleResponse(exchange, "null"); + break; + } + } + 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(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { + result = ApiUtil.getExampleResponse(exchange, "null"); + break; + } + } + 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(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { + result = ApiUtil.getExampleResponse(exchange, "null"); + break; + } + } + 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..d5638fde33b 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") @Valid @RequestParam(value = "status", required = true) 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) @Valid @RequestParam(value = "tags", required = true) 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", 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) { + 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", defaultValue="null") @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/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-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/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..06c87b55137 100644 --- a/shippable.yml +++ b/shippable.yml @@ -12,7 +12,7 @@ build: ci: - 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 +24,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 +41,5 @@ build: - ./bin/run-all-petstore # generate all petstore samples (openapi3) - ./bin/openapi3/run-all-petstore + # generate test scripts + - ./bin/tests/run-all-test