mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 08:46:55 +00:00
Compare commits
185 Commits
update-swa
...
swift_null
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cfeff0c31c | ||
|
|
d933a69aed | ||
|
|
8b2e25e4da | ||
|
|
0c8481b8c7 | ||
|
|
213efd8e84 | ||
|
|
0029d9aa91 | ||
|
|
d4500b307f | ||
|
|
f955966b09 | ||
|
|
711a210423 | ||
|
|
f13043e433 | ||
|
|
08a5e81797 | ||
|
|
83d64b7e38 | ||
|
|
60567bddd6 | ||
|
|
cc1bfe5fef | ||
|
|
0ebc2f720e | ||
|
|
ebc9e291c3 | ||
|
|
7c7fa68737 | ||
|
|
5c24a54173 | ||
|
|
2b72df2135 | ||
|
|
88ed52fa88 | ||
|
|
c136b83bdb | ||
|
|
2272743c1d | ||
|
|
0c7820ccbe | ||
|
|
41acae19e4 | ||
|
|
8383f26616 | ||
|
|
cb38de9afa | ||
|
|
baa53cbf57 | ||
|
|
31827f5f35 | ||
|
|
af9eb8d7da | ||
|
|
9ae49db670 | ||
|
|
d2b299860d | ||
|
|
243589ec80 | ||
|
|
44f482f21a | ||
|
|
c8ac41c051 | ||
|
|
775d96c8e6 | ||
|
|
7a95c9e20d | ||
|
|
600a81f76e | ||
|
|
7dbda049f0 | ||
|
|
c8d5701089 | ||
|
|
b5fb92d5a8 | ||
|
|
8212e80d0e | ||
|
|
5dcd959f30 | ||
|
|
8293902134 | ||
|
|
0bf9926066 | ||
|
|
e901132ea9 | ||
|
|
7bb3579345 | ||
|
|
eb793ae279 | ||
|
|
5f6e53fc60 | ||
|
|
2664c628a3 | ||
|
|
078d7a38c0 | ||
|
|
af74f3443f | ||
|
|
cb5720e4d7 | ||
|
|
4317ac0297 | ||
|
|
bd992a4218 | ||
|
|
e20af77944 | ||
|
|
8408232d1a | ||
|
|
252c3e58be | ||
|
|
002da8d9f9 | ||
|
|
85b4ddea39 | ||
|
|
81fdc2abbd | ||
|
|
431aba8747 | ||
|
|
6f1b8ef658 | ||
|
|
b867a6c3d5 | ||
|
|
1a55020194 | ||
|
|
3019b5a5e1 | ||
|
|
ee2e4395a9 | ||
|
|
91a610ec0e | ||
|
|
21e0e0d5d5 | ||
|
|
0ea1ead59e | ||
|
|
aadaac7e17 | ||
|
|
b793a95765 | ||
|
|
5610610d44 | ||
|
|
1dfa61231c | ||
|
|
0b6dfdcd99 | ||
|
|
3fe0281d3b | ||
|
|
ba7fc2396b | ||
|
|
3f9d1b1fec | ||
|
|
a8826816fb | ||
|
|
667a6097b5 | ||
|
|
4538db92a2 | ||
|
|
9647416032 | ||
|
|
2ac46eda9f | ||
|
|
334d0dcb48 | ||
|
|
87dce1bfe1 | ||
|
|
8f43373948 | ||
|
|
e0b56502a3 | ||
|
|
8055231400 | ||
|
|
ec5df2e1c0 | ||
|
|
95c4a05b70 | ||
|
|
f15f814d9b | ||
|
|
f27ff79e93 | ||
|
|
763e7a0c14 | ||
|
|
e56bfe4af3 | ||
|
|
dc2907aced | ||
|
|
3242949e1a | ||
|
|
ea029b4029 | ||
|
|
68967b8705 | ||
|
|
3e6b72bcde | ||
|
|
3ebefccfa9 | ||
|
|
e73bf9be1d | ||
|
|
d46bff9e78 | ||
|
|
e18f361534 | ||
|
|
8d67acc3ed | ||
|
|
9ca4bac881 | ||
|
|
f2fe4fc200 | ||
|
|
096f2d0fc8 | ||
|
|
239d68df36 | ||
|
|
5fd15b8b18 | ||
|
|
640e2ca825 | ||
|
|
ddf0e3e225 | ||
|
|
dd152eefcc | ||
|
|
c7d4a965c7 | ||
|
|
458d47b4ae | ||
|
|
9cc7bd15f2 | ||
|
|
c63cf7e5f3 | ||
|
|
6a4e92887a | ||
|
|
03edb64030 | ||
|
|
ec7f2a0450 | ||
|
|
2a2eefe93d | ||
|
|
cec2818e1f | ||
|
|
91daca36ef | ||
|
|
12ba8174d1 | ||
|
|
8f13b88ed9 | ||
|
|
3be1196264 | ||
|
|
911cdd8d0c | ||
|
|
1b12b89fd8 | ||
|
|
d21b3390fe | ||
|
|
806141297b | ||
|
|
e39b420fa8 | ||
|
|
f25c6da856 | ||
|
|
b0549fe6da | ||
|
|
87727de079 | ||
|
|
8236424aff | ||
|
|
e4b39ce95e | ||
|
|
026612fed7 | ||
|
|
8f7e43b500 | ||
|
|
1443f01709 | ||
|
|
c2f786b8ad | ||
|
|
44d8b49dee | ||
|
|
f4d3df762a | ||
|
|
ceccb4f83a | ||
|
|
34ec98d17b | ||
|
|
2016bc086f | ||
|
|
28cf0b279d | ||
|
|
31d7bf9d18 | ||
|
|
d36dd47b12 | ||
|
|
5a54aa5726 | ||
|
|
9182784955 | ||
|
|
60e4c923dd | ||
|
|
dc7bcbdb85 | ||
|
|
7c480446e6 | ||
|
|
45d70e1bf3 | ||
|
|
f94ff32b0c | ||
|
|
e1116814c4 | ||
|
|
5bd63074c4 | ||
|
|
d0d545bbdd | ||
|
|
c290555e5e | ||
|
|
197294a167 | ||
|
|
7afd350616 | ||
|
|
7e772e1b71 | ||
|
|
ee7c8a82e8 | ||
|
|
136c1407ac | ||
|
|
5289262aec | ||
|
|
cba2d3b8cf | ||
|
|
cd6b844d75 | ||
|
|
16ac05dcdf | ||
|
|
859df23428 | ||
|
|
e12459f3bd | ||
|
|
8cd5a4187b | ||
|
|
a05f68431a | ||
|
|
15f680e1eb | ||
|
|
0beb8caa85 | ||
|
|
1f5aa22f5c | ||
|
|
dfb4c133d8 | ||
|
|
286ddf38f7 | ||
|
|
761e435248 | ||
|
|
1188d0f141 | ||
|
|
a390676cc6 | ||
|
|
b8f9e995ce | ||
|
|
158cdfeb3c | ||
|
|
1fc03c88b2 | ||
|
|
d64ec14ab4 | ||
|
|
73eae09738 | ||
|
|
e5912b4925 | ||
|
|
01222268e8 |
6
.github/.test/samples.json
vendored
6
.github/.test/samples.json
vendored
@@ -145,12 +145,6 @@
|
||||
"Documentation: Cwiki"
|
||||
]
|
||||
},
|
||||
{
|
||||
"input": "dart-flutter-petstore.sh",
|
||||
"matches": [
|
||||
"Client: Dart"
|
||||
]
|
||||
},
|
||||
{
|
||||
"input": "dart-jaguar-petstore.sh",
|
||||
"matches": [
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -174,6 +174,7 @@ samples/client/petstore/python-tornado/.venv/
|
||||
samples/client/petstore/typescript-angular2/npm/npm-debug.log
|
||||
samples/client/petstore/typescript-node/npm/npm-debug.log
|
||||
samples/client/petstore/typescript-angular/tsd-debug.log
|
||||
samples/client/petstore/typescript-fetch/tests/**/dist/
|
||||
|
||||
# aspnetcore
|
||||
samples/server/petstore/aspnetcore/.vs/
|
||||
@@ -186,6 +187,7 @@ samples/client/petstore/kotlin-string/build
|
||||
samples/openapi3/client/petstore/kotlin/build
|
||||
samples/server/petstore/kotlin-server/ktor/build
|
||||
samples/server/petstore/kotlin-springboot/build
|
||||
samples/client/petstore/kotlin-multiplatform/build/
|
||||
\?
|
||||
|
||||
# haskell
|
||||
|
||||
@@ -94,6 +94,8 @@ before_install:
|
||||
# - Rely on `kerl` for [pre-compiled versions available](https://docs.travis-ci.com/user/languages/erlang#Choosing-OTP-releases-to-test-against). Rely on installation path chosen by [`travis-erlang-builder`](https://github.com/travis-ci/travis-erlang-builder/blob/e6d016b1a91ca7ecac5a5a46395bde917ea13d36/bin/compile#L18).
|
||||
# - . ~/otp/18.2.1/activate && erl -version
|
||||
#- curl -f -L -o ./rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 && ./rebar3 version && export PATH="${TRAVIS_BUILD_DIR}:$PATH"
|
||||
# install valgrind for C++ memory test
|
||||
- sudo apt-get install valgrind
|
||||
# install Qt 5.10
|
||||
- sudo add-apt-repository --yes ppa:beineri/opt-qt-5.10.1-trusty
|
||||
- sudo apt-get update -qq
|
||||
|
||||
@@ -2,19 +2,32 @@ kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
# test haskell client
|
||||
- name: haskell-client-test
|
||||
image: haskell:8.6.5
|
||||
commands:
|
||||
- (cd samples/client/petstore/haskell-http-client/ && stack --install-ghc --no-haddock-deps haddock --fast && stack test --fast)
|
||||
# test Dart 2.x petstore client
|
||||
- name: dart2x-test
|
||||
image: google/dart
|
||||
commands:
|
||||
- (cd samples/client/petstore/dart-jaguar/openapi && pub get && pub run build_runner build --delete-conflicting-outputs)
|
||||
- (cd samples/client/petstore/dart-jaguar/flutter_petstore/openapi && pub get && pub run build_runner build --delete-conflicting-outputs)
|
||||
- (cd samples/client/petstore/dart2/openapi && pub get && pub run test)
|
||||
- (cd samples/client/petstore/dart2/petstore && pub get && pub run test)
|
||||
# test Java 11 HTTP client
|
||||
- name: java11-test
|
||||
image: hirokimatsumoto/alpine-openjdk-11
|
||||
image: openjdk:11.0
|
||||
commands:
|
||||
- ./mvnw clean install
|
||||
- ./mvnw --quiet verify -Psamples.droneio
|
||||
# test all generators with fake petstore spec (2.0, 3.0)
|
||||
- /bin/bash bin/utils/test-fake-petstore-for-all.sh
|
||||
# generate test scripts
|
||||
- /bin/bash bin/tests/run-all-test
|
||||
# generate all petstore samples (client, servers, doc)
|
||||
- /bin/bash bin/run-all-petstore
|
||||
# generate all petstore samples (openapi3)
|
||||
- /bin/bash bin/openapi3/run-all-petstore
|
||||
# test ocaml petstore client
|
||||
- name: ocaml-test
|
||||
image: ocaml/opam2:4.07
|
||||
|
||||
@@ -14,14 +14,6 @@ if [ "$NODE_INDEX" = "1" ]; then
|
||||
mvn --quiet verify -Psamples.circleci
|
||||
mvn --quiet javadoc:javadoc -Psamples.circleci
|
||||
|
||||
# generate all petstore samples (client, servers, doc)
|
||||
./bin/run-all-petstore
|
||||
# generate all petstore samples (openapi3)
|
||||
./bin/openapi3/run-all-petstore
|
||||
# generate test scripts
|
||||
./bin/tests/run-all-test
|
||||
# test all generators with fake petstore spec (2.0, 3.0)
|
||||
./bin/utils/test-fake-petstore-for-all.sh
|
||||
elif [ "$NODE_INDEX" = "2" ]; then
|
||||
# run ensure-up-to-date sample script on SNAPSHOT version only
|
||||
project_version=`mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout`
|
||||
@@ -29,12 +21,6 @@ elif [ "$NODE_INDEX" = "2" ]; then
|
||||
echo "Running node $NODE_INDEX to test ensure-up-to-date"
|
||||
java -version
|
||||
|
||||
# install elm-format for formatting elm code
|
||||
npm install -g elm-format
|
||||
|
||||
# symlink elm-format
|
||||
sudo ln -s /opt/circleci/.nvm/versions/node/v12.1.0/bin/elm-format /usr/local/bin/elm-format
|
||||
|
||||
./bin/utils/ensure-up-to-date
|
||||
fi
|
||||
#elif [ "$NODE_INDEX" = "3" ]; then
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>TypeScriptFetchBuildNamespaceParameterInterfacesPestoreClientTests</artifactId>
|
||||
<artifactId>TypeScriptFetchBuildPrefixParameterInterfacesPestoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>TS Fetch Petstore Client (with namespacing for parameter interfaces)</name>
|
||||
58
README.md
58
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`4.1.0`): [](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`4.1.3-SNAPSHOT`): [](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://app.shippable.com/github/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
|
||||
@@ -65,11 +65,11 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
|
||||
|
||||
| | Languages/Frameworks |
|
||||
|-|-|
|
||||
**API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later), **C++** (cpp-restsdk, Qt5, Tizen), **Clojure**, **Dart (1.x, 2.x)**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client), **Kotlin**, **Lua**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (rust, rust-server), **Scala** (akka, http4s, scalaz, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x), **Typescript** (AngularJS, Angular (2.x - 8.x), Aurelia, Axios, Fetch, Inversify, jQuery, Node, Rxjs)
|
||||
**Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples)), **Kotlin** (Spring Boot, Ktor), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** ([Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra)
|
||||
**API documentation generators** | **HTML**, **Confluence Wiki**
|
||||
**API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0), **C++** (cpp-restsdk, Qt5, Tizen), **Clojure**, **Dart (1.x, 2.x)**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client), **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (rust, rust-server), **Scala** (akka, http4s, scalaz, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x), **Typescript** (AngularJS, Angular (2.x - 8.x), Aurelia, Axios, Fetch, Inversify, jQuery, Node, Rxjs)
|
||||
**Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** ([Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra)
|
||||
**API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**
|
||||
**Configuration files** | [**Apache2**](https://httpd.apache.org/)
|
||||
**Others** | **GraphQL**, **JMeter**, **MySQL Schema**
|
||||
**Others** | **GraphQL**, **JMeter**, **MySQL Schema**, **Protocol Buffer**
|
||||
|
||||
## Table of contents
|
||||
|
||||
@@ -108,8 +108,8 @@ OpenAPI Generator Version | Release Date | Notes
|
||||
---------------------------- | ------------ | -----
|
||||
5.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.0.0-SNAPSHOT/)| 13.05.2020 | Major release with breaking changes (no fallback)
|
||||
4.2.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.2.0-SNAPSHOT/)| 09.10.2019 | Minor release (breaking changes with fallbacks)
|
||||
4.1.1 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.1.1-SNAPSHOT/)| 23.08.2019 | Patch release (bug fixes, enhancements)
|
||||
[4.1.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.1.0) (latest stable release) | 09.08.2019 | Minor release (breaking changes with fallbacks)
|
||||
4.1.3 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.1.3-SNAPSHOT/)| 30.09.2019 | Patch release (bug fixes, enhancements)
|
||||
[4.1.2](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.1.2) (latest stable release) | 12.09.2019 | Patch release (bug fixes, enhancements)
|
||||
|
||||
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
|
||||
|
||||
@@ -165,16 +165,16 @@ See the different versions of the [openapi-generator-cli](https://mvnrepository.
|
||||
<!-- RELEASE_VERSION -->
|
||||
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
|
||||
|
||||
JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.0/openapi-generator-cli-4.1.0.jar`
|
||||
JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.3/openapi-generator-cli-4.1.3.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
```sh
|
||||
wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.0/openapi-generator-cli-4.1.0.jar -O openapi-generator-cli.jar
|
||||
wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.3/openapi-generator-cli-4.1.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/4.1.0/openapi-generator-cli-4.1.0.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.3/openapi-generator-cli-4.1.3.jar
|
||||
```
|
||||
|
||||
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
|
||||
@@ -389,10 +389,10 @@ openapi-generator version
|
||||
```
|
||||
|
||||
<!-- RELEASE_VERSION -->
|
||||
Or install a particular OpenAPI Generator version (e.g. v4.1.0):
|
||||
Or install a particular OpenAPI Generator version (e.g. v4.1.3):
|
||||
|
||||
```sh
|
||||
npm install @openapitools/openapi-generator-cli@cli-4.1.0 -g
|
||||
npm install @openapitools/openapi-generator-cli@cli-4.1.3 -g
|
||||
```
|
||||
|
||||
Or install it as dev-dependency:
|
||||
@@ -416,7 +416,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
|
||||
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g php -o c:\temp\php_api_client`)
|
||||
|
||||
<!-- RELEASE_VERSION -->
|
||||
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.0/openapi-generator-cli-4.1.0.jar)
|
||||
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.1.3/openapi-generator-cli-4.1.3.jar)
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`
|
||||
@@ -455,6 +455,7 @@ NAME
|
||||
SYNOPSIS
|
||||
openapi-generator-cli generate
|
||||
[(-a <authorization> | --auth <authorization>)]
|
||||
[--api-name-suffix <api name suffix>]
|
||||
[--api-package <api package>] [--artifact-id <artifact id>]
|
||||
[--artifact-version <artifact version>]
|
||||
[(-c <configuration file> | --config <configuration file>)]
|
||||
@@ -560,16 +561,20 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [Commencis](https://www.commencis.com/)
|
||||
- [Cupix](https://www.cupix.com/)
|
||||
- [DB Systel](https://www.dbsystel.de)
|
||||
- [Element AI](https://www.elementai.com/)
|
||||
- [FormAPI](https://formapi.io/)
|
||||
- [Fuse](https://www.fuse.no/)
|
||||
- [Gantner](https://www.gantner.com)
|
||||
- [GenFlow](https://github.com/RepreZen/GenFlow)
|
||||
- [GMO Pepabo](https://pepabo.com/en/)
|
||||
- [GoDaddy](https://godaddy.com)
|
||||
- [JustStar](https://www.juststarinfo.com)
|
||||
- [Klarna](https://www.klarna.com/)
|
||||
- [Médiavision](https://www.mediavision.fr/)
|
||||
- [Metaswitch](https://www.metaswitch.com/)
|
||||
- [Myworkout](https://myworkout.com)
|
||||
- [Paxos](https://www.paxos.com)
|
||||
- [Pricefx](https://www.pricefx.com/)
|
||||
- [Prometheus/Alertmanager](https://github.com/prometheus/alertmanager)
|
||||
- [Raiffeisen Schweiz Genossenschaft](https://www.raiffeisen.ch)
|
||||
- [RepreZen API Studio](https://www.reprezen.com/swagger-openapi-code-generation-api-first-microservices-enterprise-development)
|
||||
@@ -627,6 +632,23 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- 2019-07-08 - [OpenAPI Generator にコントリビュートしたら社名が載った話。(CAM) - CAM TECH BLOG](https://tech.cam-inc.co.jp/entry/2019/07/08/140000) by [CAM, Inc.](https://www.cam-inc.co.jp/)
|
||||
- 2019-07-14 - [OpenAPI GeneratorでPythonのクライアントライブラリを作成した](https://qiita.com/yuji38kwmt/items/dfb929316a1335a161c0) by [yuji38kwmt](https://qiita.com/yuji38kwmt)
|
||||
- 2019-07-19 - [Developer Experience (DX) for Open-Source Projects: How to Engage Developers and Build a Growing Developer Community](https://speakerdeck.com/wing328/developer-experience-dx-for-open-source-projects-english-japanese) by [William Cheng](https://twitter.com/wing328), [中野暁人](https://github.com/ackintosh) at [Open Source Summit Japan 2019](https://events.linuxfoundation.org/events/open-source-summit-japan-2019/)
|
||||
- 2019-08-14 - [Our OpenAPI journey with Standardizing SDKs](https://bitmovin.com/our-openapi-journey-with-standardizing-sdks/) by [Sebastian Burgstaller](https://bitmovin.com/author/sburgstaller/) at [Bitmovin](https://www.bitmovin.com)
|
||||
- 2019-08-15 - [APIのコードを自動生成させたいだけならgRPCでなくてもよくない?](https://www.m3tech.blog/entry/2019/08/15/110000) by [M3, Inc.](https://corporate.m3.com/)
|
||||
- 2019-08-22 - [マイクロサービスにおけるWeb APIスキーマの管理─ GraphQL、gRPC、OpenAPIの特徴と使いどころ](https://employment.en-japan.com/engineerhub/entry/2019/08/22/103000) by [@ota42y](https://twitter.com/ota42y)
|
||||
- 2019-08-24 - [SwaggerドキュメントからOpenAPI Generatorを使ってモックサーバー作成](https://qiita.com/masayoshi0222/items/4845e4c715d04587c104) by [坂本正義](https://qiita.com/masayoshi0222)
|
||||
- 2019-08-29 - [OpenAPI初探](https://cloud.tencent.com/developer/article/1495986) by [peakxie](https://cloud.tencent.com/developer/user/1113152) at [腾讯云社区](https://cloud.tencent.com/developer)
|
||||
- 2019-08-29 - [全面进化:Kubernetes CRD 1.16 GA前瞻](https://www.servicemesher.com/blog/kubernetes-1.16-crd-ga-preview/) by [Min Kim](https://github.com/yue9944882) at [ServiceMesher Blog](https://www.servicemesher.com/blog/)
|
||||
- 2019-09-01 - [Creating a PHP-Slim server using OpenAPI (Youtube video)](https://www.youtube.com/watch?v=5cJtbIrsYkg) by [Daniel Persson](https://www.youtube.com/channel/UCnG-TN23lswO6QbvWhMtxpA)
|
||||
- 2019-09-06 - [Vert.x and OpenAPI](https://wissel.net/blog/2019/09/vertx-and-openapi.html) by [Stephan H Wissel](https://twitter.com/notessensei) at [wissel.net blog](https://wissel.net)
|
||||
- 2019-09-09 - [Cloud-native development - Creating RESTful microservices](https://cloud.ibm.com/docs/cloud-native?topic=cloud-native-rest-api) in [IBM Cloud Docs](https://cloud.ibm.com/docs)
|
||||
- 2019-09-14 - [Generating and Configuring a Mastercard API Client](https://developer.mastercard.com/platform/documentation/generating-and-configuring-a-mastercard-api-client/) at [Mastercard Developers Platform](https://developer.mastercard.com/platform/documentation/)
|
||||
- 2019-09-15 - [OpenAPI(Swagger)導入下調べ](https://qiita.com/ShoichiKuraoka/items/f1f7a3c2376f7cd9c56a) by [Shoichi Kuraoka](https://qiita.com/ShoichiKuraoka)
|
||||
- 2019-09-17 - [Tutorial: Documenting http4k APIs with OpenApi3](https://www.http4k.org/tutorials/documenting_apis_with_openapi/) by [http4k](https://www.http4k.org/)
|
||||
- 2019-09-22 - [OpenAPI 3を完全に理解できる本](https://booth.pm/ja/items/1571902) by [@ota42y](https://twitter.com/ota42y)
|
||||
- 2019-09-22 - [RESTful APIs: Tutorial of OpenAPI Specification](https://medium.com/@amirm.lavasani/restful-apis-tutorial-of-openapi-specification-eeada0e3901d) by [Amir Lavasani](https://medium.com/@amirm.lavasani)
|
||||
- 2019-09-22 - [Redefining SDKs as software diversity kits](https://devrel.net/dev-rel/redefining-sdks-as-software-diversity-kits) by [Sid Maestre (Xero)](https://twitter.com/sidneyallen) at [DevRelCon San Francisco 2019](https://sf2019.devrel.net/)
|
||||
- 2019-09-23 - [swaggerからOpenApi GeneratorでSpringのコードを自動生成](https://qiita.com/littleFeet/items/492df2ad68a0799a5e5e) by [@littleFeet](https://qiita.com/littleFeet) at [Qiita](https://qiita.com/)
|
||||
|
||||
|
||||
## [6 - About Us](#table-of-contents)
|
||||
|
||||
@@ -689,7 +711,9 @@ Here is a list of template creators:
|
||||
* Javascript (Flow types) @jaypea
|
||||
* JMeter: @davidkiss
|
||||
* Kotlin: @jimschubert [:heart:](https://www.patreon.com/jimschubert)
|
||||
* Kotlin (MultiPlatform): @andrewemery
|
||||
* Lua: @daurnimator
|
||||
* Nim: @hokamoto
|
||||
* OCaml: @cgensoul
|
||||
* Perl: @wing328 [:heart:](https://www.patreon.com/wing328)
|
||||
* PHP (Guzzle): @baartosz
|
||||
@@ -738,6 +762,7 @@ Here is a list of template creators:
|
||||
* JAX-RS RestEasy (JBoss EAP): @jfiala
|
||||
* Kotlin: @jimschubert [:heart:](https://www.patreon.com/jimschubert)
|
||||
* Kotlin (Spring Boot): @dr4ke616
|
||||
* Kotlin (Vertx): @Wooyme
|
||||
* NodeJS Express: @YishTish
|
||||
* PHP Laravel: @renepardon
|
||||
* PHP Lumen: @abcsun
|
||||
@@ -751,6 +776,7 @@ Here is a list of template creators:
|
||||
* Scala Lagom: @gmkumar2005
|
||||
* Scala Play: @adigerber
|
||||
* Documentation
|
||||
* AsciiDoc: @man-at-home
|
||||
* HTML Doc 2: @jhitchcock
|
||||
* Confluence Wiki: @jhitchcock
|
||||
* Configuration
|
||||
@@ -759,6 +785,7 @@ Here is a list of template creators:
|
||||
* Avro: @sgadouar
|
||||
* GraphQL: @wing328 [:heart:](https://www.patreon.com/wing328)
|
||||
* MySQL: @ybelenko
|
||||
* Protocol Buffer: @wing328
|
||||
|
||||
:heart: = Link to support the contributor directly
|
||||
|
||||
@@ -800,9 +827,9 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Bash | @frol (2017/07) @bkryza (2017/08) @kenjones-cisco (2017/09) |
|
||||
| C | @zhemant (2018/11) |
|
||||
| C++ | @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @martindelille (2018/03) @muttleyxd (2019/08) |
|
||||
| C# | @mandrean (2017/08), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert) |
|
||||
| C# | @mandrean (2017/08), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert) @frankyjuang (2019/09) |
|
||||
| Clojure | |
|
||||
| Dart | @ircecho (2017/07) @swipesight (2018/09) @jaumard (2018/09) |
|
||||
| Dart | @ircecho (2017/07) @swipesight (2018/09) @jaumard (2018/09) @nickmeinhold (2019/09) |
|
||||
| Eiffel | @jvelilla (2017/09) |
|
||||
| Elixir | @mrmstn (2018/12) |
|
||||
| Elm | @eriktim (2018/09) |
|
||||
@@ -815,6 +842,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Java | @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) |
|
||||
| Kotlin | @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) |
|
||||
| Lua | @daurnimator (2017/08) |
|
||||
| Nim | |
|
||||
| NodeJS/Javascript | @CodeNinjai (2017/07) @frol (2017/07) @cliffano (2017/07) |
|
||||
| ObjC | |
|
||||
| OCaml | @cgensoul (2019/08) |
|
||||
|
||||
31
bin/asciidoc-documentation-petstore.sh
Executable file
31
bin/asciidoc-documentation-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/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} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/openapi-generator/src/main/resources/asciidoc-documentation --additional-properties=specDir=modules/openapi-generator/src/main/resources/asciidoc-documentation,snippetDir=. -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g asciidoc -o samples/documentation/asciidoc"
|
||||
|
||||
java ${JAVA_OPTS} -jar ${executable} ${ags}
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -g cpp-pistache-server -t modules/openapi-generator/src/main/resources/cpp-pistache-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml --additional-properties addExternalLibs=true -o samples/server/petstore/cpp-pistache $@"
|
||||
ags="generate -g cpp-pistache-server -t modules/openapi-generator/src/main/resources/cpp-pistache-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml --additional-properties addExternalLibs=true --additional-properties useStructModel=false -o samples/server/petstore/cpp-pistache $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/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 -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
|
||||
## Generate non-browserClient
|
||||
#ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger --additional-properties hideGenerationTimestamp=true,browserClient=false $@"
|
||||
#
|
||||
## then options to generate the library for vm would be:
|
||||
##ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger_vm --additional-properties browserClient=false,pubName=swagger_vm $@"
|
||||
#java $JAVA_OPTS -jar $executable $ags
|
||||
#
|
||||
## Generate browserClient
|
||||
#ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true $@"
|
||||
#java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
# Generate non-browserClient and put it to the flutter sample app
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/swagger --additional-properties hideGenerationTimestamp=true,browserClient=false $@"
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
# There is a proposal to allow importing different libraries depending on the environment:
|
||||
# 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.
|
||||
|
||||
@@ -28,23 +28,6 @@ fi
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
|
||||
# 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 --additional-properties hideGenerationTimestamp=true,browserClient=false $@"
|
||||
|
||||
# then options to generate the library for vm would be:
|
||||
#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi_vm --additional-properties browserClient=false,pubName=openapi_vm $@"
|
||||
# Generate client
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/dart2 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/petstore_client_lib --additional-properties hideGenerationTimestamp=true $@"
|
||||
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 --additional-properties hideGenerationTimestamp=true,browserClient=true $@"
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
# Generate non-browserClient and put it to the flutter sample app
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/flutter_petstore/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@"
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
# There is a proposal to allow importing different libraries depending on the environment:
|
||||
# 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.
|
||||
|
||||
31
bin/fsharp-functions-server-petstore.sh
Executable file
31
bin/fsharp-functions-server-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/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"
|
||||
ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g fsharp-functions -o samples/server/petstore/fsharp-functions"
|
||||
|
||||
java ${JAVA_OPTS} -jar ${executable} ${ags}
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust-reqwest --additional-properties packageName=petstore_client --library=reqwest $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-client-petstore-multiplatform --library multiplatform -o samples/client/petstore/kotlin-multiplatform $@"
|
||||
|
||||
java ${JAVA_OPTS} -jar ${executable} ${ags}
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8 -o samples/client/petstore/kotlin $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8,serializableModel=true -o samples/client/petstore/kotlin $@"
|
||||
|
||||
java ${JAVA_OPTS} -jar ${executable} ${ags}
|
||||
|
||||
@@ -27,7 +27,7 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-string --additional-properties dateLibrary=string -o samples/client/petstore/kotlin-string $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-string --additional-properties dateLibrary=string,serializableModel=true -o samples/client/petstore/kotlin-string $@"
|
||||
|
||||
java ${JAVA_OPTS} -jar ${executable} ${ags}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-server -g kotlin-server --library=ktor -o samples/server/petstore/kotlin-server/ktor --additional-properties hideGenerationTimestamp=true $@"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-server -g kotlin-server --library=ktor -o samples/server/petstore/kotlin-server/ktor --additional-properties hideGenerationTimestamp=true,serializableModel=true $@"
|
||||
|
||||
java ${JAVA_OPTS} -jar ${executable} ${ags}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ then
|
||||
fi
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/openapi-generator/src/test/resources/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"
|
||||
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,serializableModel=true"
|
||||
|
||||
echo "Cleaning previously generated files if any from samples/server/petstore/kotlin-springboot"
|
||||
rm -rf samples/server/petstore/kotlin-springboot
|
||||
|
||||
31
bin/kotlin-vertx-server-petstore.sh
Executable file
31
bin/kotlin-vertx-server-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/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} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin-vertx -o samples/server/petstore/kotlin/vertx"
|
||||
|
||||
java ${JAVA_OPTS} -jar ${executable} ${ags}
|
||||
@@ -22,7 +22,7 @@ executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
./mvnw -B clean package
|
||||
fi
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
@@ -30,7 +30,7 @@ ags="meta -n myClientCodegen -t DOCUMENTATION -p com.my.company.codegen -o sampl
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
mvn clean package -f samples/meta-codegen/pom.xml
|
||||
./mvnw 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 $@"
|
||||
|
||||
|
||||
31
bin/nim-client-petstore.sh
Executable file
31
bin/nim-client-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/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} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/openapi-generator/src/main/resources/nim-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml --additional-properties packageName=petstore -g nim -o samples/client/petstore/nim"
|
||||
|
||||
java ${JAVA_OPTS} -jar ${executable} ${ags}
|
||||
35
bin/openapi3/kotlin-client-petstore-multiplatform.sh
Executable file
35
bin/openapi3/kotlin-client-petstore-multiplatform.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=$(ls -ld "$SCRIPT")
|
||||
link=$(expr "$ls" : '.*-> \(.*\)$')
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=$(dirname "$SCRIPT")/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=$(dirname "$SCRIPT")/..
|
||||
APP_DIR=$(cd "${APP_DIR}"; pwd)
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -t modules/openapi-generator/src/main/resources/kotlin-client -g kotlin --artifact-id kotlin-client-petstore-multiplatform --library multiplatform -o samples/openapi3/client/petstore/kotlin-multiplatform $@"
|
||||
|
||||
echo "Cleaning previously generated files if any from samples/openapi3/client/petstore/kotlin-multiplatform"
|
||||
rm -rf samples/openapi3/client/petstore/kotlin-multiplatform
|
||||
|
||||
echo "Generating Kotling client..."
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -26,7 +26,7 @@ then
|
||||
fi
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -t modules/openapi-generator/src/main/resources/kotlin-client -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8 -o samples/openapi3/client/petstore/kotlin $@"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -t modules/openapi-generator/src/main/resources/kotlin-client -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8,serializableModel=true -o samples/openapi3/client/petstore/kotlin $@"
|
||||
|
||||
echo "Cleaning previously generated files if any from samples/openapi3/client/petstore/kotlin"
|
||||
rm -rf samples/openapi3/client/petstore/kotlin
|
||||
|
||||
@@ -26,7 +26,7 @@ then
|
||||
fi
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/openapi3/server/petstore/kotlin-springboot --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true"
|
||||
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/openapi3/server/petstore/kotlin-springboot --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,serializableModel=true"
|
||||
|
||||
echo "Cleaning previously generated files if any from samples/server/openapi3/petstore/kotlin-springboot"
|
||||
rm -rf samples/server/openapi3/petstore/kotlin-springboot
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
./bin/openapi3/typescript-fetch-petstore-with-npm-version.sh
|
||||
./bin/openapi3/typescript-fetch-petstore-interfaces.sh
|
||||
./bin/openapi3/typescript-fetch-petstore.sh
|
||||
./bin/openapi3/typescript-fetch-petstore-namespace-parameter-interfaces.sh
|
||||
./bin/openapi3/typescript-fetch-petstore-prefix-parameter-interfaces.sh
|
||||
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces --additional-properties namespaceParameterInterfaces=true $@"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces --additional-properties prefixParameterInterfaces=true $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
10
bin/openapi3/windows/nodejs-express-server-petstore.bat
Executable file
10
bin/openapi3/windows/nodejs-express-server-petstore.bat
Executable file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g nodejs-express-server -o samples\openapi3\server\petstore\nodejs-express-server
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
32
bin/protobuf-schema-petstore.sh
Executable file
32
bin/protobuf-schema-petstore.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/protobuf-schema -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g protobuf-schema -o samples/config/petstore/protobuf-schema --additional-properties packageName=petstore $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml -g python-experimental -o samples/client/petstore/python-experimental -DpackageName=petstore_api $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml -g python-experimental -o samples/client/petstore/python-experimental --additional-properties packageName=petstore_api $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
"gemName": "petstore",
|
||||
"moduleName": "Petstore",
|
||||
"library": "faraday",
|
||||
"gemVersion": "1.0.0"
|
||||
"gemVersion": "1.0.0",
|
||||
"strictSpecBehavior": false
|
||||
}
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
"gemName": "petstore",
|
||||
"library": "typhoeus",
|
||||
"moduleName": "Petstore",
|
||||
"gemVersion": "1.0.0"
|
||||
"gemVersion": "1.0.0",
|
||||
"strictSpecBehavior": false
|
||||
}
|
||||
|
||||
@@ -27,6 +27,21 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust --additional-properties packageName=petstore_client --library=hyper $@"
|
||||
|
||||
java ${JAVA_OPTS} -jar ${executable} ${ags}
|
||||
for spec_path in \
|
||||
modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
|
||||
modules/openapi-generator/src/test/resources/3_0/rust/rust-test.yaml \
|
||||
modules/openapi-generator/src/test/resources/2_0/fileResponseTest.json\
|
||||
; do
|
||||
spec=$(basename "$spec_path" | sed 's/.yaml//' | sed 's/.json//' )
|
||||
|
||||
for library in hyper reqwest; do
|
||||
args="generate --template-dir modules/openapi-generator/src/main/resources/rust
|
||||
--input-spec $spec_path
|
||||
--generator-name rust
|
||||
--output samples/client/petstore/rust/$library/$spec
|
||||
--additional-properties packageName=${spec}-${library}
|
||||
--library=$library $@"
|
||||
java ${JAVA_OPTS} -jar ${executable} ${args} || exit 1
|
||||
done
|
||||
done
|
||||
|
||||
@@ -5,4 +5,5 @@
|
||||
./bin/typescript-fetch-petstore-interfaces.sh
|
||||
./bin/typescript-fetch-petstore.sh
|
||||
./bin/typescript-fetch-petstore-multiple-parameters.sh
|
||||
./bin/typescript-fetch-petstore-namespace-parameter-interfaces.sh
|
||||
./bin/typescript-fetch-petstore-prefix-parameter-interfaces.sh
|
||||
./bin/typescript-fetch-petstore-typescript-three-plus.sh
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
"npmVersion": "1.0.0",
|
||||
"npmRepository" : "https://skimdb.npmjs.com/registry",
|
||||
"snapshot" : false,
|
||||
"namespaceParameterInterfaces": true
|
||||
"prefixParameterInterfaces": true
|
||||
}
|
||||
@@ -27,8 +27,8 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -c bin/typescript-fetch-petstore-namespace-parameter-interfaces.json -o samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces $@"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -c bin/typescript-fetch-petstore-prefix-parameter-interfaces.json -o samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
cp CI/samples.ci/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml
|
||||
cp CI/samples.ci/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml
|
||||
7
bin/typescript-fetch-petstore-typescript-three-plus.json
Normal file
7
bin/typescript-fetch-petstore-typescript-three-plus.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"npmName": "@openapitools/typescript-fetch-petstore",
|
||||
"npmVersion": "1.0.0",
|
||||
"npmRepository" : "https://skimdb.npmjs.com/registry",
|
||||
"snapshot" : false,
|
||||
"typescriptThreePlus": true
|
||||
}
|
||||
32
bin/typescript-fetch-petstore-typescript-three-plus.sh
Executable file
32
bin/typescript-fetch-petstore-typescript-three-plus.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -c bin/typescript-fetch-petstore-typescript-three-plus.json -o samples/client/petstore/typescript-fetch/builds/typescript-three-plus $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -21,6 +21,7 @@ declare -a scripts=(
|
||||
"./bin/openapi3/jaxrs-jersey-petstore.sh"
|
||||
"./bin/spring-all-petstore.sh"
|
||||
"./bin/javascript-petstore-all.sh"
|
||||
"./bin/kotlin-client-petstore-multiplatform.sh"
|
||||
"./bin/kotlin-client-petstore.sh"
|
||||
"./bin/kotlin-client-string.sh"
|
||||
"./bin/kotlin-client-threetenbp.sh"
|
||||
@@ -28,6 +29,7 @@ declare -a scripts=(
|
||||
"./bin/kotlin-springboot-petstore-server.sh"
|
||||
"./bin/kotlin-springboot-petstore-server-reactive.sh"
|
||||
"./bin/mysql-schema-petstore.sh"
|
||||
"./bin/nim-client-petstore.sh"
|
||||
"./bin/python-petstore-all.sh"
|
||||
"./bin/openapi3/python-petstore.sh"
|
||||
"./bin/php-petstore.sh"
|
||||
@@ -52,6 +54,8 @@ declare -a scripts=(
|
||||
"./bin/csharp-petstore.sh"
|
||||
"./bin/csharp-netcore-petstore-all.sh"
|
||||
"./bin/elixir-petstore.sh"
|
||||
"./bin/openapi3/go-petstore.sh"
|
||||
"./bin/go-experimental-petstore.sh"
|
||||
"./bin/go-petstore.sh"
|
||||
"./bin/go-petstore-withxml.sh"
|
||||
"./bin/go-gin-petstore-server.sh"
|
||||
@@ -59,9 +63,9 @@ declare -a scripts=(
|
||||
"./bin/apex-petstore.sh"
|
||||
"./bin/perl-petstore-all.sh"
|
||||
"./bin/dart-jaguar-petstore.sh"
|
||||
"./bin/dart-flutter-petstore.sh"
|
||||
"./bin/dart-petstore.sh"
|
||||
"./bin/dart2-petstore.sh"
|
||||
"./bin/java-play-framework-petstore-server-all.sh"
|
||||
#"./bin/elm-petstore-all.sh"
|
||||
"./bin/meta-codegen.sh"
|
||||
# OTHERS
|
||||
|
||||
10
bin/windows/asciidoc-documentation-petstore.bat
Normal file
10
bin/windows/asciidoc-documentation-petstore.bat
Normal file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate --artifact-id "asciidoc-petstore-documentation" -t modules\openapi-generator\src\main\resources\asciidoc-documentation --additional-properties=specDir=modules\openapi-generator\src\main\resources\asciidoc-documentation,snippetDir=. -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g asciidoc -o samples\documentation\asciidoc
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
10
bin/windows/fsharp-functions-server-petstore.bat
Normal file
10
bin/windows/fsharp-functions-server-petstore.bat
Normal file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate --artifact-id "fsharp-functions-petstore-server" -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g fsharp-functions -o samples\server\petstore\fsharp-functions
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
10
bin/windows/kotlin-client-petstore-multiplatform.bat
Normal file
10
bin/windows/kotlin-client-petstore-multiplatform.bat
Normal file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate --artifact-id "kotlin-client-petstore-multiplatform" -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g kotlin --library multiplatform -o samples\client\petstore\kotlin-multiplatform
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
10
bin/windows/kotlin-vertx-server-petstore.bat
Normal file
10
bin/windows/kotlin-vertx-server-petstore.bat
Normal file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate --artifact-id "kotlin-vertx-petstore-server" -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g kotlin-vertx -o samples\server\petstore\kotlin\vertx
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
10
bin/windows/nim-client-petstore.bat
Normal file
10
bin/windows/nim-client-petstore.bat
Normal file
@@ -0,0 +1,10 @@
|
||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate --artifact-id "nim-petstore-client" -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml --additional-properties packageName=petstore -g nim -o samples\client\petstore\nim
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
10
bin/windows/protobuf-schema-petstore.bat
Executable file
10
bin/windows/protobuf-schema-petstore.bat
Executable file
@@ -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 -t modules\openapi-generator\src\main\resources\protobuf-schema -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g protobuf-schema -o samples\config\petstore\protobuf-schema
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
@@ -5,4 +5,5 @@ call bin\windows\typescript-fetch-petstore-target-es6.bat
|
||||
call bin\windows\typescript-fetch-petstore-with-npm-version.bat
|
||||
call bin\windows\typescript-fetch-petstore-interfaces.bat
|
||||
call bin\windows\typescript-fetch-petstore-multiple-parameters.bat
|
||||
call bin\windows\typescript-fetch-petstore-namespace-parameter-interfaces.bat
|
||||
call bin\windows\typescript-fetch-petstore-prefix-parameter-interfaces.bat
|
||||
call bin\windows\typescript-fetch-petstore-typescript-three-plus.bat
|
||||
@@ -7,6 +7,6 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -o samples\client\petstore\typescript-fetch\builds\namespace-parameter-interfaces --additional-properties namespaceParameterInterfaces=true
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -o samples\client\petstore\typescript-fetch\builds\prefix-parameter-interfaces --additional-properties prefixParameterInterfaces=true
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
@@ -0,0 +1,12 @@
|
||||
@ECHO OFF
|
||||
|
||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -c bin/typescript-fetch-petstore-typescript-three-plus.json -o samples\client\petstore\typescript-fetch\builds\typescript-three-plus
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
@@ -5,7 +5,7 @@ title: FAQ: General
|
||||
|
||||
## Do you have a chat room?
|
||||
|
||||
[](https://gitter.im/OpenAPITools/openapi-generator)
|
||||
[](https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM)
|
||||
|
||||
## What is the governance structure of the OpenAPI Generator project?
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ The following generators are available:
|
||||
* [jmeter](generators/jmeter)
|
||||
* [kotlin](generators/kotlin)
|
||||
* [lua](generators/lua)
|
||||
* [nim (beta)](generators/nim)
|
||||
* [objc](generators/objc)
|
||||
* [ocaml](generators/ocaml)
|
||||
* [perl](generators/perl)
|
||||
@@ -74,7 +75,8 @@ The following generators are available:
|
||||
* [cpp-restbed-server](generators/cpp-restbed-server)
|
||||
* [csharp-nancyfx](generators/csharp-nancyfx)
|
||||
* [erlang-server](generators/erlang-server)
|
||||
* [fsharp-giraffe-server](generators/fsharp-giraffe-server)
|
||||
* [fsharp-functions (beta)](generators/fsharp-functions)
|
||||
* [fsharp-giraffe-server (beta)](generators/fsharp-giraffe-server)
|
||||
* [go-gin-server](generators/go-gin-server)
|
||||
* [go-server](generators/go-server)
|
||||
* [graphql-nodejs-express-server](generators/graphql-nodejs-express-server)
|
||||
@@ -94,6 +96,7 @@ The following generators are available:
|
||||
* [jaxrs-spec](generators/jaxrs-spec)
|
||||
* [kotlin-server](generators/kotlin-server)
|
||||
* [kotlin-spring](generators/kotlin-spring)
|
||||
* [kotlin-vertx (beta)](generators/kotlin-vertx)
|
||||
* [nodejs-express-server (beta)](generators/nodejs-express-server)
|
||||
* [nodejs-server-deprecated (deprecated)](generators/nodejs-server-deprecated)
|
||||
* [php-laravel](generators/php-laravel)
|
||||
@@ -116,6 +119,7 @@ The following generators are available:
|
||||
|
||||
|
||||
## DOCUMENTATION generators
|
||||
* [asciidoc](generators/asciidoc)
|
||||
* [cwiki](generators/cwiki)
|
||||
* [dynamic-html](generators/dynamic-html)
|
||||
* [html](generators/html)
|
||||
@@ -132,6 +136,7 @@ The following generators are available:
|
||||
## CONFIG generators
|
||||
* [apache2](generators/apache2)
|
||||
* [graphql-schema](generators/graphql-schema)
|
||||
* [protobuf-schema (beta)](generators/protobuf-schema)
|
||||
|
||||
|
||||
|
||||
|
||||
25
docs/generators/asciidoc.md
Normal file
25
docs/generators/asciidoc.md
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
---
|
||||
id: generator-opts-documentation-asciidoc
|
||||
title: Config Options for asciidoc
|
||||
sidebar_label: asciidoc
|
||||
---
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|appName|short name of the application| |null|
|
||||
|appDescription|description of the application| |null|
|
||||
|infoUrl|a URL where users can get more information about the application| |null|
|
||||
|infoEmail|an email address to contact for inquiries about the application| |null|
|
||||
|licenseInfo|a short description of the license| |null|
|
||||
|licenseUrl|a URL pointing to the full license| |null|
|
||||
|invokerPackage|root package for generated code| |null|
|
||||
|groupId|groupId in generated pom.xml| |null|
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |null|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |null|
|
||||
|snippetDir|path with includable markup snippets (e.g. test output generated by restdoc, default: .| |.|
|
||||
|specDir|path with includable markup spec files (e.g. handwritten additional docs, default: .| |..|
|
||||
@@ -9,3 +9,4 @@ sidebar_label: cpp-pistache-server
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|addExternalLibs|Add the Possibility to fetch and compile external Libraries needed by this Framework.| |true|
|
||||
|helpersPackage|Specify the package name to be used for the helpers (e.g. org.openapitools.server.helpers).| |org.openapitools.server.helpers|
|
||||
|useStructModel|Use struct-based model template instead of get/set-based model template| |false|
|
||||
|
||||
@@ -17,6 +17,6 @@ sidebar_label: dart-jaguar
|
||||
|pubDescription|Description in generated pubspec| |null|
|
||||
|useEnumExtension|Allow the 'x-enum-values' extension for enums| |null|
|
||||
|sourceFolder|Source folder for generated code| |null|
|
||||
|supportDart2|Support Dart 2.x| |true|
|
||||
|supportDart2|Support Dart 2.x (Dart 1.x support has been deprecated)| |true|
|
||||
|nullableFields|Is the null fields should be in the JSON payload| |null|
|
||||
|serialization|Choose serialization format JSON or PROTO is supported| |null|
|
||||
|
||||
@@ -17,4 +17,4 @@ sidebar_label: dart
|
||||
|pubDescription|Description in generated pubspec| |null|
|
||||
|useEnumExtension|Allow the 'x-enum-values' extension for enums| |null|
|
||||
|sourceFolder|Source folder for generated code| |null|
|
||||
|supportDart2|Support Dart 2.x| |true|
|
||||
|supportDart2|Support Dart 2.x (Dart 1.x support has been deprecated)| |true|
|
||||
|
||||
22
docs/generators/fsharp-functions.md
Normal file
22
docs/generators/fsharp-functions.md
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
---
|
||||
id: generator-opts-server-fsharp-functions
|
||||
title: Config Options for fsharp-functions
|
||||
sidebar_label: fsharp-functions
|
||||
---
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|licenseUrl|The URL of the license| |http://localhost|
|
||||
|licenseName|The name of the license| |NoLicense|
|
||||
|packageCopyright|Specifies an AssemblyCopyright for the .NET Framework global assembly attributes stored in the AssemblyInfo file.| |No Copyright|
|
||||
|packageAuthors|Specifies Authors property in the .NET Core project file.| |OpenAPI|
|
||||
|packageTitle|Specifies an AssemblyTitle for the .NET Framework global assembly attributes stored in the AssemblyInfo file.| |OpenAPI Library|
|
||||
|packageName|F# module name (convention: Title.Case).| |OpenAPI|
|
||||
|packageVersion|F# package version.| |1.0.0|
|
||||
|packageGuid|The GUID that will be associated with the C# project| |null|
|
||||
|sourceFolder|source folder for generated code| |OpenAPI/src|
|
||||
9
docs/generators/grpc-schema.md
Normal file
9
docs/generators/grpc-schema.md
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
---
|
||||
id: generator-opts-config-grpc-schema
|
||||
title: Config Options for grpc-schema
|
||||
sidebar_label: grpc-schema
|
||||
---
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
@@ -28,6 +28,7 @@ sidebar_label: haskell-http-client
|
||||
|strictFields|Add strictness annotations to all model fields| |true|
|
||||
|useKatip|Sets the default value for the UseKatip cabal flag. If true, the katip package provides logging instead of monad-logger| |true|
|
||||
|dateTimeFormat|format string used to parse/render a datetime| |null|
|
||||
|dateTimeParseFormat|overrides the format string used to parse a datetime| |null|
|
||||
|dateFormat|format string used to parse/render a date| |%Y-%m-%d|
|
||||
|customTestInstanceModule|test module used to provide typeclass instances for types not known by the generator| |null|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|
||||
@@ -55,4 +55,5 @@ sidebar_label: java
|
||||
|feignVersion|Version of OpenFeign: '10.x', '9.x' (default)| |false|
|
||||
|useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false|
|
||||
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.8.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.8.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 9.x or 10.x. JSON processing: Jackson 2.8.x. To enable OpenFeign 10.x, set the 'feignVersion' option to '10.x'</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit**</dt><dd>HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.8.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.8.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.8.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.8.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x. Only for Java8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dl>|okhttp-gson|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 9.x or 10.x. JSON processing: Jackson 2.9.x. To enable OpenFeign 10.x, set the 'feignVersion' option to '10.x'</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit**</dt><dd>HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.9.x. Only for Java8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dl>|okhttp-gson|
|
||||
|serializationLibrary|Serialization library, default depends from the library|<dl><dt>**jackson**</dt><dd>Use Jackson as serialization library</dd><dt>**gson**</dt><dd>Use Gson as serialization library</dd><dl>|null|
|
||||
|
||||
@@ -46,7 +46,7 @@ sidebar_label: jaxrs-cxf-cdi
|
||||
|title|a title describing the application| |OpenAPI Server|
|
||||
|useBeanValidation|Use BeanValidation API annotations| |true|
|
||||
|serverPort|The port on which the server should be started| |8080|
|
||||
|library|library template (sub-template)|<dl><dt>**<default>**</dt><dd>JAXRS</dd><dl>|<default>|
|
||||
|library|library template (sub-template)|<dl><dt>**<default>**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd><dl>|<default>|
|
||||
|generatePom|Whether to generate pom.xml if the file does not already exist.| |true|
|
||||
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|
||||
|returnResponse|Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.| |false|
|
||||
|
||||
@@ -46,7 +46,7 @@ sidebar_label: jaxrs-spec
|
||||
|title|a title describing the application| |OpenAPI Server|
|
||||
|useBeanValidation|Use BeanValidation API annotations| |true|
|
||||
|serverPort|The port on which the server should be started| |8080|
|
||||
|library|library template (sub-template)|<dl><dt>**<default>**</dt><dd>JAXRS</dd><dl>|<default>|
|
||||
|library|library template (sub-template)|<dl><dt>**<default>**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd><dl>|<default>|
|
||||
|generatePom|Whether to generate pom.xml if the file does not already exist.| |true|
|
||||
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|
||||
|returnResponse|Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.| |false|
|
||||
|
||||
@@ -14,7 +14,9 @@ sidebar_label: kotlin-server
|
||||
|artifactId|Generated artifact id (name of jar).| |kotlin-server|
|
||||
|artifactVersion|Generated artifact's package version.| |1.0.0|
|
||||
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|library|library template (sub-template)|<dl><dt>**ktor**</dt><dd>ktor framework</dd><dl>|ktor|
|
||||
|featureAutoHead|Automatically provide responses to HEAD requests for existing routes that have the GET verb defined.| |true|
|
||||
|featureConditionalHeaders|Avoid sending content if client already has same content, by checking ETag or LastModified properties.| |false|
|
||||
|
||||
@@ -14,7 +14,9 @@ sidebar_label: kotlin-spring
|
||||
|artifactId|Generated artifact id (name of jar).| |openapi-spring|
|
||||
|artifactVersion|Generated artifact's package version.| |1.0.0|
|
||||
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|title|server title name or client service name| |OpenAPI Kotlin Spring|
|
||||
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|
||||
|serverPort|configuration the port in which the sever is to run on| |8080|
|
||||
|
||||
19
docs/generators/kotlin-vertx.md
Normal file
19
docs/generators/kotlin-vertx.md
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
---
|
||||
id: generator-opts-server-kotlin-vertx
|
||||
title: Config Options for kotlin-vertx
|
||||
sidebar_label: kotlin-vertx
|
||||
---
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
|packageName|Generated artifact package name.| |org.openapitools|
|
||||
|apiSuffix|suffix for api classes| |Api|
|
||||
|groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools|
|
||||
|artifactId|Generated artifact id (name of jar).| |null|
|
||||
|artifactVersion|Generated artifact's package version.| |1.0.0|
|
||||
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
@@ -14,6 +14,9 @@ sidebar_label: kotlin
|
||||
|artifactId|Generated artifact id (name of jar).| |kotlin-client|
|
||||
|artifactVersion|Generated artifact's package version.| |1.0.0|
|
||||
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**string**</dt><dd>String</dd><dt>**java8**</dt><dd>Java 8 native JSR310</dd><dt>**threetenbp**</dt><dd>Threetenbp</dd><dl>|java8|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**string**</dt><dd>String</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (jvm only)</dd><dt>**threetenbp**</dt><dd>Threetenbp (jvm only)</dd><dl>|java8|
|
||||
|collectionType|Option. Collection type to use|<dl><dt>**array**</dt><dd>kotlin.Array</dd><dt>**list**</dt><dd>kotlin.collections.List</dd><dl>|array|
|
||||
|library|Library template (sub-template) to use|<dl><dt>**jvm**</dt><dd>Platform: Java Virtual Machine. HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.8.1.</dd><dt>**multiplatform**</dt><dd>Platform: Kotlin multiplatform. HTTP client: Ktor 1.2.4. JSON processing: Kotlinx Serialization: 0.12.0.</dd><dl>|jvm|
|
||||
|
||||
13
docs/generators/nim.md
Normal file
13
docs/generators/nim.md
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
---
|
||||
id: generator-opts-client-nim
|
||||
title: Config Options for nim
|
||||
sidebar_label: nim
|
||||
---
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
9
docs/generators/protobuf-schema.md
Normal file
9
docs/generators/protobuf-schema.md
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
---
|
||||
id: generator-opts-config-protobuf-schema
|
||||
title: Config Options for protobuf-schema
|
||||
sidebar_label: protobuf-schema
|
||||
---
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
@@ -13,7 +13,6 @@ sidebar_label: swift4
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|projectName|Project name in Xcode| |null|
|
||||
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift are available.| |null|
|
||||
|unwrapRequired|Treat 'required' properties in response as non-optional (which would crash the app if api returns null as opposed to required option specified in json schema| |null|
|
||||
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
|
||||
|podSource|Source information used for Podspec| |null|
|
||||
|podVersion|Version used for Podspec| |null|
|
||||
|
||||
@@ -20,7 +20,7 @@ sidebar_label: typescript-angular
|
||||
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|
||||
|taggedUnions|Use discriminators to create tagged unions instead of extending interfaces.| |false|
|
||||
|providedInRoot|Use this property to provide Injectables in root (it is only valid in angular version greater or equal to 6.0.0).| |false|
|
||||
|ngVersion|The version of Angular.| |7.0.0|
|
||||
|ngVersion|The version of Angular.| |8.0.0|
|
||||
|serviceSuffix|The suffix of the generated service.| |Service|
|
||||
|serviceFileSuffix|The suffix of the file of the generated service (service<suffix>.ts).| |.service|
|
||||
|modelSuffix|The suffix of the generated model.| |null|
|
||||
|
||||
@@ -19,4 +19,5 @@ sidebar_label: typescript-fetch
|
||||
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|
||||
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|
||||
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |true|
|
||||
|namespaceParameterInterfaces|Setting this property to true will generate parameter interface declarations within a dedicated namespace to avoid name conflicts.| |false|
|
||||
|prefixParameterInterfaces|Setting this property to true will generate parameter interface declarations prefixed with API class name to avoid name conflicts.| |false|
|
||||
|typescriptThreePlus|Setting this property to true will generate TypeScript 3.6+ compatible code.| |false|
|
||||
|
||||
@@ -54,10 +54,7 @@
|
||||
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
|
||||
</module>
|
||||
<module name="NeedBraces"/>
|
||||
<module name="LeftCurly">
|
||||
<property name="maxLineLength" value="100"/>
|
||||
</module>
|
||||
<module name="RightCurly"/>
|
||||
<module name="LeftCurly"/>
|
||||
<module name="RightCurly">
|
||||
<property name="option" value="alone"/>
|
||||
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.1.1-SNAPSHOT</version>
|
||||
<version>4.2.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -65,7 +65,7 @@ public class Generate implements Runnable {
|
||||
private String templateDir;
|
||||
|
||||
@Option(name = {"-e", "--engine"}, title = "templating engine",
|
||||
description = "templating engine: \"mustache\" (default) or \"handlebars\" (beta)")
|
||||
description = "templating engine: \"mustache\" (default) or \"handlebars\" (beta)")
|
||||
private String templatingEngine;
|
||||
|
||||
@Option(
|
||||
@@ -109,6 +109,10 @@ public class Generate implements Runnable {
|
||||
description = CodegenConstants.MODEL_PACKAGE_DESC)
|
||||
private String modelPackage;
|
||||
|
||||
@Option(name = {"--api-name-suffix"}, title = "api name suffix",
|
||||
description = CodegenConstants.API_NAME_SUFFIX_DESC)
|
||||
private String apiNameSuffix;
|
||||
|
||||
@Option(name = {"--model-name-prefix"}, title = "model name prefix",
|
||||
description = CodegenConstants.MODEL_NAME_PREFIX_DESC)
|
||||
private String modelNamePrefix;
|
||||
@@ -178,6 +182,10 @@ public class Generate implements Runnable {
|
||||
@Option(name = {"--library"}, title = "library", description = CodegenConstants.LIBRARY_DESC)
|
||||
private String library;
|
||||
|
||||
@Option(name = {"--git-host"}, title = "git host",
|
||||
description = CodegenConstants.GIT_HOST_DESC)
|
||||
private String gitHost;
|
||||
|
||||
@Option(name = {"--git-user-id"}, title = "git user id",
|
||||
description = CodegenConstants.GIT_USER_ID_DESC)
|
||||
private String gitUserId;
|
||||
@@ -315,6 +323,10 @@ public class Generate implements Runnable {
|
||||
configurator.setModelPackage(modelPackage);
|
||||
}
|
||||
|
||||
if (isNotEmpty(apiNameSuffix)) {
|
||||
configurator.setApiNameSuffix(apiNameSuffix);
|
||||
}
|
||||
|
||||
if (isNotEmpty(modelNamePrefix)) {
|
||||
configurator.setModelNamePrefix(modelNamePrefix);
|
||||
}
|
||||
@@ -343,6 +355,10 @@ public class Generate implements Runnable {
|
||||
configurator.setLibrary(library);
|
||||
}
|
||||
|
||||
if (isNotEmpty(gitHost)) {
|
||||
configurator.setGitHost(gitHost);
|
||||
}
|
||||
|
||||
if (isNotEmpty(gitUserId)) {
|
||||
configurator.setGitUserId(gitUserId);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.1.1-SNAPSHOT</version>
|
||||
<version>4.2.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.util.*;
|
||||
public final class GeneratorSettings implements Serializable {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GeneratorSettings.class);
|
||||
private static String DEFAULT_GIT_HOST = "github.com";
|
||||
private static String DEFAULT_GIT_USER_ID = "GIT_USER_ID";
|
||||
private static String DEFAULT_GIT_REPO_ID = "GIT_REPO_ID";
|
||||
private static String DEFAULT_RELEASE_NOTE = "Minor update";
|
||||
@@ -39,6 +40,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
private String modelPackage;
|
||||
private String invokerPackage;
|
||||
private String packageName;
|
||||
private String apiNameSuffix;
|
||||
private String modelNamePrefix;
|
||||
private String modelNameSuffix;
|
||||
private String groupId;
|
||||
@@ -54,6 +56,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
private ImmutableMap<String, String> reservedWordMappings;
|
||||
private ImmutableMap<String, String> serverVariables;
|
||||
|
||||
private String gitHost;
|
||||
private String gitUserId;
|
||||
private String gitRepoId;
|
||||
private String releaseNote;
|
||||
@@ -104,6 +107,21 @@ public final class GeneratorSettings implements Serializable {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a api name suffix for generated models. This name will be appended to a api name.
|
||||
* <p>
|
||||
* This option is often used to circumvent compilation issues where models match keywords.
|
||||
* <p>
|
||||
* Example:
|
||||
* <p>
|
||||
* Suffix <code>Gen</code> applied to <code>Object</code> results in a generated class named <code>ObjectGen</code>.
|
||||
*
|
||||
* @return the model name suffix
|
||||
*/
|
||||
public String getApiNameSuffix() {
|
||||
return apiNameSuffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a model name prefix for generated models. This name will be prefixed to a model name.
|
||||
* <p>
|
||||
@@ -256,6 +274,17 @@ public final class GeneratorSettings implements Serializable {
|
||||
return serverVariables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets git host. e.g. <strong>gitlab.com</strong>.
|
||||
* <p>
|
||||
* Generally used by git_push.sh in generated sources which support it.
|
||||
* This value may also be used by templates in maven style references, READMEs, or other documentation.
|
||||
*
|
||||
* @return the git host
|
||||
*/
|
||||
public String getGitHost() {
|
||||
return gitHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets git user id. e.g. <strong>openapitools</strong>.
|
||||
@@ -312,6 +341,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
modelPackage = builder.modelPackage;
|
||||
invokerPackage = builder.invokerPackage;
|
||||
packageName = builder.packageName;
|
||||
apiNameSuffix = builder.apiNameSuffix;
|
||||
modelNamePrefix = builder.modelNamePrefix;
|
||||
modelNameSuffix = builder.modelNameSuffix;
|
||||
groupId = builder.groupId;
|
||||
@@ -324,6 +354,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
languageSpecificPrimitives = ImmutableSet.copyOf(builder.languageSpecificPrimitives);
|
||||
reservedWordMappings = ImmutableMap.copyOf(builder.reservedWordMappings);
|
||||
serverVariables = ImmutableMap.copyOf(builder.serverVariables);
|
||||
gitHost = builder.gitHost;
|
||||
gitUserId = builder.gitUserId;
|
||||
gitRepoId = builder.gitRepoId;
|
||||
releaseNote = builder.releaseNote;
|
||||
@@ -352,12 +383,18 @@ public final class GeneratorSettings implements Serializable {
|
||||
if (isNotEmpty(artifactVersion)) {
|
||||
additional.put("artifactVersion", artifactVersion);
|
||||
}
|
||||
if (isNotEmpty(apiNameSuffix)) {
|
||||
additional.put("apiNameSuffix", apiNameSuffix);
|
||||
}
|
||||
if (isNotEmpty(modelNamePrefix)) {
|
||||
additional.put("modelNamePrefix", modelNamePrefix);
|
||||
}
|
||||
if (isNotEmpty(modelNameSuffix)) {
|
||||
additional.put("modelNameSuffix", modelNameSuffix);
|
||||
}
|
||||
if (isNotEmpty(gitHost)) {
|
||||
additional.put("gitHost", gitHost);
|
||||
}
|
||||
if (isNotEmpty(gitUserId)) {
|
||||
additional.put("gitUserId", gitUserId);
|
||||
}
|
||||
@@ -390,6 +427,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
}
|
||||
|
||||
private void setDefaults() {
|
||||
gitHost = DEFAULT_GIT_HOST;
|
||||
gitUserId = DEFAULT_GIT_USER_ID;
|
||||
gitRepoId = DEFAULT_GIT_REPO_ID;
|
||||
releaseNote = DEFAULT_RELEASE_NOTE;
|
||||
@@ -415,19 +453,35 @@ public final class GeneratorSettings implements Serializable {
|
||||
builder.modelPackage = copy.getModelPackage();
|
||||
builder.invokerPackage = copy.getInvokerPackage();
|
||||
builder.packageName = copy.getPackageName();
|
||||
builder.apiNameSuffix = copy.getApiNameSuffix();
|
||||
builder.modelNamePrefix = copy.getModelNamePrefix();
|
||||
builder.modelNameSuffix = copy.getModelNameSuffix();
|
||||
builder.groupId = copy.getGroupId();
|
||||
builder.artifactId = copy.getArtifactId();
|
||||
builder.artifactVersion = copy.getArtifactVersion();
|
||||
builder.library = copy.getLibrary();
|
||||
builder.instantiationTypes = new HashMap<>(copy.getInstantiationTypes());
|
||||
builder.typeMappings = new HashMap<>(copy.getTypeMappings());
|
||||
builder.additionalProperties = new HashMap<>(copy.getAdditionalProperties());
|
||||
builder.importMappings = new HashMap<>(copy.getImportMappings());
|
||||
builder.languageSpecificPrimitives = new HashSet<>(copy.getLanguageSpecificPrimitives());
|
||||
builder.reservedWordMappings = new HashMap<>(copy.getReservedWordMappings());
|
||||
builder.serverVariables = new HashMap<>(copy.getServerVariables());
|
||||
if (copy.getInstantiationTypes() != null) {
|
||||
builder.instantiationTypes.putAll(copy.getInstantiationTypes());
|
||||
}
|
||||
if (copy.getTypeMappings() != null) {
|
||||
builder.typeMappings.putAll(copy.getTypeMappings());
|
||||
}
|
||||
if (copy.getAdditionalProperties() != null) {
|
||||
builder.additionalProperties.putAll(copy.getAdditionalProperties());
|
||||
}
|
||||
if (copy.getImportMappings() != null) {
|
||||
builder.importMappings.putAll(copy.getImportMappings());
|
||||
}
|
||||
if (copy.getLanguageSpecificPrimitives() != null) {
|
||||
builder.languageSpecificPrimitives.addAll(copy.getLanguageSpecificPrimitives());
|
||||
}
|
||||
if (copy.getReservedWordMappings() != null) {
|
||||
builder.reservedWordMappings.putAll(copy.getReservedWordMappings());
|
||||
}
|
||||
if (copy.getServerVariables() != null) {
|
||||
builder.serverVariables.putAll(copy.getServerVariables());
|
||||
}
|
||||
builder.gitHost = copy.getGitHost();
|
||||
builder.gitUserId = copy.getGitUserId();
|
||||
builder.gitRepoId = copy.getGitRepoId();
|
||||
builder.releaseNote = copy.getReleaseNote();
|
||||
@@ -446,6 +500,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
private String modelPackage;
|
||||
private String invokerPackage;
|
||||
private String packageName;
|
||||
private String apiNameSuffix;
|
||||
private String modelNamePrefix;
|
||||
private String modelNameSuffix;
|
||||
private String groupId;
|
||||
@@ -459,6 +514,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
private Set<String> languageSpecificPrimitives;
|
||||
private Map<String, String> reservedWordMappings;
|
||||
private Map<String, String> serverVariables;
|
||||
private String gitHost;
|
||||
private String gitUserId;
|
||||
private String gitRepoId;
|
||||
private String releaseNote;
|
||||
@@ -476,6 +532,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
reservedWordMappings = new HashMap<>();
|
||||
serverVariables = new HashMap<>();
|
||||
|
||||
gitHost = DEFAULT_GIT_HOST;
|
||||
gitUserId = DEFAULT_GIT_USER_ID;
|
||||
gitRepoId = DEFAULT_GIT_REPO_ID;
|
||||
releaseNote = DEFAULT_RELEASE_NOTE;
|
||||
@@ -536,6 +593,17 @@ public final class GeneratorSettings implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@code apiNameSuffix} and returns a reference to this Builder so that the methods can be chained together.
|
||||
*
|
||||
* @param apiNameSuffix the {@code apiNameSuffix} to set
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withApiNameSuffix(String apiNameSuffix) {
|
||||
this.apiNameSuffix = apiNameSuffix;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@code modelNamePrefix} and returns a reference to this Builder so that the methods can be chained together.
|
||||
*
|
||||
@@ -769,6 +837,17 @@ public final class GeneratorSettings implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@code gitHost} and returns a reference to this Builder so that the methods can be chained together.
|
||||
*
|
||||
* @param gitHost the {@code gitHost} to set
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withGitHost(String gitHost) {
|
||||
this.gitHost = gitHost;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@code gitUserId} and returns a reference to this Builder so that the methods can be chained together.
|
||||
*
|
||||
@@ -834,6 +913,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
", modelPackage='" + modelPackage + '\'' +
|
||||
", invokerPackage='" + invokerPackage + '\'' +
|
||||
", packageName='" + packageName + '\'' +
|
||||
", apiNameSuffix='" + apiNameSuffix + '\'' +
|
||||
", modelNamePrefix='" + modelNamePrefix + '\'' +
|
||||
", modelNameSuffix='" + modelNameSuffix + '\'' +
|
||||
", groupId='" + groupId + '\'' +
|
||||
@@ -846,6 +926,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
", importMappings=" + importMappings +
|
||||
", languageSpecificPrimitives=" + languageSpecificPrimitives +
|
||||
", reservedWordMappings=" + reservedWordMappings +
|
||||
", gitHost='" + gitHost + '\'' +
|
||||
", gitUserId='" + gitUserId + '\'' +
|
||||
", gitRepoId='" + gitRepoId + '\'' +
|
||||
", releaseNote='" + releaseNote + '\'' +
|
||||
@@ -863,6 +944,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
Objects.equals(getModelPackage(), that.getModelPackage()) &&
|
||||
Objects.equals(getInvokerPackage(), that.getInvokerPackage()) &&
|
||||
Objects.equals(getPackageName(), that.getPackageName()) &&
|
||||
Objects.equals(getApiNameSuffix(), that.getApiNameSuffix()) &&
|
||||
Objects.equals(getModelNamePrefix(), that.getModelNamePrefix()) &&
|
||||
Objects.equals(getModelNameSuffix(), that.getModelNameSuffix()) &&
|
||||
Objects.equals(getGroupId(), that.getGroupId()) &&
|
||||
@@ -875,6 +957,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
Objects.equals(getImportMappings(), that.getImportMappings()) &&
|
||||
Objects.equals(getLanguageSpecificPrimitives(), that.getLanguageSpecificPrimitives()) &&
|
||||
Objects.equals(getReservedWordMappings(), that.getReservedWordMappings()) &&
|
||||
Objects.equals(getGitHost(), that.getGitHost()) &&
|
||||
Objects.equals(getGitUserId(), that.getGitUserId()) &&
|
||||
Objects.equals(getGitRepoId(), that.getGitRepoId()) &&
|
||||
Objects.equals(getReleaseNote(), that.getReleaseNote()) &&
|
||||
@@ -889,6 +972,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
getModelPackage(),
|
||||
getInvokerPackage(),
|
||||
getPackageName(),
|
||||
getApiNameSuffix(),
|
||||
getModelNamePrefix(),
|
||||
getModelNameSuffix(),
|
||||
getGroupId(),
|
||||
@@ -901,6 +985,7 @@ public final class GeneratorSettings implements Serializable {
|
||||
getImportMappings(),
|
||||
getLanguageSpecificPrimitives(),
|
||||
getReservedWordMappings(),
|
||||
getGitHost(),
|
||||
getGitUserId(),
|
||||
getGitRepoId(),
|
||||
getReleaseNote(),
|
||||
|
||||
@@ -33,38 +33,48 @@ import java.util.Objects;
|
||||
public class WorkflowSettings {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(WorkflowSettings.class);
|
||||
public static final String DEFAULT_OUTPUT_DIR = ".";
|
||||
public static final boolean DEFAULT_VERBOSE = false;
|
||||
public static final boolean DEFAULT_SKIP_OVERWRITE = false;
|
||||
public static final boolean DEFAULT_REMOVE_OPERATION_ID_PREFIX = false;
|
||||
public static final boolean DEFAULT_LOG_TO_STDERR = false;
|
||||
public static final boolean DEFAULT_VALIDATE_SPEC = true;
|
||||
public static final boolean DEFAULT_ENABLE_POST_PROCESS_FILE = false;
|
||||
public static final boolean DEFAULT_ENABLE_MINIMAL_UPDATE = false;
|
||||
public static final boolean DEFAULT_STRICT_SPEC_BEHAVIOR = true;
|
||||
public static final String DEFAULT_TEMPLATING_ENGINE_NAME = "mustache";
|
||||
public static final ImmutableMap<String, String> DEFAULT_SYSTEM_PROPERTIES = ImmutableMap.of();
|
||||
|
||||
private String inputSpec;
|
||||
private String outputDir;
|
||||
private boolean verbose;
|
||||
private boolean skipOverwrite;
|
||||
private boolean removeOperationIdPrefix;
|
||||
private boolean logToStderr;
|
||||
private boolean validateSpec;
|
||||
private boolean enablePostProcessFile;
|
||||
private boolean enableMinimalUpdate;
|
||||
private boolean strictSpecBehavior;
|
||||
private String outputDir = DEFAULT_OUTPUT_DIR;
|
||||
private boolean verbose = DEFAULT_VERBOSE;
|
||||
private boolean skipOverwrite = DEFAULT_SKIP_OVERWRITE;
|
||||
private boolean removeOperationIdPrefix = DEFAULT_REMOVE_OPERATION_ID_PREFIX;
|
||||
private boolean logToStderr = DEFAULT_LOG_TO_STDERR;
|
||||
private boolean validateSpec = DEFAULT_VALIDATE_SPEC;
|
||||
private boolean enablePostProcessFile = DEFAULT_ENABLE_POST_PROCESS_FILE;
|
||||
private boolean enableMinimalUpdate = DEFAULT_ENABLE_MINIMAL_UPDATE;
|
||||
private boolean strictSpecBehavior = DEFAULT_STRICT_SPEC_BEHAVIOR;
|
||||
private String templateDir;
|
||||
private String templatingEngineName;
|
||||
private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME;
|
||||
private String ignoreFileOverride;
|
||||
private ImmutableMap<String, String> systemProperties;
|
||||
private ImmutableMap<String, String> systemProperties = DEFAULT_SYSTEM_PROPERTIES;
|
||||
|
||||
private WorkflowSettings(Builder builder) {
|
||||
setDefaults();
|
||||
inputSpec = builder.inputSpec;
|
||||
outputDir = builder.outputDir;
|
||||
verbose = builder.verbose;
|
||||
skipOverwrite = builder.skipOverwrite;
|
||||
removeOperationIdPrefix = builder.removeOperationIdPrefix;
|
||||
logToStderr = builder.logToStderr;
|
||||
validateSpec = builder.validateSpec;
|
||||
enablePostProcessFile = builder.enablePostProcessFile;
|
||||
enableMinimalUpdate = builder.enableMinimalUpdate;
|
||||
strictSpecBehavior = builder.strictSpecBehavior;
|
||||
templateDir = builder.templateDir;
|
||||
templatingEngineName = builder.templatingEngineName;
|
||||
ignoreFileOverride = builder.ignoreFileOverride;
|
||||
systemProperties = ImmutableMap.copyOf(builder.systemProperties);
|
||||
this.inputSpec = builder.inputSpec;
|
||||
this.outputDir = builder.outputDir;
|
||||
this.verbose = builder.verbose;
|
||||
this.skipOverwrite = builder.skipOverwrite;
|
||||
this.removeOperationIdPrefix = builder.removeOperationIdPrefix;
|
||||
this.logToStderr = builder.logToStderr;
|
||||
this.validateSpec = builder.validateSpec;
|
||||
this.enablePostProcessFile = builder.enablePostProcessFile;
|
||||
this.enableMinimalUpdate = builder.enableMinimalUpdate;
|
||||
this.strictSpecBehavior = builder.strictSpecBehavior;
|
||||
this.templateDir = builder.templateDir;
|
||||
this.templatingEngineName = builder.templatingEngineName;
|
||||
this.ignoreFileOverride = builder.ignoreFileOverride;
|
||||
this.systemProperties = ImmutableMap.copyOf(builder.systemProperties);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,14 +82,7 @@ public class WorkflowSettings {
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public WorkflowSettings() {
|
||||
setDefaults();
|
||||
systemProperties = ImmutableMap.of();
|
||||
}
|
||||
|
||||
private void setDefaults(){
|
||||
validateSpec = true;
|
||||
strictSpecBehavior = true;
|
||||
outputDir = ".";
|
||||
}
|
||||
|
||||
public static Builder newBuilder() {
|
||||
@@ -87,7 +90,7 @@ public class WorkflowSettings {
|
||||
}
|
||||
|
||||
public static Builder newBuilder(WorkflowSettings copy) {
|
||||
Builder builder = new Builder();
|
||||
Builder builder = newBuilder();
|
||||
builder.inputSpec = copy.getInputSpec();
|
||||
builder.outputDir = copy.getOutputDir();
|
||||
builder.verbose = copy.isVerbose();
|
||||
@@ -257,24 +260,24 @@ public class WorkflowSettings {
|
||||
@SuppressWarnings("unused")
|
||||
public static final class Builder {
|
||||
private String inputSpec;
|
||||
private String outputDir;
|
||||
private boolean verbose;
|
||||
private boolean skipOverwrite;
|
||||
private boolean removeOperationIdPrefix;
|
||||
private boolean logToStderr;
|
||||
private boolean validateSpec;
|
||||
private boolean enablePostProcessFile;
|
||||
private boolean enableMinimalUpdate;
|
||||
private boolean strictSpecBehavior;
|
||||
private String outputDir = DEFAULT_OUTPUT_DIR;
|
||||
private Boolean verbose = DEFAULT_VERBOSE;
|
||||
private Boolean skipOverwrite = DEFAULT_SKIP_OVERWRITE;
|
||||
private Boolean removeOperationIdPrefix = DEFAULT_REMOVE_OPERATION_ID_PREFIX;
|
||||
private Boolean logToStderr = DEFAULT_LOG_TO_STDERR;
|
||||
private Boolean validateSpec = DEFAULT_VALIDATE_SPEC;
|
||||
private Boolean enablePostProcessFile = DEFAULT_ENABLE_POST_PROCESS_FILE;
|
||||
private Boolean enableMinimalUpdate = DEFAULT_ENABLE_MINIMAL_UPDATE;
|
||||
private Boolean strictSpecBehavior = DEFAULT_STRICT_SPEC_BEHAVIOR;
|
||||
private String templateDir;
|
||||
private String templatingEngineName;
|
||||
private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME;
|
||||
private String ignoreFileOverride;
|
||||
private Map<String, String> systemProperties;
|
||||
private Map<String, String> systemProperties = new HashMap<>();;
|
||||
|
||||
private Builder() {
|
||||
systemProperties = new HashMap<>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the {@code inputSpec} and returns a reference to this Builder so that the methods can be chained together.
|
||||
*
|
||||
@@ -282,7 +285,9 @@ public class WorkflowSettings {
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withInputSpec(String inputSpec) {
|
||||
this.inputSpec = inputSpec;
|
||||
if (inputSpec != null) {
|
||||
this.inputSpec = inputSpec;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -293,7 +298,11 @@ public class WorkflowSettings {
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withOutputDir(String outputDir) {
|
||||
this.outputDir = Paths.get(outputDir).toAbsolutePath().toString();;
|
||||
if (outputDir != null ) {
|
||||
this.outputDir = Paths.get(outputDir).toAbsolutePath().toString();
|
||||
} else {
|
||||
this.outputDir = DEFAULT_OUTPUT_DIR;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -303,8 +312,8 @@ public class WorkflowSettings {
|
||||
* @param verbose the {@code verbose} to set
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withVerbose(boolean verbose) {
|
||||
this.verbose = verbose;
|
||||
public Builder withVerbose(Boolean verbose) {
|
||||
this.verbose = verbose != null ? verbose : Boolean.valueOf(DEFAULT_VERBOSE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -314,8 +323,8 @@ public class WorkflowSettings {
|
||||
* @param skipOverwrite the {@code skipOverwrite} to set
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withSkipOverwrite(boolean skipOverwrite) {
|
||||
this.skipOverwrite = skipOverwrite;
|
||||
public Builder withSkipOverwrite(Boolean skipOverwrite) {
|
||||
this.skipOverwrite = skipOverwrite != null ? skipOverwrite : Boolean.valueOf(DEFAULT_SKIP_OVERWRITE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -325,8 +334,8 @@ public class WorkflowSettings {
|
||||
* @param removeOperationIdPrefix the {@code removeOperationIdPrefix} to set
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withRemoveOperationIdPrefix(boolean removeOperationIdPrefix) {
|
||||
this.removeOperationIdPrefix = removeOperationIdPrefix;
|
||||
public Builder withRemoveOperationIdPrefix(Boolean removeOperationIdPrefix) {
|
||||
this.removeOperationIdPrefix = removeOperationIdPrefix != null ? removeOperationIdPrefix : Boolean.valueOf(DEFAULT_REMOVE_OPERATION_ID_PREFIX);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -336,8 +345,8 @@ public class WorkflowSettings {
|
||||
* @param logToStderr the {@code logToStderr} to set
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withLogToStderr(boolean logToStderr) {
|
||||
this.logToStderr = logToStderr;
|
||||
public Builder withLogToStderr(Boolean logToStderr) {
|
||||
this.logToStderr = logToStderr != null ? logToStderr : Boolean.valueOf(DEFAULT_LOG_TO_STDERR);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -347,8 +356,8 @@ public class WorkflowSettings {
|
||||
* @param validateSpec the {@code validateSpec} to set
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withValidateSpec(boolean validateSpec) {
|
||||
this.validateSpec = validateSpec;
|
||||
public Builder withValidateSpec(Boolean validateSpec) {
|
||||
this.validateSpec = validateSpec != null ? validateSpec : Boolean.valueOf(DEFAULT_VALIDATE_SPEC);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -358,8 +367,8 @@ public class WorkflowSettings {
|
||||
* @param enablePostProcessFile the {@code enablePostProcessFile} to set
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withEnablePostProcessFile(boolean enablePostProcessFile) {
|
||||
this.enablePostProcessFile = enablePostProcessFile;
|
||||
public Builder withEnablePostProcessFile(Boolean enablePostProcessFile) {
|
||||
this.enablePostProcessFile = enablePostProcessFile != null ? enablePostProcessFile : Boolean.valueOf(DEFAULT_ENABLE_POST_PROCESS_FILE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -369,8 +378,8 @@ public class WorkflowSettings {
|
||||
* @param enableMinimalUpdate the {@code enableMinimalUpdate} to set
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withEnableMinimalUpdate(boolean enableMinimalUpdate) {
|
||||
this.enableMinimalUpdate = enableMinimalUpdate;
|
||||
public Builder withEnableMinimalUpdate(Boolean enableMinimalUpdate) {
|
||||
this.enableMinimalUpdate = enableMinimalUpdate != null ? enableMinimalUpdate : Boolean.valueOf(DEFAULT_ENABLE_MINIMAL_UPDATE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -380,8 +389,8 @@ public class WorkflowSettings {
|
||||
* @param strictSpecBehavior the {@code strictSpecBehavior} to set
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withStrictSpecBehavior(boolean strictSpecBehavior) {
|
||||
this.strictSpecBehavior = strictSpecBehavior;
|
||||
public Builder withStrictSpecBehavior(Boolean strictSpecBehavior) {
|
||||
this.strictSpecBehavior = strictSpecBehavior != null ? strictSpecBehavior : Boolean.valueOf(DEFAULT_STRICT_SPEC_BEHAVIOR);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -392,9 +401,7 @@ public class WorkflowSettings {
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withTemplateDir(String templateDir) {
|
||||
if (templateDir == null) {
|
||||
this.templateDir = null;
|
||||
} else {
|
||||
if (templateDir != null) {
|
||||
File f = new File(templateDir);
|
||||
|
||||
// check to see if the folder exists
|
||||
@@ -416,7 +423,7 @@ public class WorkflowSettings {
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withTemplatingEngineName(String templatingEngineName) {
|
||||
this.templatingEngineName = templatingEngineName;
|
||||
this.templatingEngineName = templatingEngineName != null ? templatingEngineName : DEFAULT_TEMPLATING_ENGINE_NAME;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -438,7 +445,9 @@ public class WorkflowSettings {
|
||||
* @return a reference to this Builder
|
||||
*/
|
||||
public Builder withSystemProperties(Map<String, String> systemProperties) {
|
||||
this.systemProperties = systemProperties;
|
||||
if (systemProperties != null) {
|
||||
this.systemProperties = systemProperties;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.config;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
public class WorkflowSettingsTest {
|
||||
@Test
|
||||
public void defaultValuesNotOverriddenByNulls(){
|
||||
WorkflowSettings settings = WorkflowSettings.newBuilder()
|
||||
.withOutputDir(null)
|
||||
.withVerbose(null)
|
||||
.withSkipOverwrite(null)
|
||||
.withRemoveOperationIdPrefix(null)
|
||||
.withLogToStderr(null)
|
||||
.withValidateSpec(null)
|
||||
.withEnablePostProcessFile(null)
|
||||
.withEnableMinimalUpdate(null)
|
||||
.withStrictSpecBehavior(null)
|
||||
.build();
|
||||
|
||||
assertEquals(settings.getOutputDir(), ".");
|
||||
assertFalse(settings.isVerbose());
|
||||
assertFalse(settings.isSkipOverwrite());
|
||||
assertFalse(settings.isRemoveOperationIdPrefix());
|
||||
assertFalse(settings.isLogToStderr());
|
||||
assertTrue(settings.isValidateSpec());
|
||||
assertFalse(settings.isEnablePostProcessFile());
|
||||
assertFalse(settings.isEnableMinimalUpdate());
|
||||
assertTrue(settings.isStrictSpecBehavior());
|
||||
}
|
||||
|
||||
private void assertOnChangesToDefaults(WorkflowSettings defaults) {
|
||||
WorkflowSettings settings = WorkflowSettings.newBuilder()
|
||||
.withOutputDir("output")
|
||||
.withVerbose(true)
|
||||
.withSkipOverwrite(true)
|
||||
.withRemoveOperationIdPrefix(true)
|
||||
.withLogToStderr(true)
|
||||
.withValidateSpec(false)
|
||||
.withEnablePostProcessFile(true)
|
||||
.withEnableMinimalUpdate(true)
|
||||
.withStrictSpecBehavior(false)
|
||||
.build();
|
||||
|
||||
assertNotEquals(defaults.getOutputDir(), settings.getOutputDir());
|
||||
assertEquals(settings.getOutputDir(), Paths.get("output").toAbsolutePath().toString());
|
||||
|
||||
assertNotEquals(defaults.isVerbose(), settings.isVerbose());
|
||||
assertTrue(settings.isVerbose());
|
||||
|
||||
assertNotEquals(defaults.isSkipOverwrite(), settings.isSkipOverwrite());
|
||||
assertTrue(settings.isSkipOverwrite());
|
||||
|
||||
assertNotEquals(defaults.isRemoveOperationIdPrefix(), settings.isRemoveOperationIdPrefix());
|
||||
assertTrue(settings.isRemoveOperationIdPrefix());
|
||||
|
||||
assertNotEquals(defaults.isLogToStderr(), settings.isLogToStderr());
|
||||
assertTrue(settings.isLogToStderr());
|
||||
|
||||
assertNotEquals(defaults.isValidateSpec(), settings.isValidateSpec());
|
||||
assertFalse(settings.isValidateSpec());
|
||||
|
||||
assertNotEquals(defaults.isEnablePostProcessFile(), settings.isEnablePostProcessFile());
|
||||
assertTrue(settings.isEnablePostProcessFile());
|
||||
|
||||
assertNotEquals(defaults.isEnableMinimalUpdate(), settings.isEnableMinimalUpdate());
|
||||
assertTrue(settings.isEnableMinimalUpdate());
|
||||
|
||||
assertNotEquals(defaults.isStrictSpecBehavior(), settings.isStrictSpecBehavior());
|
||||
assertFalse(settings.isStrictSpecBehavior());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultValuesCanBeChangedClassConstructor(){
|
||||
WorkflowSettings defaults = new WorkflowSettings();
|
||||
assertOnChangesToDefaults(defaults);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultValuesCanBeChangedBuilder(){
|
||||
WorkflowSettings defaults = WorkflowSettings.newBuilder().build();
|
||||
assertOnChangesToDefaults(defaults);
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ compileJava.dependsOn tasks.openApiGenerate
|
||||
[source,group]
|
||||
----
|
||||
plugins {
|
||||
id "org.openapi.generator" version "4.1.0"
|
||||
id "org.openapi.generator" version "4.1.1"
|
||||
}
|
||||
----
|
||||
|
||||
@@ -61,7 +61,7 @@ buildscript {
|
||||
// url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:4.1.0"
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:4.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,6 +202,11 @@ apply plugin: 'org.openapi.generator'
|
||||
|None
|
||||
|Reference the library template (sub-template) of a generator.
|
||||
|
||||
|gitHost
|
||||
|String
|
||||
|github.com
|
||||
|Git user ID, e.g. gitlab.com.
|
||||
|
||||
|gitUserId
|
||||
|String
|
||||
|None
|
||||
@@ -621,7 +626,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath('org.openapitools:openapi-generator-gradle-plugin:4.1.0') {
|
||||
classpath('org.openapitools:openapi-generator-gradle-plugin:4.1.1') {
|
||||
exclude group: 'com.google.guava'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=4.1.1-SNAPSHOT
|
||||
openApiGeneratorVersion=4.2.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
# BEGIN placeholders
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.1.1-SNAPSHOT</version>
|
||||
<version>4.2.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
@@ -20,6 +20,20 @@
|
||||
<gradleVersion>4.10.2</gradleVersion>
|
||||
</properties>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>Gradle Releases</id>
|
||||
<name>Gradle Releases repository</name>
|
||||
<url>https://repo.gradle.org/gradle/libs-releases-local/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
|
||||
@@ -17,5 +17,5 @@ gradle generateGoWithInvalidSpec
|
||||
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
|
||||
|
||||
```bash
|
||||
gradle -PopenApiGeneratorVersion=4.1.0 openApiValidate
|
||||
gradle -PopenApiGeneratorVersion=4.1.1 openApiValidate
|
||||
```
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=4.1.0
|
||||
openApiGeneratorVersion=4.1.1
|
||||
# /RELEASE_VERSION
|
||||
|
||||
@@ -116,6 +116,7 @@ class OpenApiGeneratorPlugin : Plugin<Project> {
|
||||
id.set(generate.id)
|
||||
version.set(generate.version)
|
||||
library.set(generate.library)
|
||||
gitHost.set(generate.gitHost)
|
||||
gitUserId.set(generate.gitUserId)
|
||||
gitRepoId.set(generate.gitRepoId)
|
||||
releaseNote.set(generate.releaseNote)
|
||||
|
||||
@@ -160,6 +160,11 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
|
||||
*/
|
||||
val library = project.objects.property<String?>()
|
||||
|
||||
/**
|
||||
* Git host, e.g. gitlab.com.
|
||||
*/
|
||||
val gitHost = project.objects.property<String?>()
|
||||
|
||||
/**
|
||||
* Git user ID, e.g. openapitools.
|
||||
*/
|
||||
|
||||
@@ -204,6 +204,12 @@ open class GenerateTask : DefaultTask() {
|
||||
@get:Internal
|
||||
val library = project.objects.property<String?>()
|
||||
|
||||
/**
|
||||
* Git host, e.g. gitlab.com.
|
||||
*/
|
||||
@get:Internal
|
||||
val gitHost = project.objects.property<String?>()
|
||||
|
||||
/**
|
||||
* Git user ID, e.g. openapitools.
|
||||
*/
|
||||
@@ -510,6 +516,10 @@ open class GenerateTask : DefaultTask() {
|
||||
configurator.setLibrary(value)
|
||||
}
|
||||
|
||||
gitHost.ifNotEmpty { value ->
|
||||
configurator.setGitHost(value)
|
||||
}
|
||||
|
||||
gitUserId.ifNotEmpty { value ->
|
||||
configurator.setGitUserId(value)
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.1.0</version>
|
||||
<version>4.1.1</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
@@ -91,6 +91,7 @@ mvn clean compile
|
||||
| `reservedWordsMappings` | `openapi.generator.maven.plugin.reservedWordsMappings` | specifies how a reserved name should be escaped to. Otherwise, the default `_<name>` is used. For example `id=identifier`. You can also have multiple occurrences of this option
|
||||
| `skipIfSpecIsUnchanged` | `codegen.skipIfSpecIsUnchanged` | Skip the execution if the source file is older than the output folder (`false` by default. Can also be set globally through the `codegen.skipIfSpecIsUnchanged` property)
|
||||
| `engine` | `openapi.generator.maven.plugin.engine` | The name of templating engine to use, "mustache" (default) or "handlebars" (beta)
|
||||
| `httpUserAgent` | `openapi.generator.maven.plugin.httpUserAgent` | Sets custom User-Agent header value
|
||||
|
||||
|
||||
### Custom Generator
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.1.1-SNAPSHOT</version>
|
||||
<version>4.1.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default</id>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
@@ -39,16 +40,46 @@
|
||||
<library>jersey2</library>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>remote</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<!-- specify the swagger yaml -->
|
||||
<inputSpec>https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml</inputSpec>
|
||||
|
||||
<!-- target to generate java client code -->
|
||||
<generatorName>java</generatorName>
|
||||
|
||||
<!-- hint: if you want to generate java server code, e.g. based on Spring Boot,
|
||||
you can use the following target: <generatorName>spring</generatorName> -->
|
||||
|
||||
<!-- pass any necessary config options -->
|
||||
<configOptions>
|
||||
<dateLibrary>joda</dateLibrary>
|
||||
</configOptions>
|
||||
|
||||
<!-- override the default library to jersey2 -->
|
||||
<library>jersey2</library>
|
||||
|
||||
<output>${project.build.directory}/generated-sources/remote-openapi</output>
|
||||
<apiPackage>remote.org.openapitools.client.api</apiPackage>
|
||||
<modelPackage>remote.org.openapitools.client.model</modelPackage>
|
||||
<invokerPackage>remote.org.openapitools.client</invokerPackage>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<proc>none</proc>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<proc>none</proc>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.1.1-SNAPSHOT</version>
|
||||
<version>4.1.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -57,11 +57,11 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<proc>none</proc>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<proc>none</proc>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.1.0</version>
|
||||
<version>4.1.1</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.1.0</version>
|
||||
<version>4.1.1</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.1.1-SNAPSHOT</version>
|
||||
<version>4.2.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
@@ -66,7 +66,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>3.5.2</version>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
|
||||
</configuration>
|
||||
|
||||
@@ -20,7 +20,18 @@ package org.openapitools.codegen.plugin;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
import static org.openapitools.codegen.config.CodegenConfiguratorUtils.*;
|
||||
|
||||
import io.swagger.v3.parser.core.models.AuthorizationValue;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -42,6 +53,7 @@ import org.openapitools.codegen.ClientOptInput;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.DefaultGenerator;
|
||||
import org.openapitools.codegen.auth.AuthParser;
|
||||
import org.openapitools.codegen.config.CodegenConfigurator;
|
||||
import org.openapitools.codegen.config.GlobalSettings;
|
||||
import org.sonatype.plexus.build.incremental.BuildContext;
|
||||
@@ -97,6 +109,12 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(name = "inputSpec", property = "openapi.generator.maven.plugin.inputSpec", required = true)
|
||||
private String inputSpec;
|
||||
|
||||
/**
|
||||
* Git host, e.g. gitlab.com.
|
||||
*/
|
||||
@Parameter(name = "gitHost", property = "openapi.generator.maven.plugin.gitHost", required = false)
|
||||
private String gitHost;
|
||||
|
||||
/**
|
||||
* Git user ID, e.g. swagger-api.
|
||||
*/
|
||||
@@ -206,6 +224,12 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(name = "ignoreFileOverride", property = "openapi.generator.maven.plugin.ignoreFileOverride", required = false)
|
||||
private String ignoreFileOverride;
|
||||
|
||||
/**
|
||||
* Sets custom User-Agent header value
|
||||
*/
|
||||
@Parameter(name = "httpUserAgent", property = "openapi.generator.maven.plugin.httpUserAgent", required = false)
|
||||
private String httpUserAgent;
|
||||
|
||||
/**
|
||||
* To remove operationId prefix (e.g. user_getName => getName)
|
||||
*/
|
||||
@@ -417,7 +441,7 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
if (inputSpecFile.exists()) {
|
||||
File storedInputSpecHashFile = getHashFile(inputSpecFile);
|
||||
if(storedInputSpecHashFile.exists()) {
|
||||
String inputSpecHash = Files.asByteSource(inputSpecFile).hash(Hashing.sha256()).toString();
|
||||
String inputSpecHash = calculateInputSpecHash(inputSpecFile);
|
||||
String storedInputSpecHash = Files.asCharSource(storedInputSpecHashFile, Charsets.UTF_8).read();
|
||||
if (inputSpecHash.equals(storedInputSpecHash)) {
|
||||
getLog().info(
|
||||
@@ -450,6 +474,10 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
configurator.setInputSpec(inputSpec);
|
||||
}
|
||||
|
||||
if (isNotEmpty(gitHost)) {
|
||||
configurator.setGitHost(gitHost);
|
||||
}
|
||||
|
||||
if (isNotEmpty(gitUserId)) {
|
||||
configurator.setGitUserId(gitUserId);
|
||||
}
|
||||
@@ -462,6 +490,10 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
configurator.setIgnoreFileOverride(ignoreFileOverride);
|
||||
}
|
||||
|
||||
if (isNotEmpty(httpUserAgent)) {
|
||||
configurator.setHttpUserAgent(httpUserAgent);
|
||||
}
|
||||
|
||||
if (skipValidateSpec != null) {
|
||||
configurator.setValidateSpec(!skipValidateSpec);
|
||||
}
|
||||
@@ -700,12 +732,7 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
|
||||
// Store a checksum of the input spec
|
||||
File storedInputSpecHashFile = getHashFile(inputSpecFile);
|
||||
ByteSource inputSpecByteSource =
|
||||
inputSpecFile.exists()
|
||||
? Files.asByteSource(inputSpecFile)
|
||||
: CharSource.wrap(ClasspathHelper.loadFileFromClasspath(inputSpecFile.toString().replaceAll("\\\\","/")))
|
||||
.asByteSource(Charsets.UTF_8);
|
||||
String inputSpecHash =inputSpecByteSource.hash(Hashing.sha256()).toString();
|
||||
String inputSpecHash = calculateInputSpecHash(inputSpecFile);
|
||||
|
||||
if (storedInputSpecHashFile.getParent() != null && !new File(storedInputSpecHashFile.getParent()).exists()) {
|
||||
File parent = new File(storedInputSpecHashFile.getParent());
|
||||
@@ -726,8 +753,75 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate openapi specification file hash. If specification is hosted on remote resource it is downloaded first
|
||||
*
|
||||
* @param inputSpecFile - Openapi specification input file to calculate it's hash.
|
||||
* Does not taken into account if input spec is hosted on remote resource
|
||||
* @return openapi specification file hash
|
||||
* @throws IOException
|
||||
*/
|
||||
private String calculateInputSpecHash(File inputSpecFile) throws IOException {
|
||||
|
||||
URL inputSpecRemoteUrl = inputSpecRemoteUrl();
|
||||
|
||||
File inputSpecTempFile = inputSpecFile;
|
||||
|
||||
if (inputSpecRemoteUrl != null) {
|
||||
inputSpecTempFile = File.createTempFile("openapi-spec", ".tmp");
|
||||
|
||||
URLConnection conn = inputSpecRemoteUrl.openConnection();
|
||||
if (isNotEmpty(auth)) {
|
||||
List<AuthorizationValue> authList = AuthParser.parse(auth);
|
||||
for (AuthorizationValue auth : authList) {
|
||||
conn.setRequestProperty(auth.getKeyName(), auth.getValue());
|
||||
}
|
||||
}
|
||||
ReadableByteChannel readableByteChannel = Channels.newChannel(conn.getInputStream());
|
||||
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(inputSpecTempFile);
|
||||
FileChannel fileChannel = fileOutputStream.getChannel();
|
||||
|
||||
fileChannel.transferFrom(readableByteChannel, 0, Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
ByteSource inputSpecByteSource =
|
||||
inputSpecTempFile.exists()
|
||||
? Files.asByteSource(inputSpecTempFile)
|
||||
: CharSource.wrap(ClasspathHelper.loadFileFromClasspath(inputSpecTempFile.toString().replaceAll("\\\\","/")))
|
||||
.asByteSource(Charsets.UTF_8);
|
||||
|
||||
return inputSpecByteSource.hash(Hashing.sha256()).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to parse inputSpec setting string into URL
|
||||
* @return A valid URL or null if inputSpec is not a valid URL
|
||||
*/
|
||||
private URL inputSpecRemoteUrl(){
|
||||
try {
|
||||
return new URI(inputSpec).toURL();
|
||||
} catch (URISyntaxException | MalformedURLException | IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get specification hash file
|
||||
* @param inputSpecFile - Openapi specification input file to calculate it's hash.
|
||||
* Does not taken into account if input spec is hosted on remote resource
|
||||
* @return a file with previously calculated hash
|
||||
*/
|
||||
private File getHashFile(File inputSpecFile) {
|
||||
return new File(output.getPath() + File.separator + ".openapi-generator" + File.separator + inputSpecFile.getName() + ".sha256");
|
||||
String name = inputSpecFile.getName();
|
||||
|
||||
URL url = inputSpecRemoteUrl();
|
||||
if (url != null) {
|
||||
String[] segments = url.getPath().split("/");
|
||||
name = Files.getNameWithoutExtension(segments[segments.length - 1]);
|
||||
}
|
||||
|
||||
return new File(output.getPath() + File.separator + ".openapi-generator" + File.separator + name + ".sha256");
|
||||
}
|
||||
|
||||
private String getCompileSourceRoot() {
|
||||
@@ -737,8 +831,7 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
final String sourceFolder =
|
||||
sourceFolderObject == null ? "src/main/java" : sourceFolderObject.toString();
|
||||
|
||||
String sourceJavaFolder = output.toString() + "/" + sourceFolder;
|
||||
return sourceJavaFolder;
|
||||
return output.toString() + "/" + sourceFolder;
|
||||
}
|
||||
|
||||
private void addCompileSourceRootIfConfigured() {
|
||||
@@ -783,4 +876,4 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.1.1-SNAPSHOT</version>
|
||||
<version>4.2.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.1.1-SNAPSHOT</version>
|
||||
<version>4.2.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
@@ -74,7 +74,7 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
@@ -300,7 +300,7 @@
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>2.23.0</version>
|
||||
<version>3.1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -222,6 +222,10 @@ public interface CodegenConfig {
|
||||
*/
|
||||
String getLibrary();
|
||||
|
||||
void setGitHost(String gitHost);
|
||||
|
||||
String getGitHost();
|
||||
|
||||
void setGitUserId(String gitUserId);
|
||||
|
||||
String getGitUserId();
|
||||
|
||||
@@ -202,12 +202,22 @@ public class CodegenConstants {
|
||||
public static final String ENUM_PROPERTY_NAMING = "enumPropertyNaming";
|
||||
public static final String ENUM_PROPERTY_NAMING_DESC = "Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'";
|
||||
|
||||
// Allow different language generators to offer an option of serialization library. Each language specific
|
||||
// Codegen constants should define a description and provide proper input validation for the value of serializationLibrary
|
||||
public static final String SERIALIZATION_LIBRARY = "serializationLibrary";
|
||||
|
||||
public static final String API_NAME_SUFFIX = "apiNameSuffix";
|
||||
public static final String API_NAME_SUFFIX_DESC = "Suffix that will be appended to all API names ('tags'). Default: Api. e.g. Pet => PetApi. Note: Only ruby, python, jaxrs generators suppport this feature at the moment.";
|
||||
|
||||
public static final String MODEL_NAME_PREFIX = "modelNamePrefix";
|
||||
public static final String MODEL_NAME_PREFIX_DESC = "Prefix that will be prepended to all model names.";
|
||||
|
||||
public static final String MODEL_NAME_SUFFIX = "modelNameSuffix";
|
||||
public static final String MODEL_NAME_SUFFIX_DESC = "Suffix that will be appended to all model names.";
|
||||
|
||||
public static final String GIT_HOST = "gitHost";
|
||||
public static final String GIT_HOST_DESC = "Git host, e.g. gitlab.com.";
|
||||
|
||||
public static final String GIT_USER_ID = "gitUserId";
|
||||
public static final String GIT_USER_ID_DESC = "Git user ID, e.g. openapitools.";
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected Map<String, String> importMapping = new HashMap<String, String>();
|
||||
protected String modelPackage = "", apiPackage = "", fileSuffix;
|
||||
protected String modelNamePrefix = "", modelNameSuffix = "";
|
||||
protected String apiNameSuffix = "Api";
|
||||
protected String testPackage = "";
|
||||
protected Map<String, String> apiTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> modelTemplateFiles = new HashMap<String, String>();
|
||||
@@ -111,7 +112,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected Boolean sortParamsByRequiredFlag = true;
|
||||
protected Boolean ensureUniqueParams = true;
|
||||
protected Boolean allowUnicodeIdentifiers = false;
|
||||
protected String gitUserId, gitRepoId, releaseNote;
|
||||
protected String gitHost, gitUserId, gitRepoId, releaseNote;
|
||||
protected String httpUserAgent;
|
||||
protected Boolean hideGenerationTimestamp = true;
|
||||
// How to encode special characters like $
|
||||
@@ -180,6 +181,10 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
.get(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS).toString()));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.API_NAME_SUFFIX)) {
|
||||
this.setApiNameSuffix((String) additionalProperties.get(CodegenConstants.API_NAME_SUFFIX));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.MODEL_NAME_PREFIX)) {
|
||||
this.setModelNamePrefix((String) additionalProperties.get(CodegenConstants.MODEL_NAME_PREFIX));
|
||||
}
|
||||
@@ -779,6 +784,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
this.modelNameSuffix = modelNameSuffix;
|
||||
}
|
||||
|
||||
public String getApiNameSuffix() {
|
||||
return apiNameSuffix;
|
||||
}
|
||||
|
||||
public void setApiNameSuffix(String apiNameSuffix) {
|
||||
this.apiNameSuffix = apiNameSuffix;
|
||||
}
|
||||
|
||||
public void setApiPackage(String apiPackage) {
|
||||
this.apiPackage = apiPackage;
|
||||
}
|
||||
@@ -1068,8 +1081,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("file", "File");
|
||||
typeMapping.put("UUID", "UUID");
|
||||
typeMapping.put("URI", "URI");
|
||||
//typeMapping.put("BigDecimal", "BigDecimal"); //TODO need the mapping?
|
||||
|
||||
typeMapping.put("BigDecimal", "BigDecimal");
|
||||
|
||||
instantiationTypes = new HashMap<String, String>();
|
||||
|
||||
@@ -1247,7 +1259,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return instantiationTypes.get("map") + "<String, " + inner + ">";
|
||||
} else if (ModelUtils.isArraySchema(schema)) {
|
||||
ArraySchema arraySchema = (ArraySchema) schema;
|
||||
String inner = getSchemaType(arraySchema.getItems());
|
||||
String inner = getSchemaType(getSchemaItems(arraySchema));
|
||||
return instantiationTypes.get("array") + "<" + inner + ">";
|
||||
} else {
|
||||
return null;
|
||||
@@ -1462,6 +1474,15 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
}
|
||||
|
||||
protected Schema<?> getSchemaItems(ArraySchema schema) {
|
||||
if (schema.getItems() != null) {
|
||||
return schema.getItems();
|
||||
} else {
|
||||
LOGGER.error("Undefined array inner type for `{}`. Default to String.", schema.getName());
|
||||
return new StringSchema().description("TODO default missing array inner type to string");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the allOf schema
|
||||
*
|
||||
@@ -1684,17 +1705,17 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the API (class) name (capitalized) ending with "Api"
|
||||
* Output the API (class) name (capitalized) ending with the specified or default suffix
|
||||
* Return DefaultApi if name is empty
|
||||
*
|
||||
* @param name the name of the Api
|
||||
* @return capitalized Api name ending with "Api"
|
||||
* @return capitalized Api name
|
||||
*/
|
||||
public String toApiName(String name) {
|
||||
if (name.length() == 0) {
|
||||
return "DefaultApi";
|
||||
}
|
||||
return camelize(name) + "Api";
|
||||
return camelize(name + "_" + apiNameSuffix);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2180,11 +2201,10 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
property.isFreeFormObject = true;
|
||||
} else if (ModelUtils.isArraySchema(p)) {
|
||||
// default to string if inner item is undefined
|
||||
Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, ((ArraySchema) p).getItems());
|
||||
if (innerSchema == null) {
|
||||
LOGGER.error("Undefined array inner type for `{}`. Default to String.", p.getName());
|
||||
innerSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to undefined type");
|
||||
((ArraySchema) p).setItems(innerSchema);
|
||||
ArraySchema arraySchema = (ArraySchema) p;
|
||||
Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, getSchemaItems(arraySchema));
|
||||
if (arraySchema.getItems() == null) {
|
||||
arraySchema.setItems(innerSchema);
|
||||
}
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getAdditionalProperties(p));
|
||||
@@ -2262,11 +2282,10 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (itemName == null) {
|
||||
itemName = property.name;
|
||||
}
|
||||
Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, ((ArraySchema) p).getItems());
|
||||
if (innerSchema == null) {
|
||||
LOGGER.error("Undefined array inner type for `{}`. Default to String.", p.getName());
|
||||
innerSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to undefined type");
|
||||
((ArraySchema) p).setItems(innerSchema);
|
||||
ArraySchema arraySchema = (ArraySchema) p;
|
||||
Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, getSchemaItems(arraySchema));
|
||||
if (arraySchema.getItems() == null) {
|
||||
arraySchema.setItems(innerSchema);
|
||||
}
|
||||
CodegenProperty cp = fromProperty(itemName, innerSchema);
|
||||
updatePropertyForArray(property, cp);
|
||||
@@ -2296,8 +2315,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// property.baseType = getSimpleRef(p.get$ref());
|
||||
//}
|
||||
// --END of revision
|
||||
property.isModel = ModelUtils.isModel(p);
|
||||
setNonArrayMapProperty(property, type);
|
||||
Schema refOrCurrent = ModelUtils.getReferencedSchema(this.openAPI, p);
|
||||
property.isModel = (ModelUtils.isComposedSchema(refOrCurrent) || ModelUtils.isObjectSchema(refOrCurrent)) && ModelUtils.isModel(refOrCurrent);
|
||||
}
|
||||
|
||||
LOGGER.debug("debugging from property return: " + property);
|
||||
@@ -2485,6 +2505,76 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return responses.get(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set op's returnBaseType, returnType, examples etc.
|
||||
*
|
||||
* @param operation endpoint Operation
|
||||
* @param schemas a map of the schemas in the openapi spec
|
||||
* @param op endpoint CodegenOperation
|
||||
* @param methodResponse the default ApiResponse for the endpoint
|
||||
*/
|
||||
protected void handleMethodResponse(Operation operation,
|
||||
Map<String, Schema> schemas,
|
||||
CodegenOperation op,
|
||||
ApiResponse methodResponse) {
|
||||
Schema responseSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getSchemaFromResponse(methodResponse));
|
||||
|
||||
if (responseSchema != null) {
|
||||
CodegenProperty cm = fromProperty("response", responseSchema);
|
||||
|
||||
if (ModelUtils.isArraySchema(responseSchema)) {
|
||||
ArraySchema as = (ArraySchema) responseSchema;
|
||||
CodegenProperty innerProperty = fromProperty("response", getSchemaItems(as));
|
||||
op.returnBaseType = innerProperty.baseType;
|
||||
} else if (ModelUtils.isMapSchema(responseSchema)) {
|
||||
CodegenProperty innerProperty = fromProperty("response", ModelUtils.getAdditionalProperties(responseSchema));
|
||||
op.returnBaseType = innerProperty.baseType;
|
||||
} else {
|
||||
if (cm.complexType != null) {
|
||||
op.returnBaseType = cm.complexType;
|
||||
} else {
|
||||
op.returnBaseType = cm.baseType;
|
||||
}
|
||||
}
|
||||
|
||||
// generate examples
|
||||
String exampleStatusCode = "200";
|
||||
for (String key : operation.getResponses().keySet()) {
|
||||
if (operation.getResponses().get(key) == methodResponse && !key.equals("default")) {
|
||||
exampleStatusCode = key;
|
||||
}
|
||||
}
|
||||
op.examples = new ExampleGenerator(schemas, this.openAPI).generateFromResponseSchema(exampleStatusCode, responseSchema, getProducesInfo(this.openAPI, operation));
|
||||
op.defaultResponse = toDefaultValue(responseSchema);
|
||||
op.returnType = cm.dataType;
|
||||
op.hasReference = schemas.containsKey(op.returnBaseType);
|
||||
|
||||
// lookup discriminator
|
||||
Schema schema = schemas.get(op.returnBaseType);
|
||||
if (schema != null) {
|
||||
CodegenModel cmod = fromModel(op.returnBaseType, schema);
|
||||
op.discriminator = cmod.discriminator;
|
||||
}
|
||||
|
||||
if (cm.isContainer) {
|
||||
op.returnContainer = cm.containerType;
|
||||
if ("map".equals(cm.containerType)) {
|
||||
op.isMapContainer = true;
|
||||
} else if ("list".equalsIgnoreCase(cm.containerType)) {
|
||||
op.isListContainer = true;
|
||||
} else if ("array".equalsIgnoreCase(cm.containerType)) {
|
||||
op.isListContainer = true;
|
||||
}
|
||||
} else {
|
||||
op.returnSimpleType = true;
|
||||
}
|
||||
if (languageSpecificPrimitives().contains(op.returnBaseType) || op.returnBaseType == null) {
|
||||
op.returnTypeIsPrimitive = true;
|
||||
}
|
||||
}
|
||||
addHeaders(methodResponse, op.responseHeaders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert OAS Operation object to Codegen Operation object
|
||||
*
|
||||
@@ -2577,62 +2667,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
op.responses.get(op.responses.size() - 1).hasMore = false;
|
||||
|
||||
if (methodResponse != null) {
|
||||
Schema responseSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getSchemaFromResponse(methodResponse));
|
||||
|
||||
if (responseSchema != null) {
|
||||
CodegenProperty cm = fromProperty("response", responseSchema);
|
||||
|
||||
if (ModelUtils.isArraySchema(responseSchema)) {
|
||||
ArraySchema as = (ArraySchema) responseSchema;
|
||||
CodegenProperty innerProperty = fromProperty("response", as.getItems());
|
||||
op.returnBaseType = innerProperty.baseType;
|
||||
} else if (ModelUtils.isMapSchema(responseSchema)) {
|
||||
CodegenProperty innerProperty = fromProperty("response", ModelUtils.getAdditionalProperties(responseSchema));
|
||||
op.returnBaseType = innerProperty.baseType;
|
||||
} else {
|
||||
if (cm.complexType != null) {
|
||||
op.returnBaseType = cm.complexType;
|
||||
} else {
|
||||
op.returnBaseType = cm.baseType;
|
||||
}
|
||||
}
|
||||
|
||||
// generate examples
|
||||
String exampleStatusCode = "200";
|
||||
for (String key : operation.getResponses().keySet()) {
|
||||
if (operation.getResponses().get(key) == methodResponse && !key.equals("default")) {
|
||||
exampleStatusCode = key;
|
||||
}
|
||||
}
|
||||
op.examples = new ExampleGenerator(schemas, this.openAPI).generateFromResponseSchema(exampleStatusCode, responseSchema, getProducesInfo(this.openAPI, operation));
|
||||
op.defaultResponse = toDefaultValue(responseSchema);
|
||||
op.returnType = cm.dataType;
|
||||
op.hasReference = schemas.containsKey(op.returnBaseType);
|
||||
|
||||
// lookup discriminator
|
||||
Schema schema = schemas.get(op.returnBaseType);
|
||||
if (schema != null) {
|
||||
CodegenModel cmod = fromModel(op.returnBaseType, schema);
|
||||
op.discriminator = cmod.discriminator;
|
||||
}
|
||||
|
||||
if (cm.isContainer) {
|
||||
op.returnContainer = cm.containerType;
|
||||
if ("map".equals(cm.containerType)) {
|
||||
op.isMapContainer = true;
|
||||
} else if ("list".equalsIgnoreCase(cm.containerType)) {
|
||||
op.isListContainer = true;
|
||||
} else if ("array".equalsIgnoreCase(cm.containerType)) {
|
||||
op.isListContainer = true;
|
||||
}
|
||||
} else {
|
||||
op.returnSimpleType = true;
|
||||
}
|
||||
if (languageSpecificPrimitives().contains(op.returnBaseType) || op.returnBaseType == null) {
|
||||
op.returnTypeIsPrimitive = true;
|
||||
}
|
||||
}
|
||||
addHeaders(methodResponse, op.responseHeaders);
|
||||
handleMethodResponse(operation, schemas, op, methodResponse);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2659,11 +2694,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
CodegenParameter bodyParam = null;
|
||||
RequestBody requestBody = operation.getRequestBody();
|
||||
if (requestBody != null) {
|
||||
if (getContentType(requestBody) != null &&
|
||||
(getContentType(requestBody).toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
|
||||
getContentType(requestBody).toLowerCase(Locale.ROOT).startsWith("multipart/form-data"))) {
|
||||
String contentType = getContentType(requestBody);
|
||||
if (contentType != null &&
|
||||
(contentType.toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
|
||||
contentType.toLowerCase(Locale.ROOT).startsWith("multipart"))) {
|
||||
// process form parameters
|
||||
formParams = fromRequestBodyToFormParameters(requestBody, imports);
|
||||
op.isMultipart = contentType.toLowerCase(Locale.ROOT).startsWith("multipart");
|
||||
for (CodegenParameter cp : formParams) {
|
||||
postProcessParameter(cp);
|
||||
}
|
||||
@@ -2852,7 +2889,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
if (ModelUtils.isArraySchema(responseSchema)) {
|
||||
ArraySchema as = (ArraySchema) responseSchema;
|
||||
CodegenProperty innerProperty = fromProperty("response", as.getItems());
|
||||
CodegenProperty innerProperty = fromProperty("response", getSchemaItems(as));
|
||||
CodegenProperty innerCp = innerProperty;
|
||||
while (innerCp != null) {
|
||||
r.baseType = innerCp.baseType;
|
||||
@@ -3060,10 +3097,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
String collectionFormat = null;
|
||||
if (ModelUtils.isArraySchema(parameterSchema)) { // for array parameter
|
||||
final ArraySchema arraySchema = (ArraySchema) parameterSchema;
|
||||
Schema inner = arraySchema.getItems();
|
||||
if (inner == null) {
|
||||
LOGGER.warn("warning! No inner type supplied for array parameter \"" + parameter.getName() + "\", using String");
|
||||
inner = new StringSchema().description("//TODO automatically added by openapi-generator due to missing iner type definition in the spec");
|
||||
Schema inner = getSchemaItems(arraySchema);
|
||||
if (arraySchema.getItems() == null) {
|
||||
arraySchema.setItems(inner);
|
||||
}
|
||||
|
||||
@@ -3503,7 +3538,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param response API response
|
||||
* @param properties list of codegen property
|
||||
*/
|
||||
private void addHeaders(ApiResponse response, List<CodegenProperty> properties) {
|
||||
protected void addHeaders(ApiResponse response, List<CodegenProperty> properties) {
|
||||
if (response.getHeaders() != null) {
|
||||
for (Map.Entry<String, Header> headerEntry : response.getHeaders().entrySet()) {
|
||||
String description = headerEntry.getValue().getDescription();
|
||||
@@ -3899,6 +3934,24 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return library;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Git host.
|
||||
*
|
||||
* @param gitHost Git host
|
||||
*/
|
||||
public void setGitHost(String gitHost) {
|
||||
this.gitHost = gitHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Git host.
|
||||
*
|
||||
* @return Git host
|
||||
*/
|
||||
public String getGitHost() {
|
||||
return gitHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Git user ID.
|
||||
*
|
||||
@@ -4290,7 +4343,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateEnumVarsWithExtensions(List<Map<String, Object>> enumVars, Map<String, Object> vendorExtensions) {
|
||||
protected void updateEnumVarsWithExtensions(List<Map<String, Object>> enumVars, Map<String, Object> vendorExtensions) {
|
||||
if (vendorExtensions != null) {
|
||||
updateEnumVarsWithExtensions(enumVars, vendorExtensions, "x-enum-varnames", "name");
|
||||
updateEnumVarsWithExtensions(enumVars, vendorExtensions, "x-enum-descriptions", "enumDescription");
|
||||
@@ -4463,8 +4516,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
for (String consume : consumesInfo) {
|
||||
if (consume != null &&
|
||||
consume.toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
|
||||
consume.toLowerCase(Locale.ROOT).startsWith("multipart/form-data")) {
|
||||
(consume.toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
|
||||
consume.toLowerCase(Locale.ROOT).startsWith("multipart"))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -4596,10 +4649,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// array of schema
|
||||
if (ModelUtils.isArraySchema(s)) {
|
||||
final ArraySchema arraySchema = (ArraySchema) s;
|
||||
Schema inner = arraySchema.getItems();
|
||||
if (inner == null) {
|
||||
LOGGER.error("No inner type supplied for array parameter `{}`. Default to type:string", s.getName());
|
||||
inner = new StringSchema().description("//TODO automatically added by openapi-generator due to missing inner type definition in the spec");
|
||||
Schema inner = getSchemaItems(arraySchema);
|
||||
if (arraySchema.getItems() == null) {
|
||||
arraySchema.setItems(inner);
|
||||
}
|
||||
|
||||
@@ -4796,10 +4847,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
setParameterNullable(codegenParameter, codegenProperty);
|
||||
} else if (ModelUtils.isArraySchema(schema)) {
|
||||
final ArraySchema arraySchema = (ArraySchema) schema;
|
||||
Schema inner = arraySchema.getItems();
|
||||
if (inner == null) {
|
||||
LOGGER.error("No inner type supplied for array parameter `{}`. Default to type:string", schema.getName());
|
||||
inner = new StringSchema().description("//TODO automatically added by openapi-generator due to undefined type");
|
||||
Schema inner = getSchemaItems(arraySchema);
|
||||
if (arraySchema.getItems() == null) {
|
||||
arraySchema.setItems(inner);
|
||||
}
|
||||
CodegenProperty codegenProperty = fromProperty("property", arraySchema);
|
||||
@@ -4907,7 +4956,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
LOGGER.warn("The following schema has undefined (null) baseType. " +
|
||||
"It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. " +
|
||||
"A correct 'consumes' for form parameters should be " +
|
||||
"'application/x-www-form-urlencoded' or 'multipart/form-data'");
|
||||
"'application/x-www-form-urlencoded' or 'multipart/?'");
|
||||
LOGGER.warn("schema: " + schema);
|
||||
LOGGER.warn("codegenModel is null. Default to UNKNOWN_BASE_TYPE");
|
||||
codegenModelName = "UNKNOWN_BASE_TYPE";
|
||||
@@ -5018,11 +5067,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected void generateJSONSpecFile(Map<String, Object> objs) {
|
||||
OpenAPI openAPI = (OpenAPI) objs.get("openAPI");
|
||||
if (openAPI != null) {
|
||||
try {
|
||||
objs.put("openapi-json", Json.pretty().writeValueAsString(openAPI).replace("\r\n", "\n"));
|
||||
} catch (JsonProcessingException e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
objs.put("openapi-json", SerializerUtils.toJsonString(openAPI));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,10 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.config.GlobalSettings;
|
||||
import org.openapitools.codegen.api.TemplatingEngineAdapter;
|
||||
import org.openapitools.codegen.ignore.CodegenIgnoreProcessor;
|
||||
import org.openapitools.codegen.languages.PythonClientExperimentalCodegen;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
import org.openapitools.codegen.serializer.SerializerUtils;
|
||||
import org.openapitools.codegen.templating.MustacheEngineAdapter;
|
||||
import org.openapitools.codegen.utils.ImplementationVersion;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
@@ -183,12 +185,12 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
}
|
||||
|
||||
if (GlobalSettings.getProperty("debugOpenAPI") != null) {
|
||||
Json.prettyPrint(openAPI);
|
||||
SerializerUtils.toJsonString(openAPI);
|
||||
} else if (GlobalSettings.getProperty("debugSwagger") != null) {
|
||||
// This exists for backward compatibility
|
||||
// We fall to this block only if debugOpenAPI is null. No need to dump this twice.
|
||||
LOGGER.info("Please use system property 'debugOpenAPI' instead of 'debugSwagger'.");
|
||||
Json.prettyPrint(openAPI);
|
||||
SerializerUtils.toJsonString(openAPI);
|
||||
}
|
||||
|
||||
config.processOpts();
|
||||
@@ -489,10 +491,11 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
|
||||
// TODO revise below as we've already performed unaliasing so that the isAlias check may be removed
|
||||
Map<String, Object> modelTemplate = (Map<String, Object>) ((List<Object>) models.get("models")).get(0);
|
||||
// Special handling of aliases only applies to Java
|
||||
if (modelTemplate != null && modelTemplate.containsKey("model")) {
|
||||
CodegenModel m = (CodegenModel) modelTemplate.get("model");
|
||||
if (m.isAlias) {
|
||||
if (m.isAlias && !(config instanceof PythonClientExperimentalCodegen)) {
|
||||
// alias to number, string, enum, etc, which should not be generated as model
|
||||
// for PythonClientExperimentalCodegen, all aliases are generated as models
|
||||
continue; // Don't create user-defined classes for aliases
|
||||
}
|
||||
}
|
||||
@@ -942,7 +945,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
* Returns the path of a template, allowing access to the template where consuming literal contents aren't desirable or possible.
|
||||
*
|
||||
* @param name the template name (e.g. model.mustache)
|
||||
*
|
||||
* @return The {@link Path} to the template
|
||||
*/
|
||||
@Override
|
||||
@@ -1062,21 +1064,21 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
if (authMethods != null && !authMethods.isEmpty()) {
|
||||
codegenOperation.authMethods = config.fromSecurity(authMethods);
|
||||
List<Map<String, Object>> scopes = new ArrayList<Map<String, Object>>();
|
||||
if (codegenOperation.authMethods != null){
|
||||
for (CodegenSecurity security : codegenOperation.authMethods){
|
||||
if (codegenOperation.authMethods != null) {
|
||||
for (CodegenSecurity security : codegenOperation.authMethods) {
|
||||
if (security != null && security.isBasicBearer != null && security.isBasicBearer &&
|
||||
securities != null){
|
||||
for (SecurityRequirement req : securities){
|
||||
securities != null) {
|
||||
for (SecurityRequirement req : securities) {
|
||||
if (req == null) continue;
|
||||
for (String key : req.keySet()){
|
||||
if (security.name != null && key.equals(security.name)){
|
||||
for (String key : req.keySet()) {
|
||||
if (security.name != null && key.equals(security.name)) {
|
||||
int count = 0;
|
||||
for (String sc : req.get(key)){
|
||||
for (String sc : req.get(key)) {
|
||||
Map<String, Object> scope = new HashMap<String, Object>();
|
||||
scope.put("scope", sc);
|
||||
scope.put("description", "");
|
||||
count++;
|
||||
if (req.get(key) != null && count < req.get(key).size()){
|
||||
if (req.get(key) != null && count < req.get(key).size()) {
|
||||
scope.put("hasMore", "true");
|
||||
} else {
|
||||
scope.put("hasMore", null);
|
||||
|
||||
@@ -91,6 +91,7 @@ public class CodegenConfigurator {
|
||||
DynamicSettings settings = mapper.readValue(new File(configFile), DynamicSettings.class);
|
||||
CodegenConfigurator configurator = new CodegenConfigurator();
|
||||
configurator.generatorSettingsBuilder = GeneratorSettings.newBuilder(settings.getGeneratorSettings());
|
||||
configurator.workflowSettingsBuilder = WorkflowSettings.newBuilder(settings.getWorkflowSettings());
|
||||
return configurator;
|
||||
} catch (IOException ex) {
|
||||
LOGGER.error("Unable to deserialize config file: " + configFile, ex);
|
||||
@@ -221,6 +222,11 @@ public class CodegenConfigurator {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CodegenConfigurator setGitHost(String gitHost) {
|
||||
generatorSettingsBuilder.withGitHost(gitHost);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CodegenConfigurator setGitUserId(String gitUserId) {
|
||||
generatorSettingsBuilder.withGitUserId(gitUserId);
|
||||
return this;
|
||||
@@ -281,6 +287,11 @@ public class CodegenConfigurator {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CodegenConfigurator setApiNameSuffix(String suffix) {
|
||||
generatorSettingsBuilder.withApiNameSuffix(suffix);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CodegenConfigurator setModelNamePrefix(String prefix) {
|
||||
generatorSettingsBuilder.withModelNamePrefix(prefix);
|
||||
return this;
|
||||
|
||||
@@ -181,6 +181,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
typeMapping.put("long", "long?");
|
||||
typeMapping.put("double", "double?");
|
||||
typeMapping.put("number", "decimal?");
|
||||
typeMapping.put("BigDecimal", "decimal?");
|
||||
typeMapping.put("DateTime", "DateTime?");
|
||||
typeMapping.put("date", "DateTime?");
|
||||
typeMapping.put("file", "System.IO.Stream");
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
abstract public class AbstractCppCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractCppCodegen.class);
|
||||
@@ -150,7 +151,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
@Override
|
||||
public String toApiName(String type) {
|
||||
return sanitizeName(modelNamePrefix + Character.toUpperCase(type.charAt(0)) + type.substring(1) + "Api");
|
||||
return sanitizeName(modelNamePrefix + super.toApiName(type));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -306,4 +307,9 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
this.additionalProperties.put("serverHost", host);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||
return postProcessModelsEnum(objs);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user