forked from loafle/openapi-generator-original
Compare commits
178 Commits
v5.3.0
...
okhttp-gso
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2b81b721e | ||
|
|
c27ddc67fe | ||
|
|
b2daa5a836 | ||
|
|
3eb0465ec4 | ||
|
|
e5d58a35a2 | ||
|
|
8ef49bbaa2 | ||
|
|
8fbd11073a | ||
|
|
eb224db540 | ||
|
|
5416e92d19 | ||
|
|
d5979d3180 | ||
|
|
fbb61658df | ||
|
|
3247903caa | ||
|
|
0236f84c11 | ||
|
|
cee5f75912 | ||
|
|
c94d2b2331 | ||
|
|
550c0781dc | ||
|
|
b755ae288a | ||
|
|
347b75a024 | ||
|
|
c941044701 | ||
|
|
b6bc20183b | ||
|
|
80786836f7 | ||
|
|
2ff6f833e2 | ||
|
|
3539b39c73 | ||
|
|
a489a2e828 | ||
|
|
7cd7f9e477 | ||
|
|
fe64d88887 | ||
|
|
192126be6b | ||
|
|
000a18d3b9 | ||
|
|
95377f68bf | ||
|
|
b970f60c0c | ||
|
|
5a62ae6628 | ||
|
|
5451b77d42 | ||
|
|
186842ea19 | ||
|
|
03b4ac736f | ||
|
|
96ee13bbb2 | ||
|
|
ecddd4cff1 | ||
|
|
85985e8bfb | ||
|
|
86e549697e | ||
|
|
1799e9cd12 | ||
|
|
8bc069778f | ||
|
|
8fc6172c6d | ||
|
|
15f45711a8 | ||
|
|
6bc7390914 | ||
|
|
3719035787 | ||
|
|
836e40f1d2 | ||
|
|
b915ad99a8 | ||
|
|
ef31941b13 | ||
|
|
bfb45f4d67 | ||
|
|
56e7f811bc | ||
|
|
a745f053bd | ||
|
|
40609ad677 | ||
|
|
acabbe0e88 | ||
|
|
a24d314006 | ||
|
|
8d8c86728a | ||
|
|
55357fccd6 | ||
|
|
b061bd2146 | ||
|
|
e7ac0eec4b | ||
|
|
6406e5c031 | ||
|
|
8702f24f05 | ||
|
|
8e2e200e18 | ||
|
|
3b5345eb57 | ||
|
|
b7e7c13673 | ||
|
|
ae911ff2c1 | ||
|
|
309b67f91e | ||
|
|
3d92df5a41 | ||
|
|
06faa289bd | ||
|
|
a620853216 | ||
|
|
8e303150ae | ||
|
|
5bd0452893 | ||
|
|
08eaafa871 | ||
|
|
1953e70661 | ||
|
|
2e47f3e84c | ||
|
|
1314e229f5 | ||
|
|
887fe07bc1 | ||
|
|
375f0a5c2d | ||
|
|
962e8c4217 | ||
|
|
d01ad0524c | ||
|
|
af0babf892 | ||
|
|
ca848871da | ||
|
|
e2ca42a614 | ||
|
|
64a478a93c | ||
|
|
faae00df91 | ||
|
|
3a12b6144f | ||
|
|
8338962deb | ||
|
|
39b8f83e6d | ||
|
|
e5159ef8d5 | ||
|
|
49e9911b3f | ||
|
|
e9f2ccde67 | ||
|
|
c13067d100 | ||
|
|
c7bd3aa294 | ||
|
|
fdea71b26e | ||
|
|
6779c33b9d | ||
|
|
c244c23053 | ||
|
|
37a4429024 | ||
|
|
606db36c77 | ||
|
|
c69bff2871 | ||
|
|
6848c229f7 | ||
|
|
637fa430d5 | ||
|
|
18d8843cf9 | ||
|
|
6702785cae | ||
|
|
eeb00e27d1 | ||
|
|
126e406193 | ||
|
|
e44c69dab1 | ||
|
|
fcb28453e3 | ||
|
|
af2ca38ab7 | ||
|
|
3c503dae2a | ||
|
|
3c26f9f2b4 | ||
|
|
c06a21e638 | ||
|
|
f596b32316 | ||
|
|
e7c3bdacc2 | ||
|
|
3bdbf0339a | ||
|
|
d91ff3a150 | ||
|
|
552a31d85c | ||
|
|
65f3845c17 | ||
|
|
f2fcff2945 | ||
|
|
70737fb1e6 | ||
|
|
30e1ba7c87 | ||
|
|
c9495dc251 | ||
|
|
b0b09b030f | ||
|
|
b0fc824d43 | ||
|
|
ee011c563e | ||
|
|
7d092e76a1 | ||
|
|
955aadc284 | ||
|
|
4d947a1c45 | ||
|
|
53d3c9fc70 | ||
|
|
0bb4f186ec | ||
|
|
3284fc2f7e | ||
|
|
bd1a6471b6 | ||
|
|
84c2b04f24 | ||
|
|
a73363fd53 | ||
|
|
369133a03e | ||
|
|
40018c333d | ||
|
|
c741b10fb7 | ||
|
|
a7242cc8d0 | ||
|
|
4ecceb13ea | ||
|
|
b3ec7faa8f | ||
|
|
9d1420dc94 | ||
|
|
edb88d9193 | ||
|
|
359e39360a | ||
|
|
c4d10d55cb | ||
|
|
68abbb34b1 | ||
|
|
b117d29729 | ||
|
|
60bc508163 | ||
|
|
57afa97166 | ||
|
|
df260acc8f | ||
|
|
0de0890546 | ||
|
|
a6ba553281 | ||
|
|
4695279a07 | ||
|
|
6cb4b1f6c4 | ||
|
|
fe90d9c426 | ||
|
|
7559b53370 | ||
|
|
666382b377 | ||
|
|
9546a5a61b | ||
|
|
68b5f866ff | ||
|
|
8551b0af49 | ||
|
|
c3740dd647 | ||
|
|
4e21b61800 | ||
|
|
912d993955 | ||
|
|
d130985f85 | ||
|
|
4cece10bae | ||
|
|
2b2838325c | ||
|
|
d75683aeae | ||
|
|
59d5851797 | ||
|
|
a33a0fd5c7 | ||
|
|
bf77570934 | ||
|
|
d1b61bdc04 | ||
|
|
1c38bfd5a0 | ||
|
|
27c82e8ed2 | ||
|
|
5e857e749d | ||
|
|
6bbafdfa30 | ||
|
|
ae39d782e0 | ||
|
|
3a667784ac | ||
|
|
8d490835b7 | ||
|
|
f1ab3edbc0 | ||
|
|
01a4569995 | ||
|
|
d1089d785c | ||
|
|
97e079fde0 | ||
|
|
378465702c |
@@ -42,24 +42,6 @@ jobs:
|
||||
command: |-
|
||||
printf '127.0.0.1 petstore.swagger.io
|
||||
' | sudo tee -a /etc/hosts
|
||||
# Dependencies
|
||||
# Install latest stable node for angular 6
|
||||
- run:
|
||||
name: Install node@stable (for angular 6)
|
||||
command: |
|
||||
set +e
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
|
||||
export NVM_DIR="/opt/circleci/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
#nvm install stable
|
||||
# install v16 instead of the latest stable version
|
||||
nvm install 16
|
||||
nvm alias default 16
|
||||
|
||||
# Each step uses the same `$BASH_ENV`, so need to modify it
|
||||
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
|
||||
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
|
||||
- run: node --version
|
||||
# - run: docker pull openapitools/openapi-petstore
|
||||
# - run: docker run -d -e OPENAPI_BASE_PATH=/v3 -e DISABLE_API_KEY=1 -e DISABLE_OAUTH=1 -p 80:8080 openapitools/openapi-petstore
|
||||
- run: docker pull swaggerapi/petstore
|
||||
|
||||
@@ -26,17 +26,17 @@ jobs:
|
||||
- name: Set up JDK ${{ matrix.java }}
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
distribution: 'temurin'
|
||||
java-version: ${{ matrix.java }}
|
||||
|
||||
- uses: actions/cache@v2.1.6
|
||||
- uses: actions/cache@v2.1.7
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
|
||||
- uses: actions/cache@v2.1.6
|
||||
- uses: actions/cache@v2.1.7
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
|
||||
10
.github/workflows/gradle-test.yaml
vendored
10
.github/workflows/gradle-test.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
build:
|
||||
name: Gradle tests
|
||||
runs-on: ubuntu-latest
|
||||
container: gradle:jdk8
|
||||
container: gradle:jdk11
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
@@ -36,18 +36,18 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: 8
|
||||
distribution: 'temurin'
|
||||
java-version: 11
|
||||
# Cache Gradle Dependencies
|
||||
- name: Setup Gradle Dependencies Cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v2.1.7
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}
|
||||
|
||||
# Cache Gradle Wrapper
|
||||
- name: Setup Gradle Wrapper Cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v2.1.7
|
||||
with:
|
||||
path: ~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
|
||||
|
||||
26
.github/workflows/openapi-generator.yaml
vendored
26
.github/workflows/openapi-generator.yaml
vendored
@@ -17,11 +17,12 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 8
|
||||
distribution: 'temurin'
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
uses: actions/cache@v2.1.7
|
||||
env:
|
||||
cache-name: cache-maven-repository
|
||||
with:
|
||||
@@ -52,11 +53,12 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 8
|
||||
distribution: 'temurin'
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
uses: actions/cache@v2.1.7
|
||||
env:
|
||||
cache-name: cache-maven-repository
|
||||
with:
|
||||
@@ -86,9 +88,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 8
|
||||
distribution: 'temurin'
|
||||
- name: Download openapi-generator-cli.jar artifact
|
||||
uses: actions/download-artifact@v2.0.10
|
||||
with:
|
||||
@@ -124,9 +127,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 8
|
||||
distribution: 'temurin'
|
||||
- name: Download openapi-generator-cli.jar artifact
|
||||
uses: actions/download-artifact@v2.0.10
|
||||
with:
|
||||
@@ -158,11 +162,12 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: 'temurin'
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
uses: actions/cache@v2.1.7
|
||||
env:
|
||||
cache-name: cache-maven-repository
|
||||
with:
|
||||
@@ -190,11 +195,12 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: 'temurin'
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
uses: actions/cache@v2.1.7
|
||||
env:
|
||||
cache-name: cache-maven-repository
|
||||
with:
|
||||
|
||||
12
.github/workflows/samples-dart.yaml
vendored
12
.github/workflows/samples-dart.yaml
vendored
@@ -20,10 +20,10 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
distribution: 'temurin'
|
||||
java-version: 8
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
uses: actions/cache@v2.1.7
|
||||
env:
|
||||
cache-name: maven-repository
|
||||
with:
|
||||
@@ -32,7 +32,7 @@ jobs:
|
||||
~/.gradle
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Cache test dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
uses: actions/cache@v2.1.7
|
||||
env:
|
||||
cache-name: pub-cache
|
||||
with:
|
||||
@@ -53,10 +53,10 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
distribution: 'temurin'
|
||||
java-version: 8
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
uses: actions/cache@v2.1.7
|
||||
env:
|
||||
cache-name: maven-repository
|
||||
with:
|
||||
@@ -65,7 +65,7 @@ jobs:
|
||||
~/.gradle
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Cache test dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
uses: actions/cache@v2.1.7
|
||||
env:
|
||||
cache-name: pub-cache
|
||||
with:
|
||||
|
||||
7
.github/workflows/samples-kotlin.yaml
vendored
7
.github/workflows/samples-kotlin.yaml
vendored
@@ -30,8 +30,7 @@ jobs:
|
||||
#- samples/client/petstore/kotlin-json-request-string
|
||||
- samples/client/petstore/kotlin-jvm-okhttp4-coroutines
|
||||
- samples/client/petstore/kotlin-moshi-codegen
|
||||
# need some special setup
|
||||
#- samples/client/petstore/kotlin-multiplatform
|
||||
- samples/client/petstore/kotlin-multiplatform
|
||||
- samples/client/petstore/kotlin-nonpublic
|
||||
- samples/client/petstore/kotlin-nullable
|
||||
- samples/client/petstore/kotlin-okhttp3
|
||||
@@ -45,10 +44,10 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
distribution: 'temurin'
|
||||
java-version: 8
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
uses: actions/cache@v2.1.7
|
||||
env:
|
||||
cache-name: maven-repository
|
||||
with:
|
||||
|
||||
2
.github/workflows/sonar.yml
vendored
2
.github/workflows/sonar.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
distribution: 'temurin'
|
||||
java-version: 11
|
||||
- name: Compile with Maven
|
||||
run: mvn -B -q clean install jacoco:report
|
||||
|
||||
@@ -40,6 +40,13 @@ elif [ "$NODE_INDEX" = "2" ]; then
|
||||
sudo apt-get -y build-dep libcurl4-gnutls-dev
|
||||
sudo apt-get -y install libcurl4-gnutls-dev
|
||||
|
||||
# Install golang version 1.14
|
||||
go version
|
||||
sudo mkdir /usr/local/go1.14
|
||||
wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14
|
||||
export PATH="/usr/local/go1.14/go/bin:$PATH"
|
||||
go version
|
||||
|
||||
# run integration tests
|
||||
mvn --no-snapshot-updates --quiet verify -Psamples.misc -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
elif [ "$NODE_INDEX" = "3" ]; then
|
||||
@@ -55,6 +62,21 @@ elif [ "$NODE_INDEX" = "3" ]; then
|
||||
pyenv global 3.6.3
|
||||
python3 --version
|
||||
|
||||
# Install node@stable (for angular 6)
|
||||
set +e
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
|
||||
export NVM_DIR="/opt/circleci/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
#nvm install stable
|
||||
# install v16 instead of the latest stable version
|
||||
nvm install 16
|
||||
nvm alias default 16
|
||||
node --version
|
||||
|
||||
# Each step uses the same `$BASH_ENV`, so need to modify it
|
||||
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
|
||||
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
|
||||
|
||||
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.node3 -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
|
||||
else
|
||||
@@ -62,13 +84,6 @@ else
|
||||
#sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
|
||||
java -version
|
||||
|
||||
# Install golang version 1.14
|
||||
go version
|
||||
sudo mkdir /usr/local/go1.14
|
||||
wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14
|
||||
export PATH="/usr/local/go1.14/go/bin:$PATH"
|
||||
go version
|
||||
|
||||
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.others -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
fi
|
||||
|
||||
57
README.md
57
README.md
@@ -9,7 +9,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.3.0`):
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.3.1`):
|
||||
[](https://travis-ci.com/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
|
||||
@@ -17,6 +17,13 @@
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
[](https://github.com/OpenAPITools/openapi-generator/actions?query=workflow%3A%22Check+Supported+Java+Versions%22)
|
||||
|
||||
[5.4.x](https://github.com/OpenAPITools/openapi-generator/tree/5.4.x) (`5.4.x`):
|
||||
[](https://travis-ci.com/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
|
||||
[](https://cloud.drone.io/OpenAPITools/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
|
||||
[6.0.x](https://github.com/OpenAPITools/openapi-generator/tree/6.0.x) (`6.0.x`):
|
||||
[](https://travis-ci.com/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
@@ -69,7 +76,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
|
||||
| | Languages/Frameworks |
|
||||
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0, .NET 5.0. Libraries: RestSharp, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient, Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 11.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) |
|
||||
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) |
|
||||
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** (Akka, [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**, **Markdown**, **PlantUML** |
|
||||
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
|
||||
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer**, **WSDL** |
|
||||
@@ -110,9 +117,10 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
|
||||
| OpenAPI Generator Version | Release Date | Notes |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
|
||||
| 6.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/6.0.0-SNAPSHOT/) | Nov/Dec 2021 | Minor release with breaking changes (no fallback) |
|
||||
| 5.3.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.3.0-SNAPSHOT/) | Sep/Oct 2021 | Minor release with breaking changes (with fallback) |
|
||||
| [5.2.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.2.1) (latest stable release) | 016.08.2021 | Patch release (enhancements, bug fixes, etc) |
|
||||
| 6.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/6.0.0-SNAPSHOT/) | Jan/Feb 2022 | Minor release with breaking changes (no fallback) |
|
||||
| 5.4.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.4.0-SNAPSHOT/) | Dec 2021 | Minor release with breaking changes (with fallback) |
|
||||
| 5.3.1 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.3.1-SNAPSHOT/) | Nov/Dec 2021 | Patch release (enhancements, bug fixes, etc) |
|
||||
| [5.3.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.3.0) (latest stable release) | 24.10.2021 | Minor release with breaking changes (with fallback) |
|
||||
| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) |
|
||||
|
||||
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
|
||||
@@ -169,16 +177,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: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.2.1/openapi-generator-cli-5.2.1.jar`
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
```sh
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.2.1/openapi-generator-cli-5.2.1.jar -O openapi-generator-cli.jar
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.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 https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.2.1/openapi-generator-cli-5.2.1.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar
|
||||
```
|
||||
|
||||
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
|
||||
@@ -215,21 +223,21 @@ Examples:
|
||||
# Execute latest released openapi-generator-cli
|
||||
openapi-generator-cli version
|
||||
|
||||
# Execute version 3.1.0 for the current invocation, regardless of the latest released version
|
||||
OPENAPI_GENERATOR_VERSION=3.1.0 openapi-generator-cli version
|
||||
# Execute version 4.1.0 for the current invocation, regardless of the latest released version
|
||||
OPENAPI_GENERATOR_VERSION=4.1.0 openapi-generator-cli version
|
||||
|
||||
# Execute version 3.1.0-SNAPSHOT for the current invocation
|
||||
OPENAPI_GENERATOR_VERSION=3.1.0-SNAPSHOT openapi-generator-cli version
|
||||
# Execute version 4.1.0-SNAPSHOT for the current invocation
|
||||
OPENAPI_GENERATOR_VERSION=4.1.0-SNAPSHOT openapi-generator-cli version
|
||||
|
||||
# Execute version 3.0.2 for every invocation in the current shell session
|
||||
export OPENAPI_GENERATOR_VERSION=3.0.2
|
||||
openapi-generator-cli version # is 3.0.2
|
||||
openapi-generator-cli version # is also 3.0.2
|
||||
# Execute version 4.0.2 for every invocation in the current shell session
|
||||
export OPENAPI_GENERATOR_VERSION=4.0.2
|
||||
openapi-generator-cli version # is 4.0.2
|
||||
openapi-generator-cli version # is also 4.0.2
|
||||
|
||||
# To "install" a specific version, set the variable in .bashrc/.bash_profile
|
||||
echo "export OPENAPI_GENERATOR_VERSION=3.0.2" >> ~/.bashrc
|
||||
echo "export OPENAPI_GENERATOR_VERSION=4.0.2" >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
openapi-generator-cli version # is always 3.0.2, unless any of the above overrides are done ad hoc
|
||||
openapi-generator-cli version # is always 4.0.2, unless any of the above overrides are done ad hoc
|
||||
```
|
||||
|
||||
### [1.4 - Build Projects](#table-of-contents)
|
||||
@@ -403,7 +411,7 @@ openapi-generator-cli version
|
||||
To use a specific version of "openapi-generator-cli"
|
||||
|
||||
```sh
|
||||
openapi-generator-cli version-manager set 5.2.1
|
||||
openapi-generator-cli version-manager set 5.3.0
|
||||
```
|
||||
|
||||
Or install it as dev-dependency:
|
||||
@@ -427,7 +435,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/3_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](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.2.1/openapi-generator-cli-5.2.1.jar)
|
||||
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.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`
|
||||
@@ -569,6 +577,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [Adaptant Solutions AG](https://www.adaptant.io/)
|
||||
- [adesso SE](https://www.adesso.de/)
|
||||
- [Agoda](https://www.agoda.com/)
|
||||
- [Airthings](https://www.airthings.com/)
|
||||
- [Allianz](https://www.allianz.com)
|
||||
- [Angular.Schule](https://angular.schule/)
|
||||
- [Aqovia](https://aqovia.com/)
|
||||
@@ -581,6 +590,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [Bithost GmbH](https://www.bithost.ch)
|
||||
- [Bosch Connected Industry](https://www.bosch-connected-industry.com)
|
||||
- [Boxever](https://www.boxever.com/)
|
||||
- [Bunker Holding Group](https://www.bunker-holding.com/)
|
||||
- [California State University, Northridge](https://www.csun.edu)
|
||||
- [CAM](https://www.cam-inc.co.jp/)
|
||||
- [Camptocamp](https://www.camptocamp.com/en)
|
||||
@@ -642,6 +652,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [Ponicode](https://ponicode.dev/)
|
||||
- [Pricefx](https://www.pricefx.com/)
|
||||
- [Prometheus/Alertmanager](https://github.com/prometheus/alertmanager)
|
||||
- [Qavar](https://www.qavar.com)
|
||||
- [QEDIT](https://qed-it.com)
|
||||
- [Qulix Systems](https://www.qulix.com)
|
||||
- [Raksul](https://corp.raksul.com)
|
||||
@@ -825,6 +836,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- 2021-05-31 - [FlutterでOpen Api Generator(Swagger)を使う](https://aakira.app/blog/2021/05/flutter-open-api/) by [AAkira](https://twitter.com/_a_akira)
|
||||
- 2021-06-22 - [Rest API Documentation and Client Generation With OpenAPI](https://dzone.com/articles/rest-api-documentation-and-client-generation-with) by [Prasanth Gullapalli](https://dzone.com/users/1011797/prasanthnath.g@gmail.com.html)
|
||||
- 2021-07-16 - [銀行事業のサーバーサイド開発について / LINE 京都開発室 エンジニア採用説明会](https://www.youtube.com/watch?v=YrrKQHxLPpQ) by 野田誠人, Robert Mitchell
|
||||
- 2021-07-19 - [OpenAPI code generation with kotlin](https://sylhare.github.io/2021/07/19/Openapi-swagger-codegen-with-kotlin.html) by [sylhare](https://github.com/sylhare)
|
||||
- 2021-07-29 - [How To Rewrite a Huge Codebase](https://dzone.com/articles/how-to-rewrite-a-huge-code-base) by [Curtis Poe](https://dzone.com/users/4565446/publiusovidius.html)
|
||||
- 2021-08-21 - [Generating Client APIs using Swagger Part 1](https://medium.com/@flowsquad/generating-client-apis-using-swagger-part-1-2d46f13f5e92) by [FlowSquad.io](https://medium.com/@flowsquad)
|
||||
- 2021-09-11 - [Invoking AWS ParallelCluster API](https://docs.aws.amazon.com/parallelcluster/latest/ug/api-reference-v3.html) at [AWS ParallelCluster API official documentation](https://docs.aws.amazon.com/parallelcluster/latest/ug/api-reference-v3.html)
|
||||
@@ -832,6 +844,8 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- 2021-10-02 - [How to Write Fewer Lines of Code with the OpenAPI Generator](https://hackernoon.com/how-to-write-fewer-lines-of-code-with-the-openapi-generator) by [Mikhail Alfa](https://hackernoon.com/u/alphamikle)
|
||||
- 2021-10-12 - [OpenAPI Generator : 4000 étoiles sur GitHub et des spaghettis](https://www.youtube.com/watch?v=9hEsNBSqTFk) by [Jérémie Bresson](https://github.com/jmini) at [Devoxx FR 2021](https://cfp.devoxx.fr/2021/speaker/jeremie_bresson)
|
||||
- 2021-10-17 - [Generate a TypeScript HTTP Client From An OpenAPI Spec In DotNET 5](https://richardwillis.info/blog/generate-a-type-script-http-client-from-an-open-api-spec-in-dot-net-5) by [Richard Willis](https://github.com/badsyntax)
|
||||
- 2021-11-06 - [スタートアップの開発で意識したこと](https://zenn.dev/woo_noo/articles/5cb09f8e2899ae782ad1) by [woo-noo](https://zenn.dev/woo_noo)
|
||||
- 2021-11-09 - [Effective Software Development using OpenAPI Generator](https://apexlabs.ai/post/effective-software-development-using-openapi-generator) by Ajil Oomme
|
||||
|
||||
## [6 - About Us](#table-of-contents)
|
||||
|
||||
@@ -940,6 +954,7 @@ Here is a list of template creators:
|
||||
* C# ASP.NET 5: @jimschubert [:heart:](https://www.patreon.com/jimschubert)
|
||||
* C# ASP.NET Core 3.0: @A-Joshi
|
||||
* C# APS.NET Core 3.1: @phatcher
|
||||
* C# Azure functions: @Abrhm7786
|
||||
* C# NancyFX: @mstefaniuk
|
||||
* C++ (Qt5 QHttpEngine): @etherealjoy
|
||||
* C++ Pistache: @sebymiano
|
||||
@@ -1048,7 +1063,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| GraphQL | @renepardon (2018/12) |
|
||||
| Groovy | |
|
||||
| Haskell | |
|
||||
| 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) @lwlee2608 (2019/10) @nmuesch (2021/01) |
|
||||
| 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) @lwlee2608 (2019/10) |
|
||||
| JMeter | @kannkyo (2021/01) |
|
||||
| Kotlin | @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) |
|
||||
| Lua | @daurnimator (2017/08) |
|
||||
|
||||
@@ -7,7 +7,7 @@ install:
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
if (!(Test-Path -Path "C:\maven" )) {
|
||||
(new-object System.Net.WebClient).DownloadFile(
|
||||
'http://www.us.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.zip',
|
||||
'https://archive.apache.org/dist/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.zip',
|
||||
'C:\maven-bin.zip'
|
||||
)
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven")
|
||||
@@ -22,15 +22,15 @@ install:
|
||||
)
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\gradle-bin.zip", "C:\gradle")
|
||||
}
|
||||
- cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;C:\gradle\gradle-5.6.4\bin;%JAVA_HOME%\bin;%PATH%
|
||||
- cmd: SET PATH=C:\maven\apache-maven-3.8.3\bin;C:\gradle\gradle-5.6.4\bin;%JAVA_HOME%\bin;%PATH%
|
||||
- cmd: SET MAVEN_OPTS=-Xmx4g
|
||||
- cmd: SET JAVA_OPTS=-Xmx4g
|
||||
- cmd: SET M2_HOME=C:\maven\apache-maven-3.2.5
|
||||
- cmd: SET M2_HOME=C:\maven\apache-maven-3.8.3
|
||||
- cmd: java -version
|
||||
- cmd: gradle -v
|
||||
- cmd: dir/w
|
||||
- git clone https://github.com/wing328/swagger-samples --depth 1
|
||||
- ps: Start-Process -FilePath 'C:\maven\apache-maven-3.2.5\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
|
||||
- ps: Start-Process -FilePath 'C:\maven\apache-maven-3.8.3\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
|
||||
- ps: Start-Sleep -s 15
|
||||
- ps: $PSVersionTable.PSVersion
|
||||
- ps: Install-Module -Name Pester -Force -Scope CurrentUser
|
||||
|
||||
@@ -2,3 +2,5 @@ generatorName: cpp-restsdk
|
||||
outputDir: samples/client/petstore/cpp-restsdk/client
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/cpp-rest-sdk-client
|
||||
additionalProperties:
|
||||
packageName: CppRestPetstoreClient
|
||||
|
||||
10
bin/configs/csharp-netcore-complex-files.yaml
Normal file
10
bin/configs/csharp-netcore-complex-files.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
generatorName: csharp-netcore
|
||||
outputDir: samples/client/others/csharp-netcore-complex-files
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
|
||||
additionalProperties:
|
||||
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
|
||||
targetFramework: netstandard2.0
|
||||
useCompareNetObjects: "true"
|
||||
globalProperties:
|
||||
skipFormModel: "false"
|
||||
@@ -5,3 +5,4 @@ inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: microprofile-rest-client
|
||||
configKey: petstore
|
||||
|
||||
9
bin/configs/java-okhttp-gson-nextgen.yaml
Normal file
9
bin/configs/java-okhttp-gson-nextgen.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/petstore/java/okhttp-gson-nextgen
|
||||
library: okhttp-gson-nextgen
|
||||
#inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature-okhttp-gson.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: petstore-okhttp-gson-nextgen
|
||||
hideGenerationTimestamp: "true"
|
||||
6
bin/configs/other/csharp-netcore-functions.yaml
Normal file
6
bin/configs/other/csharp-netcore-functions.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
generatorName: csharp-netcore-functions
|
||||
outputDir: samples/client/petstore/csharp-netcore-functions
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore-functions
|
||||
#additionalProperties:
|
||||
# packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
|
||||
12
bin/configs/swift5-frozenEnums.yaml
Normal file
12
bin/configs/swift5-frozenEnums.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
generatorName: swift5
|
||||
outputDir: samples/client/petstore/swift5/frozenEnums
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift5
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
sortParamsByRequiredFlag: false
|
||||
generateFrozenEnums: false
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
@@ -0,0 +1,11 @@
|
||||
generatorName: typescript-angular
|
||||
outputDir: samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
|
||||
additionalProperties:
|
||||
ngVersion: 13.0.1
|
||||
npmVersion: 1.0.0
|
||||
npmName: '@openapitools/typescript-angular-petstore'
|
||||
npmRepository: https://skimdb.npmjs.com/registry
|
||||
snapshot: false
|
||||
supportsES6: true
|
||||
7
bin/configs/typescript-angular-v13-provided-in-root.yaml
Normal file
7
bin/configs/typescript-angular-v13-provided-in-root.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
generatorName: typescript-angular
|
||||
outputDir: samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
|
||||
additionalProperties:
|
||||
ngVersion: 13.0.1
|
||||
supportsES6: true
|
||||
@@ -79,6 +79,7 @@ declare -a xml_files=(
|
||||
"${root}/modules/openapi-generator-online/pom.xml"
|
||||
"${root}/modules/openapi-generator/pom.xml"
|
||||
"${root}/modules/openapi-generator-gradle-plugin/gradle.properties"
|
||||
"${root}/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties"
|
||||
"${root}/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml"
|
||||
"${root}/modules/openapi-generator-maven-plugin/examples/java-client.xml"
|
||||
"${root}/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml"
|
||||
|
||||
@@ -86,6 +86,7 @@ The following generators are available:
|
||||
* [cpp-qt-qhttpengine-server](generators/cpp-qt-qhttpengine-server.md)
|
||||
* [cpp-restbed-server](generators/cpp-restbed-server.md)
|
||||
* [csharp-nancyfx](generators/csharp-nancyfx.md)
|
||||
* [csharp-netcore-functions (beta)](generators/csharp-netcore-functions.md)
|
||||
* [erlang-server](generators/erlang-server.md)
|
||||
* [fsharp-functions (beta)](generators/fsharp-functions.md)
|
||||
* [fsharp-giraffe-server (beta)](generators/fsharp-giraffe-server.md)
|
||||
|
||||
@@ -236,10 +236,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|ApiKey|✓|OAS2,OAS3
|
||||
|OpenIDConnect|✗|OAS3
|
||||
|BearerToken|✓|OAS3
|
||||
|OAuth2_Implicit|✗|OAS2,OAS3
|
||||
|OAuth2_Password|✗|OAS2,OAS3
|
||||
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|
||||
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
|
||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||
|OAuth2_Password|✓|OAS2,OAS3
|
||||
|OAuth2_ClientCredentials|✓|OAS2,OAS3
|
||||
|OAuth2_AuthorizationCode|✓|OAS2,OAS3
|
||||
|
||||
### Wire Format Feature
|
||||
| Name | Supported | Defined By |
|
||||
|
||||
@@ -12,6 +12,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|defaultInclude|The default include statement that should be placed in all headers for including things like the declspec (convention: #include "Commons.h" | ||
|
||||
|generateGMocksForApis|Generate Google Mock classes for APIs.| |null|
|
||||
|modelPackage|C++ namespace for models (convention: name.space.model).| |org.openapitools.client.model|
|
||||
|packageName|C++ package (library) name.| |CppRestOpenAPIClient|
|
||||
|packageVersion|C++ package version.| |1.0.0|
|
||||
|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
|
||||
|variableNameFirstCharacterUppercase|Make first character of variable name uppercase (eg. value -> Value)| |true|
|
||||
|
||||
@@ -58,6 +58,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<ul class="column-ul">
|
||||
<li>abstract</li>
|
||||
<li>alias</li>
|
||||
<li>annotation</li>
|
||||
<li>as</li>
|
||||
<li>as?</li>
|
||||
<li>asm</li>
|
||||
|
||||
300
docs/generators/csharp-netcore-functions.md
Normal file
300
docs/generators/csharp-netcore-functions.md
Normal file
@@ -0,0 +1,300 @@
|
||||
---
|
||||
title: Config Options for csharp-netcore-functions
|
||||
sidebar_label: csharp-netcore-functions
|
||||
---
|
||||
|
||||
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive| |false|
|
||||
|conditionalSerialization|Serialize only those properties which are initialized by user, accepted values are true or false, default value is false.| |false|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|interfacePrefix|Prefix interfaces with a community standard or widely accepted prefix.| |I|
|
||||
|library|HTTP library template (sub-template) to use|<dl><dt>**httpclient**</dt><dd>HttpClient (https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) (Experimental. May subject to breaking changes without further notice.)</dd><dt>**restsharp**</dt><dd>RestSharp (https://github.com/restsharp/RestSharp)</dd></dl>|restsharp|
|
||||
|licenseId|The identifier of the license| |null|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |PascalCase|
|
||||
|netCoreProjectFile|Use the new format (.NET Core) for .NET project files (.csproj).| |false|
|
||||
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.| |false|
|
||||
|nullableReferenceTypes|Use nullable annotations in the project. Only supported on C# 8 / ASP.NET Core 3.0 or newer.| |false|
|
||||
|optionalAssemblyInfo|Generate AssemblyInfo.cs.| |true|
|
||||
|optionalEmitDefaultValues|Set DataMember's EmitDefaultValue.| |false|
|
||||
|optionalMethodArgument|C# Optional method argument, e.g. void square(int x=10) (.net 4.0+ only).| |true|
|
||||
|optionalProjectFile|Generate {PackageName}.csproj.| |true|
|
||||
|packageGuid|The GUID that will be associated with the C# project| |null|
|
||||
|packageName|C# package name (convention: Title.Case).| |Org.OpenAPITools|
|
||||
|packageTags|Tags to identify the package| |null|
|
||||
|packageVersion|C# package version.| |1.0.0|
|
||||
|releaseNote|Release note, default to 'Minor update'.| |Minor update|
|
||||
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|sourceFolder|source folder for generated code| |src|
|
||||
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4 compatible</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5 compatible</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6 compatible</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0 compatible</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1 compatible</dd><dt>**netcoreapp2.0**</dt><dd>.NET Core 2.0 compatible</dd><dt>**netcoreapp2.1**</dt><dd>.NET Core 2.1 compatible</dd><dt>**netcoreapp3.0**</dt><dd>.NET Core 3.0 compatible</dd><dt>**netcoreapp3.1**</dt><dd>.NET Core 3.1 compatible</dd><dt>**net47**</dt><dd>.NET Framework 4.7 compatible</dd><dt>**net5.0**</dt><dd>.NET 5.0 compatible</dd></dl>|netstandard2.0|
|
||||
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
||||
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|
||||
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |false|
|
||||
|validatable|Generates self-validatable models.| |true|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|array|List|
|
||||
|list|List|
|
||||
|map|Dictionary|
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Boolean</li>
|
||||
<li>Collection</li>
|
||||
<li>DateTime</li>
|
||||
<li>DateTime?</li>
|
||||
<li>DateTimeOffset</li>
|
||||
<li>DateTimeOffset?</li>
|
||||
<li>Decimal</li>
|
||||
<li>Dictionary</li>
|
||||
<li>Double</li>
|
||||
<li>Float</li>
|
||||
<li>Guid</li>
|
||||
<li>Guid?</li>
|
||||
<li>ICollection</li>
|
||||
<li>Int32</li>
|
||||
<li>Int64</li>
|
||||
<li>List</li>
|
||||
<li>Object</li>
|
||||
<li>String</li>
|
||||
<li>System.IO.Stream</li>
|
||||
<li>bool</li>
|
||||
<li>bool?</li>
|
||||
<li>byte[]</li>
|
||||
<li>decimal</li>
|
||||
<li>decimal?</li>
|
||||
<li>double</li>
|
||||
<li>double?</li>
|
||||
<li>float</li>
|
||||
<li>float?</li>
|
||||
<li>int</li>
|
||||
<li>int?</li>
|
||||
<li>long</li>
|
||||
<li>long?</li>
|
||||
<li>string</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Client</li>
|
||||
<li>Configuration</li>
|
||||
<li>Version</li>
|
||||
<li>abstract</li>
|
||||
<li>as</li>
|
||||
<li>base</li>
|
||||
<li>bool</li>
|
||||
<li>break</li>
|
||||
<li>byte</li>
|
||||
<li>case</li>
|
||||
<li>catch</li>
|
||||
<li>char</li>
|
||||
<li>checked</li>
|
||||
<li>class</li>
|
||||
<li>client</li>
|
||||
<li>const</li>
|
||||
<li>continue</li>
|
||||
<li>decimal</li>
|
||||
<li>default</li>
|
||||
<li>delegate</li>
|
||||
<li>do</li>
|
||||
<li>double</li>
|
||||
<li>else</li>
|
||||
<li>enum</li>
|
||||
<li>event</li>
|
||||
<li>explicit</li>
|
||||
<li>extern</li>
|
||||
<li>false</li>
|
||||
<li>finally</li>
|
||||
<li>fixed</li>
|
||||
<li>float</li>
|
||||
<li>for</li>
|
||||
<li>foreach</li>
|
||||
<li>goto</li>
|
||||
<li>if</li>
|
||||
<li>implicit</li>
|
||||
<li>in</li>
|
||||
<li>int</li>
|
||||
<li>interface</li>
|
||||
<li>internal</li>
|
||||
<li>is</li>
|
||||
<li>localVarFileParams</li>
|
||||
<li>localVarFormParams</li>
|
||||
<li>localVarHeaderParams</li>
|
||||
<li>localVarHttpContentType</li>
|
||||
<li>localVarHttpContentTypes</li>
|
||||
<li>localVarHttpHeaderAccept</li>
|
||||
<li>localVarHttpHeaderAccepts</li>
|
||||
<li>localVarPath</li>
|
||||
<li>localVarPathParams</li>
|
||||
<li>localVarPostBody</li>
|
||||
<li>localVarQueryParams</li>
|
||||
<li>localVarResponse</li>
|
||||
<li>localVarStatusCode</li>
|
||||
<li>lock</li>
|
||||
<li>long</li>
|
||||
<li>namespace</li>
|
||||
<li>new</li>
|
||||
<li>null</li>
|
||||
<li>object</li>
|
||||
<li>operator</li>
|
||||
<li>out</li>
|
||||
<li>override</li>
|
||||
<li>parameter</li>
|
||||
<li>params</li>
|
||||
<li>private</li>
|
||||
<li>protected</li>
|
||||
<li>public</li>
|
||||
<li>readonly</li>
|
||||
<li>ref</li>
|
||||
<li>return</li>
|
||||
<li>sbyte</li>
|
||||
<li>sealed</li>
|
||||
<li>short</li>
|
||||
<li>sizeof</li>
|
||||
<li>stackalloc</li>
|
||||
<li>static</li>
|
||||
<li>string</li>
|
||||
<li>struct</li>
|
||||
<li>switch</li>
|
||||
<li>this</li>
|
||||
<li>throw</li>
|
||||
<li>true</li>
|
||||
<li>try</li>
|
||||
<li>typeof</li>
|
||||
<li>uint</li>
|
||||
<li>ulong</li>
|
||||
<li>unchecked</li>
|
||||
<li>unsafe</li>
|
||||
<li>ushort</li>
|
||||
<li>using</li>
|
||||
<li>virtual</li>
|
||||
<li>void</li>
|
||||
<li>volatile</li>
|
||||
<li>while</li>
|
||||
</ul>
|
||||
|
||||
## FEATURE SET
|
||||
|
||||
|
||||
### Client Modification Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasePath|✓|ToolingExtension
|
||||
|Authorizations|✗|ToolingExtension
|
||||
|UserAgent|✓|ToolingExtension
|
||||
|MockServer|✗|ToolingExtension
|
||||
|
||||
### Data Type Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Custom|✗|OAS2,OAS3
|
||||
|Int32|✓|OAS2,OAS3
|
||||
|Int64|✓|OAS2,OAS3
|
||||
|Float|✓|OAS2,OAS3
|
||||
|Double|✓|OAS2,OAS3
|
||||
|Decimal|✓|ToolingExtension
|
||||
|String|✓|OAS2,OAS3
|
||||
|Byte|✓|OAS2,OAS3
|
||||
|Binary|✓|OAS2,OAS3
|
||||
|Boolean|✓|OAS2,OAS3
|
||||
|Date|✓|OAS2,OAS3
|
||||
|DateTime|✓|OAS2,OAS3
|
||||
|Password|✓|OAS2,OAS3
|
||||
|File|✓|OAS2
|
||||
|Array|✓|OAS2,OAS3
|
||||
|Maps|✓|ToolingExtension
|
||||
|CollectionFormat|✓|OAS2
|
||||
|CollectionFormatMulti|✓|OAS2
|
||||
|Enum|✓|OAS2,OAS3
|
||||
|ArrayOfEnum|✓|ToolingExtension
|
||||
|ArrayOfModel|✓|ToolingExtension
|
||||
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|
||||
|ArrayOfCollectionOfModel|✓|ToolingExtension
|
||||
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|
||||
|MapOfEnum|✓|ToolingExtension
|
||||
|MapOfModel|✓|ToolingExtension
|
||||
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|
||||
|MapOfCollectionOfModel|✓|ToolingExtension
|
||||
|MapOfCollectionOfEnum|✓|ToolingExtension
|
||||
|
||||
### Documentation Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Readme|✓|ToolingExtension
|
||||
|Model|✓|ToolingExtension
|
||||
|Api|✓|ToolingExtension
|
||||
|
||||
### Global Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Host|✓|OAS2,OAS3
|
||||
|BasePath|✓|OAS2,OAS3
|
||||
|Info|✓|OAS2,OAS3
|
||||
|Schemes|✗|OAS2,OAS3
|
||||
|PartialSchemes|✓|OAS2,OAS3
|
||||
|Consumes|✓|OAS2
|
||||
|Produces|✓|OAS2
|
||||
|ExternalDocumentation|✓|OAS2,OAS3
|
||||
|Examples|✓|OAS2,OAS3
|
||||
|XMLStructureDefinitions|✗|OAS2,OAS3
|
||||
|MultiServer|✗|OAS3
|
||||
|ParameterizedServer|✗|OAS3
|
||||
|ParameterStyling|✗|OAS3
|
||||
|Callbacks|✗|OAS3
|
||||
|LinkObjects|✗|OAS3
|
||||
|
||||
### Parameter Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Path|✓|OAS2,OAS3
|
||||
|Query|✓|OAS2,OAS3
|
||||
|Header|✓|OAS2,OAS3
|
||||
|Body|✓|OAS2
|
||||
|FormUnencoded|✓|OAS2
|
||||
|FormMultipart|✓|OAS2
|
||||
|Cookie|✓|OAS3
|
||||
|
||||
### Schema Support Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Simple|✓|OAS2,OAS3
|
||||
|Composite|✓|OAS2,OAS3
|
||||
|Polymorphism|✓|OAS2,OAS3
|
||||
|Union|✗|OAS3
|
||||
|
||||
### Security Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasicAuth|✓|OAS2,OAS3
|
||||
|ApiKey|✓|OAS2,OAS3
|
||||
|OpenIDConnect|✗|OAS3
|
||||
|BearerToken|✗|OAS3
|
||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||
|OAuth2_Password|✗|OAS2,OAS3
|
||||
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|
||||
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
|
||||
|
||||
### Wire Format Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|JSON|✓|OAS2,OAS3
|
||||
|XML|✓|OAS2,OAS3
|
||||
|PROTOBUF|✗|ToolingExtension
|
||||
|Custom|✗|OAS2,OAS3
|
||||
@@ -31,7 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|sourceFolder|source folder for generated code| |src|
|
||||
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4 compatible</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5 compatible</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6 compatible</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0 compatible</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1 compatible</dd><dt>**netcoreapp2.0**</dt><dd>.NET Core 2.0 compatible</dd><dt>**netcoreapp2.1**</dt><dd>.NET Core 2.1 compatible</dd><dt>**netcoreapp3.0**</dt><dd>.NET Core 3.0 compatible</dd><dt>**netcoreapp3.1**</dt><dd>.NET Core 3.1 compatible</dd><dt>**net47**</dt><dd>.NET Framework 4.7 compatible</dd><dt>**net5.0**</dt><dd>.NET 5.0 compatible</dd></dl>|netstandard2.0|
|
||||
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4 compatible</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5 compatible</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6 compatible</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0 compatible</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1 compatible</dd><dt>**netcoreapp2.0**</dt><dd>.NET Core 2.0 compatible</dd><dt>**netcoreapp2.1**</dt><dd>.NET Core 2.1 compatible</dd><dt>**netcoreapp3.0**</dt><dd>.NET Core 3.0 compatible</dd><dt>**netcoreapp3.1**</dt><dd>.NET Core 3.1 compatible</dd><dt>**net47**</dt><dd>.NET Framework 4.7 compatible</dd><dt>**net5.0**</dt><dd>.NET 5.0 compatible</dd><dt>**net6.0**</dt><dd>.NET 6.0 compatible</dd></dl>|netstandard2.0|
|
||||
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
||||
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|
||||
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |false|
|
||||
|
||||
@@ -19,6 +19,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
|
||||
|configKey|Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date (if you really have a good reason not to use threetenbp</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true</dd><dt>**threetenbp**</dt><dd>Backport of JSR310 (preferred for jdk < 1.8)</dd></dl>|threetenbp|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
@@ -29,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
|
||||
|dynamicOperations|Generate operations dynamically at runtime from an OAS| |false|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|errorObjectType|Error Object type. (This option is for okhttp-gson-next-gen only)| |null|
|
||||
|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false|
|
||||
|gradleProperties|Append additional Gradle proeprties to the gradle.properties file| |null|
|
||||
|groupId|groupId in generated pom.xml| |org.openapitools|
|
||||
@@ -37,7 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|invokerPackage|root package for generated code| |org.openapitools.client|
|
||||
|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|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 gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libraries 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 10.x. JSON processing: Jackson 2.9.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>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.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.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: JSON-B</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 4.x</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 gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libraries 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 10.x. JSON processing: Jackson 2.9.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>**okhttp-gson-nextgen**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x.'. Better support for oneOf/anyOf with breaking changes. Will replace `okhttp-gson` in the 6.0.0 release.</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/3]=true'. (RxJava 1.x or 2.x or 3.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.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: JSON-B</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 4.x</dd></dl>|okhttp-gson|
|
||||
|licenseName|The name of the license| |Unlicense|
|
||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||
|microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null|
|
||||
|
||||
@@ -74,6 +74,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>ApiResponse</li>
|
||||
<li>abstract</li>
|
||||
<li>actual</li>
|
||||
<li>annotation</li>
|
||||
|
||||
@@ -76,6 +76,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>ApiResponse</li>
|
||||
<li>abstract</li>
|
||||
<li>actual</li>
|
||||
<li>annotation</li>
|
||||
|
||||
@@ -68,6 +68,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>ApiResponse</li>
|
||||
<li>abstract</li>
|
||||
<li>actual</li>
|
||||
<li>annotation</li>
|
||||
|
||||
@@ -17,6 +17,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|library|Library template (sub-template) to use|<dl><dt>**jvm-okhttp4**</dt><dd>[DEFAULT] Platform: Java Virtual Machine. HTTP client: OkHttp 4.2.0 (Android 5.0+ and Java 8+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-okhttp3**</dt><dd>Platform: Java Virtual Machine. HTTP client: OkHttp 3.12.4 (Android 2.3+ and Java 7+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-retrofit2**</dt><dd>Platform: Java Virtual Machine. HTTP client: Retrofit 2.6.2.</dd><dt>**multiplatform**</dt><dd>Platform: Kotlin multiplatform. HTTP client: Ktor 1.6.0. JSON processing: Kotlinx Serialization: 1.2.1.</dd></dl>|jvm-okhttp4|
|
||||
|modelMutable|Create mutable models| |false|
|
||||
|moshiCodeGen|Whether to enable codegen with the Moshi library. Refer to the [official Moshi doc](https://github.com/square/moshi#codegen) for more info.| |false|
|
||||
|omitGradlePluginVersions|Whether to declare Gradle plugin versions in build files.| |false|
|
||||
|packageName|Generated artifact package name.| |org.openapitools.client|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|requestDateConverter|JVM-Option. Defines in how to handle date-time objects that are used for a request (as query or parameter)|<dl><dt>**toJson**</dt><dd>[DEFAULT] Date formatter option using a json converter.</dd><dt>**toString**</dt><dd>Use the 'toString'-method of the date-time object to retrieve the related string representation.</dd></dl>|toJson|
|
||||
@@ -78,6 +79,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>ApiResponse</li>
|
||||
<li>abstract</li>
|
||||
<li>actual</li>
|
||||
<li>annotation</li>
|
||||
|
||||
@@ -7,6 +7,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|numberedFieldNumberList|Field numbers in order.| |false|
|
||||
|startEnumsWithUnknown|Introduces "UNKNOWN" as the first element of enumerations.| |false|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|gemAuthor|gem author (only one is supported).| |null|
|
||||
|gemAuthor|gem author (only one is supported).| |OpenAPI-Generator|
|
||||
|gemAuthorEmail|gem author email (only one is supported).| |null|
|
||||
|gemDescription|gem description. | |This gem maps to a REST API|
|
||||
|gemHomepage|gem homepage. | |http://org.openapitools|
|
||||
|gemHomepage|gem homepage. | |https://openapi-generator.tech|
|
||||
|gemLicense|gem license. | |unlicense|
|
||||
|gemName|gem name (convention: underscore_case).| |openapi_client|
|
||||
|gemRequiredRubyVersion|gem required Ruby version. | |>= 1.9|
|
||||
|gemRequiredRubyVersion|gem required Ruby version. | |>= 2.4|
|
||||
|gemSummary|gem summary. | |A ruby wrapper for the REST APIs|
|
||||
|gemVersion|gem version.| |1.0.0|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|
||||
@@ -13,7 +13,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId| |openapi-scala-akka-http-server|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|asManagedSources|Resulting files cab be used as managed resources. No build files or default controllers will be generated| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|groupId|groupId in generated pom.xml| |org.openapitools|
|
||||
|
||||
@@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|
||||
@@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|
||||
@@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|
||||
@@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|
||||
@@ -10,7 +10,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|circeVersion|The version of circe library| |0.13.0|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|jodaTimeVersion|The version of joda-time library| |2.10.10|
|
||||
|
||||
@@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|
||||
@@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|
||||
@@ -45,6 +45,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|licenseName|The name of the license| |Unlicense|
|
||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||
|modelPackage|package for generated models| |org.openapitools.model|
|
||||
|oas3|Use OAS 3 Swagger annotations instead of OAS 2 annotations| |false|
|
||||
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|
||||
@@ -69,6 +70,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
|
||||
|useBeanValidation|Use BeanValidation API annotations| |true|
|
||||
|useOptional|Use Optional container for optional parameters| |false|
|
||||
|useSpringController|Annotate the generated API as a Spring Controller| |false|
|
||||
|useTags|use tags for creating interface and controller classnames| |false|
|
||||
|virtualService|Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki| |false|
|
||||
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|
||||
|
||||
@@ -11,6 +11,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|apiNamePrefix|Prefix that will be appended to all API names ('tags'). Default: empty string. e.g. Pet => Pet.| |null|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|generateFrozenEnums|Generate frozen enums (default: true)| |true|
|
||||
|generateModelAdditionalProperties|Generate model additional properties (default: true)| |true|
|
||||
|hashableModels|Make hashable models (default: true)| |true|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|
||||
@@ -19,7 +19,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|modelFileSuffix|The suffix of the file of the generated model (model<suffix>.ts).| |null|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|
||||
|modelSuffix|The suffix of the generated model.| |null|
|
||||
|ngVersion|The version of Angular. (At least 6.0.0)| |12.0.0|
|
||||
|ngVersion|The version of Angular. (At least 6.0.0)| |13.0.1|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|
||||
@@ -22,7 +22,7 @@ npm install @openapitools/openapi-generator-cli -g
|
||||
To install a specific version of the tool, pass the version during installation:
|
||||
<!-- RELEASE_VERSION -->
|
||||
```bash
|
||||
openapi-generator-cli version-manager set 5.1.0
|
||||
openapi-generator-cli version-manager set 5.3.0
|
||||
```
|
||||
<!-- /RELEASE_VERSION -->
|
||||
To install the tool as a dev dependency in your current project:
|
||||
@@ -80,18 +80,18 @@ docker run --rm \
|
||||
<!-- 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: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar`
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
|
||||
```bash
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar -O openapi-generator-cli.jar
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.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.
|
||||
|
||||
```powershell
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar
|
||||
```
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -86,7 +86,7 @@ public class ConfigHelp extends OpenApiGeneratorCommand {
|
||||
"--markdown-header"}, title = "markdown header", description = "When format=markdown, include this option to write out markdown headers (e.g. for docusaurus).")
|
||||
private Boolean markdownHeader;
|
||||
|
||||
@Option(name = {"--full-details"}, title = "full generator details", description = "displays CLI options as well as other configs/mappings (implies --instantiation-types, --reserved-words, --language-specific-primitives, --import-mappings, --supporting-files)")
|
||||
@Option(name = {"--full-details"}, title = "full generator details", description = "displays CLI options as well as other configs/mappings (implies --instantiation-types, --reserved-words, --language-specific-primitives, --import-mappings, --feature-set)")
|
||||
private Boolean fullDetails;
|
||||
|
||||
private String newline = System.lineSeparator();
|
||||
|
||||
@@ -22,7 +22,9 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.mockito.MockSettings;
|
||||
import org.openapitools.codegen.DefaultGenerator;
|
||||
import org.openapitools.codegen.Generator;
|
||||
import org.openapitools.codegen.SpecValidationException;
|
||||
import org.openapitools.codegen.config.CodegenConfigurator;
|
||||
import org.testng.TestException;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
@@ -430,4 +432,12 @@ public class GenerateTest {
|
||||
verify(configurator).toContext();
|
||||
verifyNoMoreInteractions(configurator);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test ensures that when the
|
||||
*/
|
||||
@Test(expectedExceptions = SpecValidationException.class)
|
||||
public void testNPEWithInvalidSpecFile() {
|
||||
setupAndRunTest("-i", "src/test/resources/npe-test.yaml", "-g", "java", "-o", "src/main/java", false, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
test:
|
||||
get:
|
||||
responses:
|
||||
'200':
|
||||
description: test
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
prop1:
|
||||
type: array
|
||||
prop2:
|
||||
type: date
|
||||
@@ -0,0 +1,8 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
description: test
|
||||
version: test
|
||||
title: test
|
||||
paths:
|
||||
/test:
|
||||
$ref: 'npe-test-spec-file.yaml#/test'
|
||||
@@ -6,7 +6,7 @@
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -97,7 +97,7 @@ task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.Valid
|
||||
[source,group]
|
||||
----
|
||||
plugins {
|
||||
id "org.openapi.generator" version "5.1.1"
|
||||
id "org.openapi.generator" version "5.3.0"
|
||||
}
|
||||
----
|
||||
|
||||
@@ -113,7 +113,7 @@ buildscript {
|
||||
// url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:5.1.1"
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:5.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,7 +690,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath('org.openapitools:openapi-generator-gradle-plugin:4.2.3') {
|
||||
classpath('org.openapitools:openapi-generator-gradle-plugin:5.3.0') {
|
||||
exclude group: 'com.google.guava'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=5.3.0
|
||||
openApiGeneratorVersion=5.3.1-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
# BEGIN placeholders
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -18,5 +18,5 @@ gradle generateGoWithInvalidSpec # expected outcome: BUILD FAILED
|
||||
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
|
||||
|
||||
```bash
|
||||
gradle -PopenApiGeneratorVersion=5.1.0 openApiValidate
|
||||
gradle -PopenApiGeneratorVersion=5.3.0 openApiValidate
|
||||
```
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=5.3.0-SNAPSHOT
|
||||
openApiGeneratorVersion=5.3.1-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
@@ -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>5.1.0</version>
|
||||
<version>5.3.0</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
@@ -93,13 +93,17 @@
|
||||
<!-- dependencies are needed for the client being generated -->
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-annotations-version}</version>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-annotations-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- You can find the dependencies for the library configuration you chose by looking in JavaClientCodegen.
|
||||
Then find the corresponding dependency on Maven Central, and set the versions in the property section below -->
|
||||
<!-- @Nullable annotation -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HTTP client: jersey-client -->
|
||||
<dependency>
|
||||
@@ -107,6 +111,11 @@
|
||||
<artifactId>jersey-client</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.inject</groupId>
|
||||
<artifactId>jersey-hk2</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-multipart</artifactId>
|
||||
@@ -118,77 +127,76 @@
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- @Nullable annotation -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON processing: jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-base</artifactId>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-databind-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>jackson-databind-nullable</artifactId>
|
||||
<version>${jackson-databind-nullable-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>jackson-databind-nullable</artifactId>
|
||||
<version>${jackson-databind-nullable-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Joda time: if you use it -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>${jodatime-version}</version>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.scribejava</groupId>
|
||||
<artifactId>scribejava-apis</artifactId>
|
||||
<version>${scribejava-apis-version}</version>
|
||||
</dependency>
|
||||
<!-- Base64 encoding that works in both JVM and Android -->
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>${jakarta-annotation-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.connectors</groupId>
|
||||
<artifactId>jersey-apache-connector</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.brsanthu</groupId>
|
||||
<artifactId>migbase64</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<swagger-annotations-version>1.5.8</swagger-annotations-version>
|
||||
<jersey-version>2.27</jersey-version>
|
||||
<jackson-version>2.9.10</jackson-version>
|
||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
||||
<jodatime-version>2.7</jodatime-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
<scribejava-apis-version>6.9.0</scribejava-apis-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<swagger-annotations-version>1.6.3</swagger-annotations-version>
|
||||
<jersey-version>2.35</jersey-version>
|
||||
<jackson-version>2.13.0</jackson-version>
|
||||
<jackson-databind-version>2.13.0</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<junit-version>4.13.2</junit-version>
|
||||
<scribejava-apis-version>8.3.1</scribejava-apis-version>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
<properties>
|
||||
<swagger-annotations-version>1.5.8</swagger-annotations-version>
|
||||
<jersey-version>2.27</jersey-version>
|
||||
<jackson-version>2.9.10</jackson-version>
|
||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
||||
<jersey-version>2.35</jersey-version>
|
||||
<jackson-version>2.13.0</jackson-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<jodatime-version>2.7</jodatime-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class CodegenComposedSchemas {
|
||||
private List<CodegenProperty> allOf;
|
||||
private List<CodegenProperty> oneOf;
|
||||
private List<CodegenProperty> anyOf;
|
||||
|
||||
public CodegenComposedSchemas(List<CodegenProperty> allOf, List<CodegenProperty> oneOf, List<CodegenProperty> anyOf) {
|
||||
this.allOf = allOf;
|
||||
this.oneOf = oneOf;
|
||||
this.anyOf = anyOf;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getAllOf() {
|
||||
return allOf;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getOneOf() {
|
||||
return oneOf;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getAnyOf() {
|
||||
return anyOf;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("CodegenComposedSchemas{");
|
||||
sb.append("oneOf=").append(oneOf);
|
||||
sb.append(", anyOf=").append(anyOf);
|
||||
sb.append(", allOf=").append(allOf);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
CodegenComposedSchemas that = (CodegenComposedSchemas) o;
|
||||
return Objects.equals(oneOf, that.oneOf) &&
|
||||
Objects.equals(anyOf, that.anyOf) &&
|
||||
Objects.equals(allOf, that.allOf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(oneOf, anyOf, allOf);
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class CodegenConfigLoader {
|
||||
try {
|
||||
return (CodegenConfig) Class.forName(name).getDeclaredConstructor().newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new GeneratorNotFoundException("Can't load config class with name '".concat(name) + "'\nAvailable:\n" + availableConfigs.toString(), e);
|
||||
throw new GeneratorNotFoundException("Can't load config class with name '".concat(name) + "'\nAvailable:\n" + availableConfigs, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CodegenEncoding {
|
||||
private String contentType;
|
||||
private List<CodegenParameter> headers;
|
||||
private String style;
|
||||
private boolean explode;
|
||||
private boolean allowReserved;
|
||||
|
||||
public CodegenEncoding(String contentType, List<CodegenParameter> headers, String style, boolean explode, boolean allowReserved) {
|
||||
this.contentType = contentType;
|
||||
this.headers = headers;
|
||||
this.style = style;
|
||||
this.explode = explode;
|
||||
this.allowReserved = allowReserved;
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
|
||||
public List<CodegenParameter> getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
public String getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public boolean getExplode() {
|
||||
return explode;
|
||||
}
|
||||
|
||||
public boolean getAllowReserved() {
|
||||
return allowReserved;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("CodegenEncoding{");
|
||||
sb.append("contentType=").append(contentType);
|
||||
sb.append(", headers=").append(headers);
|
||||
sb.append(", style=").append(style);
|
||||
sb.append(", explode=").append(explode);
|
||||
sb.append(", allowReserved=").append(allowReserved);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
CodegenEncoding that = (CodegenEncoding) o;
|
||||
return contentType == that.getContentType() &&
|
||||
Objects.equals(headers, that.getHeaders()) &&
|
||||
style == that.getStyle() &&
|
||||
explode == that.getExplode() &&
|
||||
allowReserved == that.getAllowReserved();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(contentType, headers, style, explode, allowReserved);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.openapitools.codegen;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CodegenMediaType {
|
||||
private CodegenProperty schema;
|
||||
private LinkedHashMap<String, CodegenEncoding> encoding;
|
||||
|
||||
public CodegenMediaType(CodegenProperty schema, LinkedHashMap<String, CodegenEncoding> encoding) {
|
||||
this.schema = schema;
|
||||
this.encoding = encoding;
|
||||
}
|
||||
|
||||
public CodegenProperty getSchema() {
|
||||
return schema;
|
||||
}
|
||||
|
||||
public LinkedHashMap<String, CodegenEncoding> getEncoding() {
|
||||
return encoding;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("CodegenMediaType{");
|
||||
sb.append("schema=").append(schema);
|
||||
sb.append(", encoding=").append(encoding);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
CodegenMediaType that = (CodegenMediaType) o;
|
||||
return Objects.equals(schema,that.getSchema()) &&
|
||||
Objects.equals(encoding, that.getEncoding());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(schema, encoding);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,14 +45,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
public List<CodegenModel> children;
|
||||
|
||||
// anyOf, oneOf, allOf
|
||||
public Set<String> anyOf = new TreeSet<String>();
|
||||
public Set<String> oneOf = new TreeSet<String>();
|
||||
public Set<String> allOf = new TreeSet<String>();
|
||||
|
||||
// anyOf, oneOf, allOf with full properties/tags (e.g. isString, etc)
|
||||
public List<CodegenProperty> anyOfProps = new ArrayList<>();
|
||||
public List<CodegenProperty> allOfProps = new ArrayList<>();
|
||||
public List<CodegenProperty> oneOfProps = new ArrayList<>();
|
||||
public Set<String> anyOf = new TreeSet<>();
|
||||
public Set<String> oneOf = new TreeSet<>();
|
||||
public Set<String> allOf = new TreeSet<>();
|
||||
|
||||
// The schema name as written in the OpenAPI document.
|
||||
public String name;
|
||||
@@ -71,20 +66,20 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
public boolean isAlias; // Is this effectively an alias of another simple type
|
||||
public boolean isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, isDate, isDateTime, isShort, isUnboundedInteger, isBoolean;
|
||||
private boolean additionalPropertiesIsAnyType;
|
||||
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>(); // all properties (without parent's properties)
|
||||
public List<CodegenProperty> allVars = new ArrayList<CodegenProperty>(); // all properties (with parent's properties)
|
||||
public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties
|
||||
public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties
|
||||
public List<CodegenProperty> readOnlyVars = new ArrayList<CodegenProperty>(); // a list of read-only properties
|
||||
public List<CodegenProperty> readWriteVars = new ArrayList<CodegenProperty>(); // a list of properties for read, write
|
||||
public List<CodegenProperty> parentVars = new ArrayList<CodegenProperty>();
|
||||
public List<CodegenProperty> vars = new ArrayList<>(); // all properties (without parent's properties)
|
||||
public List<CodegenProperty> allVars = new ArrayList<>(); // all properties (with parent's properties)
|
||||
public List<CodegenProperty> requiredVars = new ArrayList<>(); // a list of required properties
|
||||
public List<CodegenProperty> optionalVars = new ArrayList<>(); // a list of optional properties
|
||||
public List<CodegenProperty> readOnlyVars = new ArrayList<>(); // a list of read-only properties
|
||||
public List<CodegenProperty> readWriteVars = new ArrayList<>(); // a list of properties for read, write
|
||||
public List<CodegenProperty> parentVars = new ArrayList<>();
|
||||
public Map<String, Object> allowableValues;
|
||||
|
||||
// Sorted sets of required parameters.
|
||||
public Set<String> mandatory = new TreeSet<String>(); // without parent's required properties
|
||||
public Set<String> allMandatory = new TreeSet<String>(); // with parent's required properties
|
||||
public Set<String> mandatory = new TreeSet<>(); // without parent's required properties
|
||||
public Set<String> allMandatory = new TreeSet<>(); // with parent's required properties
|
||||
|
||||
public Set<String> imports = new TreeSet<String>();
|
||||
public Set<String> imports = new TreeSet<>();
|
||||
public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasValidation;
|
||||
/**
|
||||
* Indicates the OAS schema specifies "nullable: true".
|
||||
@@ -109,7 +104,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
public boolean hasOnlyReadOnly = true; // true if all properties are read-only
|
||||
public ExternalDocumentation externalDocumentation;
|
||||
|
||||
public Map<String, Object> vendorExtensions = new HashMap<String, Object>();
|
||||
public Map<String, Object> vendorExtensions = new HashMap<>();
|
||||
private CodegenComposedSchemas composedSchemas;
|
||||
private boolean hasMultipleTypes = false;
|
||||
|
||||
/**
|
||||
* The type of the value for the additionalProperties keyword in the OAS document.
|
||||
@@ -323,7 +320,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
|
||||
public void setDiscriminator(CodegenDiscriminator discriminator) {
|
||||
this.discriminator = discriminator;
|
||||
if (discriminator instanceof CodegenDiscriminator && !discriminator.getMappedModels().isEmpty()) {
|
||||
if (discriminator != null && !discriminator.getMappedModels().isEmpty()) {
|
||||
this.hasDiscriminatorWithNonEmptyMapping = true;
|
||||
}
|
||||
}
|
||||
@@ -810,6 +807,22 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
this.isAnyType = isAnyType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
|
||||
this.composedSchemas = composedSchemas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenComposedSchemas getComposedSchemas() {
|
||||
return composedSchemas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasMultipleTypes() {return hasMultipleTypes; }
|
||||
|
||||
@Override
|
||||
public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
@@ -843,12 +856,14 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
hasOnlyReadOnly == that.hasOnlyReadOnly &&
|
||||
isNull == that.isNull &&
|
||||
hasValidation == that.hasValidation &&
|
||||
hasMultipleTypes == that.getHasMultipleTypes() &&
|
||||
hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
|
||||
getIsAnyType() == that.getIsAnyType() &&
|
||||
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
|
||||
getUniqueItems() == that.getUniqueItems() &&
|
||||
getExclusiveMinimum() == that.getExclusiveMinimum() &&
|
||||
getExclusiveMaximum() == that.getExclusiveMaximum() &&
|
||||
Objects.equals(composedSchemas, that.composedSchemas) &&
|
||||
Objects.equals(parent, that.parent) &&
|
||||
Objects.equals(parentSchema, that.parentSchema) &&
|
||||
Objects.equals(interfaces, that.interfaces) &&
|
||||
@@ -856,9 +871,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
Objects.equals(parentModel, that.parentModel) &&
|
||||
Objects.equals(interfaceModels, that.interfaceModels) &&
|
||||
Objects.equals(children, that.children) &&
|
||||
Objects.equals(anyOf, that.anyOfProps) &&
|
||||
Objects.equals(oneOf, that.oneOfProps) &&
|
||||
Objects.equals(allOf, that.allOfProps) &&
|
||||
Objects.equals(anyOf, that.anyOf) &&
|
||||
Objects.equals(oneOf, that.oneOf) &&
|
||||
Objects.equals(allOf, that.allOf) &&
|
||||
@@ -921,8 +933,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
getAdditionalPropertiesType(), getMaxProperties(), getMinProperties(), getUniqueItems(), getMaxItems(),
|
||||
getMinItems(), getMaxLength(), getMinLength(), getExclusiveMinimum(), getExclusiveMaximum(), getMinimum(),
|
||||
getMaximum(), getPattern(), getMultipleOf(), getItems(), getAdditionalProperties(), getIsModel(),
|
||||
getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping, anyOfProps, oneOfProps, allOfProps,
|
||||
isAnyType);
|
||||
getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping,
|
||||
isAnyType, getComposedSchemas(), hasMultipleTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -938,9 +950,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
sb.append(", anyOf=").append(anyOf);
|
||||
sb.append(", oneOf=").append(oneOf);
|
||||
sb.append(", allOf=").append(allOf);
|
||||
sb.append(", anyOf=").append(anyOfProps);
|
||||
sb.append(", oneOf=").append(oneOfProps);
|
||||
sb.append(", allOf=").append(allOfProps);
|
||||
sb.append(", name='").append(name).append('\'');
|
||||
sb.append(", classname='").append(classname).append('\'');
|
||||
sb.append(", title='").append(title).append('\'');
|
||||
@@ -1017,6 +1026,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
sb.append(", getAdditionalPropertiesIsAnyType=").append(getAdditionalPropertiesIsAnyType());
|
||||
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
|
||||
sb.append(", getIsAnyType=").append(getIsAnyType());
|
||||
sb.append(", composedSchemas=").append(composedSchemas);
|
||||
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -1056,13 +1067,13 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
|
||||
private List<CodegenProperty> removeDuplicatedProperty(List<CodegenProperty> vars) {
|
||||
// clone the list first
|
||||
List<CodegenProperty> newList = new ArrayList<CodegenProperty>();
|
||||
List<CodegenProperty> newList = new ArrayList<>();
|
||||
for (CodegenProperty cp : vars) {
|
||||
newList.add(cp.clone());
|
||||
}
|
||||
|
||||
Set<String> propertyNames = new TreeSet<String>();
|
||||
Set<String> duplicatedNames = new TreeSet<String>();
|
||||
Set<String> propertyNames = new TreeSet<>();
|
||||
Set<String> duplicatedNames = new TreeSet<>();
|
||||
|
||||
ListIterator<CodegenProperty> iterator = newList.listIterator();
|
||||
while (iterator.hasNext()) {
|
||||
|
||||
@@ -29,7 +29,8 @@ public class CodegenOperation {
|
||||
isArray, isMultipart,
|
||||
isResponseBinary = false, isResponseFile = false, hasReference = false,
|
||||
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
|
||||
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false;
|
||||
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false,
|
||||
hasErrorResponseObject; // if 4xx, 5xx repsonses have at least one error object defined
|
||||
public String path, operationId, returnType, returnFormat, httpMethod, returnBaseType,
|
||||
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse;
|
||||
public CodegenDiscriminator discriminator;
|
||||
@@ -225,9 +226,17 @@ public class CodegenOperation {
|
||||
/**
|
||||
* Check if body param is allowed for the request method
|
||||
*
|
||||
* @return true request method is PUT, PATCH or POST; false otherwise
|
||||
* @return true request method is DELETE, PUT, PATCH or POST; false otherwise
|
||||
*/
|
||||
public boolean isBodyAllowed() {
|
||||
return Arrays.asList("DELETE","PUT", "PATCH", "POST").contains(httpMethod.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
/**
|
||||
* Check if the request method is PUT or PATCH or POST
|
||||
*
|
||||
* @return true request method is PUT, PATCH or POST; false otherwise
|
||||
*/
|
||||
public boolean isMethodPutOrPatchOrPost() {
|
||||
return Arrays.asList("PUT", "PATCH", "POST").contains(httpMethod.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@@ -289,6 +298,7 @@ public class CodegenOperation {
|
||||
sb.append(", isResponseFile=").append(isResponseFile);
|
||||
sb.append(", hasReference=").append(hasReference);
|
||||
sb.append(", hasDefaultResponse=").append(hasDefaultResponse);
|
||||
sb.append(", hasErrorResponseObject=").append(hasErrorResponseObject);
|
||||
sb.append(", isRestfulIndex=").append(isRestfulIndex);
|
||||
sb.append(", isRestfulShow=").append(isRestfulShow);
|
||||
sb.append(", isRestfulCreate=").append(isRestfulCreate);
|
||||
@@ -363,6 +373,7 @@ public class CodegenOperation {
|
||||
isResponseFile == that.isResponseFile &&
|
||||
hasReference == that.hasReference &&
|
||||
hasDefaultResponse == that.hasDefaultResponse &&
|
||||
hasErrorResponseObject == that.hasErrorResponseObject &&
|
||||
isRestfulIndex == that.isRestfulIndex &&
|
||||
isRestfulShow == that.isRestfulShow &&
|
||||
isRestfulCreate == that.isRestfulCreate &&
|
||||
@@ -427,6 +438,7 @@ public class CodegenOperation {
|
||||
produces, prioritizedContentTypes, servers, bodyParam, allParams, bodyParams, pathParams, queryParams,
|
||||
headerParams, formParams, cookieParams, requiredParams, optionalParams, authMethods, tags,
|
||||
responses, callbacks, imports, examples, requestBodyExamples, externalDocs, vendorExtensions,
|
||||
nickname, operationIdOriginal, operationIdLowerCase, operationIdCamelCase, operationIdSnakeCase);
|
||||
nickname, operationIdOriginal, operationIdLowerCase, operationIdCamelCase, operationIdSnakeCase,
|
||||
hasErrorResponseObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
public boolean hasValidation;
|
||||
public boolean isNullable;
|
||||
public boolean isDeprecated;
|
||||
private CodegenProperty schema;
|
||||
/**
|
||||
* Determines whether this parameter is mandatory. If the parameter is in "path",
|
||||
* this property is required and its value MUST be true. Otherwise, the property
|
||||
@@ -107,6 +108,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
public boolean isNull;
|
||||
private boolean hasRequired;
|
||||
private boolean hasDiscriminatorWithNonEmptyMapping;
|
||||
private CodegenComposedSchemas composedSchemas;
|
||||
private boolean hasMultipleTypes = false;
|
||||
private LinkedHashMap<String, CodegenMediaType> content;
|
||||
|
||||
public CodegenParameter copy() {
|
||||
CodegenParameter output = new CodegenParameter();
|
||||
@@ -158,7 +162,17 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
output.setHasVars(this.hasVars);
|
||||
output.setHasRequired(this.hasRequired);
|
||||
output.setHasDiscriminatorWithNonEmptyMapping(this.hasDiscriminatorWithNonEmptyMapping);
|
||||
output.setHasMultipleTypes(this.hasMultipleTypes);
|
||||
|
||||
if (this.content != null) {
|
||||
output.setContent(this.content);
|
||||
}
|
||||
if (this.schema != null) {
|
||||
output.setSchema(this.schema);
|
||||
}
|
||||
if (this.composedSchemas != null) {
|
||||
output.setComposedSchemas(this.getComposedSchemas());
|
||||
}
|
||||
if (this._enum != null) {
|
||||
output._enum = new ArrayList<String>(this._enum);
|
||||
}
|
||||
@@ -216,7 +230,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping);
|
||||
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, schema, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -264,13 +278,17 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
isDeprecated == that.isDeprecated &&
|
||||
required == that.required &&
|
||||
isNull == that.isNull &&
|
||||
hasDiscriminatorWithNonEmptyMapping && that.getHasDiscriminatorWithNonEmptyMapping() &&
|
||||
hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
|
||||
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
|
||||
hasMultipleTypes == that.getHasMultipleTypes() &&
|
||||
getHasVars() == that.getHasVars() &&
|
||||
getHasRequired() == that.getHasRequired() &&
|
||||
getExclusiveMaximum() == that.getExclusiveMaximum() &&
|
||||
getExclusiveMinimum() == that.getExclusiveMinimum() &&
|
||||
getUniqueItems() == that.getUniqueItems() &&
|
||||
Objects.equals(content, that.getContent()) &&
|
||||
Objects.equals(schema, that.getSchema()) &&
|
||||
Objects.equals(composedSchemas, that.getComposedSchemas()) &&
|
||||
Objects.equals(baseName, that.baseName) &&
|
||||
Objects.equals(paramName, that.paramName) &&
|
||||
Objects.equals(dataType, that.dataType) &&
|
||||
@@ -393,6 +411,10 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
sb.append(", getHasVars=").append(hasVars);
|
||||
sb.append(", getHasRequired=").append(hasRequired);
|
||||
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
|
||||
sb.append(", composedSchemas=").append(composedSchemas);
|
||||
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
|
||||
sb.append(", schema=").append(schema);
|
||||
sb.append(", content=").append(content);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -706,5 +728,33 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
public void setIsAnyType(boolean isAnyType) {
|
||||
this.isAnyType = isAnyType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
|
||||
this.composedSchemas = composedSchemas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenComposedSchemas getComposedSchemas() {
|
||||
return composedSchemas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasMultipleTypes() {return hasMultipleTypes; }
|
||||
|
||||
@Override
|
||||
public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
|
||||
|
||||
public CodegenProperty getSchema() {return schema; }
|
||||
|
||||
public void setSchema(CodegenProperty schema) { this.schema = schema; }
|
||||
|
||||
public LinkedHashMap<String, CodegenMediaType> getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(LinkedHashMap<String, CodegenMediaType> content) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -191,6 +191,8 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
private boolean hasVars;
|
||||
private boolean hasRequired;
|
||||
private boolean hasDiscriminatorWithNonEmptyMapping;
|
||||
private CodegenComposedSchemas composedSchemas = null;
|
||||
private boolean hasMultipleTypes = false;
|
||||
|
||||
public String getBaseName() {
|
||||
return baseName;
|
||||
@@ -614,6 +616,16 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
this.xmlNamespace = xmlNamespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
|
||||
this.composedSchemas = composedSchemas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenComposedSchemas getComposedSchemas() {
|
||||
return composedSchemas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenProperty clone() {
|
||||
try {
|
||||
@@ -642,6 +654,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
if (this.vendorExtensions != null) {
|
||||
cp.vendorExtensions = new HashMap<String, Object>(this.vendorExtensions);
|
||||
}
|
||||
if (this.composedSchemas != null) {
|
||||
cp.composedSchemas = this.composedSchemas;
|
||||
}
|
||||
|
||||
return cp;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
@@ -787,6 +802,12 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
this.isAnyType = isAnyType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasMultipleTypes() {return hasMultipleTypes; }
|
||||
|
||||
@Override
|
||||
public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("CodegenProperty{");
|
||||
@@ -882,6 +903,8 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
sb.append(", getHasVars=").append(getHasVars());
|
||||
sb.append(", getHasRequired=").append(getHasRequired());
|
||||
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
|
||||
sb.append(", composedSchemas=").append(composedSchemas);
|
||||
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -933,10 +956,12 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
isXmlAttribute == that.isXmlAttribute &&
|
||||
isXmlWrapped == that.isXmlWrapped &&
|
||||
isNull == that.isNull &&
|
||||
hasMultipleTypes == that.getHasMultipleTypes() &&
|
||||
hasDiscriminatorWithNonEmptyMapping == that.hasDiscriminatorWithNonEmptyMapping &&
|
||||
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
|
||||
getHasVars() == that.getHasVars() &&
|
||||
getHasRequired() ==that.getHasRequired() &&
|
||||
Objects.equals(composedSchemas, that.composedSchemas) &&
|
||||
Objects.equals(openApiType, that.openApiType) &&
|
||||
Objects.equals(baseName, that.baseName) &&
|
||||
Objects.equals(complexType, that.complexType) &&
|
||||
@@ -999,6 +1024,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase,
|
||||
nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName,
|
||||
xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired,
|
||||
hasDiscriminatorWithNonEmptyMapping);
|
||||
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.*;
|
||||
|
||||
public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
public final List<CodegenProperty> headers = new ArrayList<CodegenProperty>();
|
||||
private List<CodegenParameter> responseHeaders = new ArrayList<CodegenParameter>();
|
||||
public String code;
|
||||
public boolean is1xx;
|
||||
public boolean is2xx;
|
||||
@@ -85,6 +86,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
private boolean hasVars;
|
||||
private boolean hasRequired;
|
||||
private boolean hasDiscriminatorWithNonEmptyMapping;
|
||||
private CodegenComposedSchemas composedSchemas;
|
||||
private boolean hasMultipleTypes = false;
|
||||
private LinkedHashMap<String, CodegenMediaType> content;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
@@ -96,7 +100,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
|
||||
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
|
||||
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired,
|
||||
hasDiscriminatorWithNonEmptyMapping);
|
||||
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, responseHeaders, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,9 +145,13 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
is4xx == that.is4xx &&
|
||||
is5xx == that.is5xx &&
|
||||
hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
|
||||
hasMultipleTypes == that.getHasMultipleTypes() &&
|
||||
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
|
||||
getHasVars() == that.getHasVars() &&
|
||||
getHasRequired() == that.getHasRequired() &&
|
||||
Objects.equals(content, that.getContent()) &&
|
||||
Objects.equals(responseHeaders, that.getResponseHeaders()) &&
|
||||
Objects.equals(composedSchemas, that.getComposedSchemas()) &&
|
||||
Objects.equals(vars, that.vars) &&
|
||||
Objects.equals(requiredVars, that.requiredVars) &&
|
||||
Objects.equals(headers, that.headers) &&
|
||||
@@ -172,6 +180,22 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
|
||||
}
|
||||
|
||||
public LinkedHashMap<String, CodegenMediaType> getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(LinkedHashMap<String, CodegenMediaType> content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public List<CodegenParameter> getResponseHeaders() {
|
||||
return responseHeaders;
|
||||
}
|
||||
|
||||
public void setResponseHeaders(List<CodegenParameter> responseHeaders) {
|
||||
this.responseHeaders = responseHeaders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern() {
|
||||
return pattern;
|
||||
@@ -482,6 +506,10 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
sb.append(", getHasVars=").append(hasVars);
|
||||
sb.append(", getHasRequired=").append(hasRequired);
|
||||
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
|
||||
sb.append(", composedSchemas=").append(composedSchemas);
|
||||
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
|
||||
sb.append(", responseHeaders=").append(responseHeaders);
|
||||
sb.append(", content=").append(content);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -570,4 +598,20 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
public void setIsAnyType(boolean isAnyType) {
|
||||
this.isAnyType = isAnyType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
|
||||
this.composedSchemas = composedSchemas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenComposedSchemas getComposedSchemas() {
|
||||
return composedSchemas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasMultipleTypes() {return hasMultipleTypes; }
|
||||
|
||||
@Override
|
||||
public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
|
||||
}
|
||||
|
||||
@@ -147,8 +147,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected Map<String, String> typeMapping;
|
||||
protected Map<String, String> instantiationTypes;
|
||||
protected Set<String> reservedWords;
|
||||
protected Set<String> languageSpecificPrimitives = new HashSet<String>();
|
||||
protected Map<String, String> importMapping = new HashMap<String, String>();
|
||||
protected Set<String> languageSpecificPrimitives = new HashSet<>();
|
||||
protected Map<String, String> importMapping = new HashMap<>();
|
||||
protected String modelPackage = "", apiPackage = "", fileSuffix;
|
||||
protected String modelNamePrefix = "", modelNameSuffix = "";
|
||||
protected String apiNamePrefix = "", apiNameSuffix = "Api";
|
||||
@@ -159,25 +159,25 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
apiTemplateFiles are for API outputs only (controllers/handlers).
|
||||
API templates may be written multiple times; APIs are grouped by tag and the file is written once per tag group.
|
||||
*/
|
||||
protected Map<String, String> apiTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> modelTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> apiTestTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> modelTestTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> apiDocTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> modelDocTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> reservedWordsMappings = new HashMap<String, String>();
|
||||
protected Map<String, String> apiTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> modelTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> apiTestTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> modelTestTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> apiDocTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> modelDocTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> reservedWordsMappings = new HashMap<>();
|
||||
protected String templateDir;
|
||||
protected String embeddedTemplateDir;
|
||||
protected Map<String, Object> additionalProperties = new HashMap<>();
|
||||
protected Map<String, String> serverVariables = new HashMap<String, String>();
|
||||
protected Map<String, Object> vendorExtensions = new HashMap<String, Object>();
|
||||
protected Map<String, String> serverVariables = new HashMap<>();
|
||||
protected Map<String, Object> vendorExtensions = new HashMap<>();
|
||||
/*
|
||||
Supporting files are those which aren't models, APIs, or docs.
|
||||
These get a different map of data bound to the templates. Supporting files are written once.
|
||||
See also 'apiTemplateFiles'.
|
||||
*/
|
||||
protected List<SupportingFile> supportingFiles = new ArrayList<SupportingFile>();
|
||||
protected List<CliOption> cliOptions = new ArrayList<CliOption>();
|
||||
protected List<SupportingFile> supportingFiles = new ArrayList<>();
|
||||
protected List<CliOption> cliOptions = new ArrayList<>();
|
||||
protected boolean skipOverwrite;
|
||||
protected boolean removeOperationIdPrefix;
|
||||
protected String removeOperationIdPrefixDelimiter = "_";
|
||||
@@ -210,7 +210,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*/
|
||||
protected boolean supportsAdditionalPropertiesWithComposedSchema;
|
||||
protected boolean supportsMixins;
|
||||
protected Map<String, String> supportedLibraries = new LinkedHashMap<String, String>();
|
||||
protected Map<String, String> supportedLibraries = new LinkedHashMap<>();
|
||||
protected String library;
|
||||
protected Boolean sortParamsByRequiredFlag = true;
|
||||
protected Boolean sortModelPropertiesByRequiredFlag = false;
|
||||
@@ -222,7 +222,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// How to encode special characters like $
|
||||
// They are translated to words like "Dollar" and prefixed with '
|
||||
// Then translated back during JSON encoding and decoding
|
||||
protected Map<String, String> specialCharReplacements = new HashMap<String, String>();
|
||||
protected Map<String, String> specialCharReplacements = new HashMap<>();
|
||||
// When a model is an alias for a simple type
|
||||
protected Map<String, String> typeAliases = null;
|
||||
protected Boolean prependFormOrBodyParameters = false;
|
||||
@@ -236,7 +236,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected boolean useOneOfInterfaces = false;
|
||||
// whether or not the oneOf imports machinery should add oneOf interfaces as imports in implementing classes
|
||||
protected boolean addOneOfInterfaceImports = false;
|
||||
protected List<CodegenModel> addOneOfInterfaces = new ArrayList<CodegenModel>();
|
||||
protected List<CodegenModel> addOneOfInterfaces = new ArrayList<>();
|
||||
|
||||
// flag to indicate whether to only update files whose contents have changed
|
||||
protected boolean enableMinimalUpdate = false;
|
||||
@@ -260,7 +260,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
private Map<String, Schema> modelNameToSchemaCache;
|
||||
|
||||
// A cache to efficiently lookup schema `toModelName()` based on the schema Key
|
||||
private Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
|
||||
private final Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public List<CliOption> cliOptions() {
|
||||
@@ -440,7 +440,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// Gather data from all the models that contain oneOf into OneOfImplementorAdditionalData classes
|
||||
// (see docstring of that class to find out what information is gathered and why)
|
||||
Map<String, OneOfImplementorAdditionalData> additionalDataMap = new HashMap<String, OneOfImplementorAdditionalData>();
|
||||
Map<String, OneOfImplementorAdditionalData> additionalDataMap = new HashMap<>();
|
||||
for (Map.Entry<String, Object> modelsEntry : objs.entrySet()) {
|
||||
Map<String, Object> modelsAttrs = (Map<String, Object>) modelsEntry.getValue();
|
||||
List<Object> models = (List<Object>) modelsAttrs.get("models");
|
||||
@@ -503,7 +503,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @return map of all models indexed by names
|
||||
*/
|
||||
public Map<String, CodegenModel> getAllModels(Map<String, Object> objs) {
|
||||
Map<String, CodegenModel> allModels = new HashMap<String, CodegenModel>();
|
||||
Map<String, CodegenModel> allModels = new HashMap<>();
|
||||
for (Entry<String, Object> entry : objs.entrySet()) {
|
||||
String modelName = toModelName(entry.getKey());
|
||||
Map<String, Object> inner = (Map<String, Object>) entry.getValue();
|
||||
@@ -570,14 +570,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
List<Map<String, Object>> models = (List<Map<String, Object>>) inner.get("models");
|
||||
for (Map<String, Object> mo : models) {
|
||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||
for (CodegenProperty cp : cm.allVars) {
|
||||
// detect self import
|
||||
if (cp.dataType.equalsIgnoreCase(cm.classname) ||
|
||||
(cp.isContainer && cp.items != null && cp.items.dataType.equalsIgnoreCase(cm.classname))) {
|
||||
cm.imports.remove(cm.classname); // remove self import
|
||||
cp.isSelfReference = true;
|
||||
}
|
||||
}
|
||||
removeSelfReferenceImports(cm);
|
||||
}
|
||||
}
|
||||
setCircularReferences(allModels);
|
||||
@@ -585,6 +578,23 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return objs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes imports from the model that points to itself
|
||||
* Marks a self referencing property, if detected
|
||||
*
|
||||
* @param model Self imports will be removed from this model.imports collection
|
||||
*/
|
||||
protected void removeSelfReferenceImports(CodegenModel model) {
|
||||
for (CodegenProperty cp : model.allVars) {
|
||||
// detect self import
|
||||
if (cp.dataType.equalsIgnoreCase(model.classname) ||
|
||||
(cp.isContainer && cp.items != null && cp.items.dataType.equalsIgnoreCase(model.classname))) {
|
||||
model.imports.remove(model.classname); // remove self import
|
||||
cp.isSelfReference = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCircularReferences(Map<String, CodegenModel> models) {
|
||||
final Map<String, List<CodegenProperty>> dependencyMap = models.entrySet().stream()
|
||||
.collect(Collectors.toMap(Entry::getKey, entry -> getModelDependencies(entry.getValue())));
|
||||
@@ -823,9 +833,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
public void preprocessOpenAPI(OpenAPI openAPI) {
|
||||
if (useOneOfInterfaces) {
|
||||
// we process the openapi schema here to find oneOf schemas and create interface models for them
|
||||
Map<String, Schema> schemas = new HashMap<String, Schema>(openAPI.getComponents().getSchemas());
|
||||
Map<String, Schema> schemas = new HashMap<>(openAPI.getComponents().getSchemas());
|
||||
if (schemas == null) {
|
||||
schemas = new HashMap<String, Schema>();
|
||||
schemas = new HashMap<>();
|
||||
}
|
||||
Map<String, PathItem> pathItems = openAPI.getPaths();
|
||||
|
||||
@@ -858,12 +868,12 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// also add all properties of all schemas to be checked for oneOf
|
||||
Map<String, Schema> propertySchemas = new HashMap<String, Schema>();
|
||||
Map<String, Schema> propertySchemas = new HashMap<>();
|
||||
for (Map.Entry<String, Schema> e : schemas.entrySet()) {
|
||||
Schema s = e.getValue();
|
||||
Map<String, Schema> props = s.getProperties();
|
||||
if (props == null) {
|
||||
props = new HashMap<String, Schema>();
|
||||
props = new HashMap<>();
|
||||
}
|
||||
for (Map.Entry<String, Schema> p : props.entrySet()) {
|
||||
propertySchemas.put(e.getKey() + "/" + p.getKey(), p.getValue());
|
||||
@@ -1431,7 +1441,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
public String toVarName(final String name) {
|
||||
if (reservedWords.contains(name)) {
|
||||
return escapeReservedWord(name);
|
||||
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) {
|
||||
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character)))) {
|
||||
return escape(name, specialCharReplacements, null, null);
|
||||
}
|
||||
return name;
|
||||
@@ -1449,7 +1459,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
name = removeNonNameElementToCamelCase(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
if (reservedWords.contains(name)) {
|
||||
return escapeReservedWord(name);
|
||||
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) {
|
||||
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character)))) {
|
||||
return escape(name, specialCharReplacements, null, null);
|
||||
}
|
||||
return name;
|
||||
@@ -1547,7 +1557,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
.generationMessage(String.format(Locale.ROOT, "OpenAPI Generator: %s (%s)", getName(), codegenType.toValue()))
|
||||
.build();
|
||||
|
||||
defaultIncludes = new HashSet<String>(
|
||||
defaultIncludes = new HashSet<>(
|
||||
Arrays.asList("double",
|
||||
"int",
|
||||
"long",
|
||||
@@ -1564,7 +1574,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
"Float")
|
||||
);
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("array", "List");
|
||||
typeMapping.put("set", "Set");
|
||||
typeMapping.put("map", "Map");
|
||||
@@ -1591,9 +1601,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("URI", "URI");
|
||||
typeMapping.put("AnyType", "oas_any_type_not_mapped");
|
||||
|
||||
instantiationTypes = new HashMap<String, String>();
|
||||
instantiationTypes = new HashMap<>();
|
||||
|
||||
reservedWords = new HashSet<String>();
|
||||
reservedWords = new HashSet<>();
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG,
|
||||
CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString()));
|
||||
@@ -1748,7 +1758,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (!param.getRequired()) {
|
||||
paramPart.append("]");
|
||||
}
|
||||
sb.append(paramPart.toString());
|
||||
sb.append(paramPart);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2382,14 +2392,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
Map<NamedSchema, CodegenProperty> schemaCodegenPropertyCache = new HashMap<NamedSchema, CodegenProperty>();
|
||||
Map<NamedSchema, CodegenProperty> schemaCodegenPropertyCache = new HashMap<>();
|
||||
|
||||
protected void updateModelForComposedSchema(CodegenModel m, Schema schema, Map<String, Schema> allDefinitions) {
|
||||
final ComposedSchema composed = (ComposedSchema) schema;
|
||||
Map<String, Schema> properties = new LinkedHashMap<String, Schema>();
|
||||
List<String> required = new ArrayList<String>();
|
||||
Map<String, Schema> allProperties = new LinkedHashMap<String, Schema>();
|
||||
List<String> allRequired = new ArrayList<String>();
|
||||
Map<String, Schema> properties = new LinkedHashMap<>();
|
||||
List<String> required = new ArrayList<>();
|
||||
Map<String, Schema> allProperties = new LinkedHashMap<>();
|
||||
List<String> allRequired = new ArrayList<>();
|
||||
|
||||
// if schema has properties outside of allOf/oneOf/anyOf also add them to m
|
||||
if (composed.getProperties() != null && !composed.getProperties().isEmpty()) {
|
||||
@@ -2407,7 +2417,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// TODO revise the logic below to set discriminator, xml attributes
|
||||
if (supportsInheritance || supportsMixins) {
|
||||
m.allVars = new ArrayList<CodegenProperty>();
|
||||
m.allVars = new ArrayList<>();
|
||||
if (composed.getAllOf() != null) {
|
||||
int modelImplCnt = 0; // only one inline object allowed in a ComposedModel
|
||||
int modelDiscriminators = 0; // only one discriminator allowed in a ComposedModel
|
||||
@@ -2440,13 +2450,10 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// interfaces (schemas defined in allOf, anyOf, oneOf)
|
||||
List<Schema> interfaces = ModelUtils.getInterfaces(composed);
|
||||
List<CodegenProperty> anyOfProps = new ArrayList<>();
|
||||
List<CodegenProperty> allOfProps = new ArrayList<>();
|
||||
List<CodegenProperty> oneOfProps = new ArrayList<>();
|
||||
if (!interfaces.isEmpty()) {
|
||||
// m.interfaces is for backward compatibility
|
||||
if (m.interfaces == null)
|
||||
m.interfaces = new ArrayList<String>();
|
||||
m.interfaces = new ArrayList<>();
|
||||
|
||||
for (Schema interfaceSchema : interfaces) {
|
||||
interfaceSchema = unaliasSchema(interfaceSchema, importMapping);
|
||||
@@ -2467,7 +2474,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
LOGGER.warn("{} (anyOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType);
|
||||
} else {
|
||||
m.anyOf.add(languageType);
|
||||
anyOfProps.add(interfaceProperty);
|
||||
|
||||
}
|
||||
} else if (composed.getOneOf() != null) {
|
||||
@@ -2475,7 +2481,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
LOGGER.warn("{} (oneOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType);
|
||||
} else {
|
||||
m.oneOf.add(languageType);
|
||||
oneOfProps.add(interfaceProperty);
|
||||
}
|
||||
} else if (composed.getAllOf() != null) {
|
||||
// no need to add primitive type to allOf, which should comprise of schemas (models) only
|
||||
@@ -2511,29 +2516,22 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
if (composed.getAnyOf() != null) {
|
||||
m.anyOf.add(modelName);
|
||||
anyOfProps.add(interfaceProperty);
|
||||
} else if (composed.getOneOf() != null) {
|
||||
m.oneOf.add(modelName);
|
||||
oneOfProps.add(interfaceProperty);
|
||||
} else if (composed.getAllOf() != null) {
|
||||
m.allOf.add(modelName);
|
||||
allOfProps.add(interfaceProperty);
|
||||
} else {
|
||||
LOGGER.error("Composed schema has incorrect anyOf, allOf, oneOf defined: {}", composed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m.oneOfProps = oneOfProps;
|
||||
m.allOfProps = allOfProps;
|
||||
m.anyOfProps = anyOfProps;
|
||||
|
||||
if (parent != null && composed.getAllOf() != null) { // set parent for allOf only
|
||||
m.parentSchema = parentName;
|
||||
m.parent = toModelName(parentName);
|
||||
|
||||
if (supportsMultipleInheritance) {
|
||||
m.allParents = new ArrayList<String>();
|
||||
m.allParents = new ArrayList<>();
|
||||
for (String pname : allParents) {
|
||||
String pModelName = toModelName(pname);
|
||||
m.allParents.add(pModelName);
|
||||
@@ -2685,7 +2683,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// TODO remove the anyType check here in the future ANyType models can have enums defined
|
||||
m.isEnum = true;
|
||||
// comment out below as allowableValues is not set in post processing model enum
|
||||
m.allowableValues = new HashMap<String, Object>();
|
||||
m.allowableValues = new HashMap<>();
|
||||
m.allowableValues.put("values", schema.getEnum());
|
||||
}
|
||||
if (!ModelUtils.isArraySchema(schema)) {
|
||||
@@ -2696,6 +2694,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
m.setTypeProperties(schema);
|
||||
m.setComposedSchemas(getComposedSchemas(schema));
|
||||
if (ModelUtils.isArraySchema(schema)) {
|
||||
CodegenProperty arrayProperty = fromProperty(name, schema);
|
||||
m.setItems(arrayProperty.items);
|
||||
@@ -2753,7 +2752,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// set isDiscriminator on the discriminator property
|
||||
if (m.discriminator != null) {
|
||||
String discPropName = m.discriminator.getPropertyBaseName();
|
||||
List<List<CodegenProperty>> listOLists = new ArrayList<List<CodegenProperty>>();
|
||||
List<List<CodegenProperty>> listOLists = new ArrayList<>();
|
||||
listOLists.add(m.requiredVars);
|
||||
listOLists.add(m.vars);
|
||||
listOLists.add(m.allVars);
|
||||
@@ -3171,10 +3170,16 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
List<MappedModel> uniqueDescendants = new ArrayList();
|
||||
if (sourceDiscriminator.getMapping() != null && !sourceDiscriminator.getMapping().isEmpty()) {
|
||||
for (Entry<String, String> e : sourceDiscriminator.getMapping().entrySet()) {
|
||||
String nameOrRef = e.getValue();
|
||||
String name = nameOrRef.indexOf('/') >= 0 ? ModelUtils.getSimpleRef(nameOrRef) : nameOrRef;
|
||||
String modelName = toModelName(name);
|
||||
uniqueDescendants.add(new MappedModel(e.getKey(), modelName));
|
||||
String name;
|
||||
if (e.getValue().indexOf('/') >= 0) {
|
||||
name = ModelUtils.getSimpleRef(e.getValue());
|
||||
if (ModelUtils.getSchema(openAPI, name) == null) {
|
||||
LOGGER.error("Failed to lookup the schema '{}' when processing the discriminator mapping of oneOf/anyOf. Please check to ensure it's defined properly.", name);
|
||||
}
|
||||
} else {
|
||||
name = e.getValue();
|
||||
}
|
||||
uniqueDescendants.add(new MappedModel(e.getKey(), toModelName(name)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3347,6 +3352,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
protected void updatePropertyForString(CodegenProperty property, Schema p) {
|
||||
if (ModelUtils.isByteArraySchema(p)) {
|
||||
property.setIsString(false);
|
||||
property.isByteArray = true;
|
||||
} else if (ModelUtils.isBinarySchema(p)) {
|
||||
property.isBinary = true;
|
||||
@@ -3471,13 +3477,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
//Inline enum case:
|
||||
if (p.getEnum() != null && !p.getEnum().isEmpty()) {
|
||||
List<Object> _enum = p.getEnum();
|
||||
property._enum = new ArrayList<String>();
|
||||
property._enum = new ArrayList<>();
|
||||
for (Object i : _enum) {
|
||||
property._enum.add(String.valueOf(i));
|
||||
}
|
||||
property.isEnum = true;
|
||||
|
||||
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||
Map<String, Object> allowableValues = new HashMap<>();
|
||||
allowableValues.put("values", _enum);
|
||||
if (allowableValues.size() > 0) {
|
||||
property.allowableValues = allowableValues;
|
||||
@@ -3490,7 +3496,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (referencedSchema.getEnum() != null && !referencedSchema.getEnum().isEmpty()) {
|
||||
List<Object> _enum = referencedSchema.getEnum();
|
||||
|
||||
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||
Map<String, Object> allowableValues = new HashMap<>();
|
||||
allowableValues.put("values", _enum);
|
||||
if (allowableValues.size() > 0) {
|
||||
property.allowableValues = allowableValues;
|
||||
@@ -3514,6 +3520,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
property.setTypeProperties(p);
|
||||
property.setComposedSchemas(getComposedSchemas(p));
|
||||
if (ModelUtils.isIntegerSchema(p)) { // integer type
|
||||
property.isNumeric = Boolean.TRUE;
|
||||
if (ModelUtils.isLongSchema(p)) { // int64/long format
|
||||
@@ -3792,7 +3799,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
Map<String, Schema> schemas,
|
||||
CodegenOperation op,
|
||||
ApiResponse methodResponse) {
|
||||
handleMethodResponse(operation, schemas, op, methodResponse, Collections.<String, String>emptyMap());
|
||||
handleMethodResponse(operation, schemas, op, methodResponse, Collections.emptyMap());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3897,7 +3904,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
Map<String, Schema> schemas = ModelUtils.getSchemas(this.openAPI);
|
||||
CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION);
|
||||
Set<String> imports = new HashSet<String>();
|
||||
Set<String> imports = new HashSet<>();
|
||||
if (operation.getExtensions() != null && !operation.getExtensions().isEmpty()) {
|
||||
op.vendorExtensions.putAll(operation.getExtensions());
|
||||
|
||||
@@ -3958,6 +3965,20 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
ApiResponse response = operationGetResponsesEntry.getValue();
|
||||
addProducesInfo(response, op);
|
||||
CodegenResponse r = fromResponse(key, response);
|
||||
Map<String, Header> headers = response.getHeaders();
|
||||
if (headers != null) {
|
||||
List<CodegenParameter> responseHeaders = new ArrayList<>();
|
||||
for (Entry<String, Header> entry: headers.entrySet()) {
|
||||
String headerName = entry.getKey();
|
||||
Header header = entry.getValue();
|
||||
CodegenParameter responseHeader = heeaderToCodegenParameter(header, headerName, imports, String.format(Locale.ROOT, "%sResponseParameter", r.code));
|
||||
responseHeaders.add(responseHeader);
|
||||
}
|
||||
r.setResponseHeaders(responseHeaders);
|
||||
}
|
||||
String mediaTypeSchemaSuffix = String.format(Locale.ROOT, "%sResponseBody", r.code);
|
||||
r.setContent(getContent(response.getContent(), imports, mediaTypeSchemaSuffix));
|
||||
|
||||
if (r.baseType != null &&
|
||||
!defaultIncludes.contains(r.baseType) &&
|
||||
!languageSpecificPrimitives.contains(r.baseType)) {
|
||||
@@ -3975,6 +3996,12 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (Boolean.TRUE.equals(r.isFile) && Boolean.TRUE.equals(r.is2xx) && Boolean.FALSE.equals(op.isResponseFile)) {
|
||||
op.isResponseFile = Boolean.TRUE;
|
||||
}
|
||||
|
||||
// check if any 4xx or 5xx reponse has an error response object defined
|
||||
if ((Boolean.TRUE.equals(r.is4xx) || Boolean.TRUE.equals(r.is5xx)) &&
|
||||
Boolean.FALSE.equals(r.primitiveType) && Boolean.FALSE.equals(r.simpleType)) {
|
||||
op.hasErrorResponseObject = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
op.responses.sort((a, b) -> {
|
||||
int aScore = a.isWildcard() ? 2 : a.isRange() ? 1 : 0;
|
||||
@@ -3995,15 +4022,15 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
List<Parameter> parameters = operation.getParameters();
|
||||
List<CodegenParameter> allParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> bodyParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> pathParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> queryParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> headerParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> cookieParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> formParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> requiredParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> optionalParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> allParams = new ArrayList<>();
|
||||
List<CodegenParameter> bodyParams = new ArrayList<>();
|
||||
List<CodegenParameter> pathParams = new ArrayList<>();
|
||||
List<CodegenParameter> queryParams = new ArrayList<>();
|
||||
List<CodegenParameter> headerParams = new ArrayList<>();
|
||||
List<CodegenParameter> cookieParams = new ArrayList<>();
|
||||
List<CodegenParameter> formParams = new ArrayList<>();
|
||||
List<CodegenParameter> requiredParams = new ArrayList<>();
|
||||
List<CodegenParameter> optionalParams = new ArrayList<>();
|
||||
|
||||
CodegenParameter bodyParam = null;
|
||||
RequestBody requestBody = operation.getRequestBody();
|
||||
@@ -4048,7 +4075,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// add example
|
||||
if (schemas != null) {
|
||||
op.requestBodyExamples = new ExampleGenerator(schemas, this.openAPI).generate(null, new ArrayList<String>(getConsumesInfo(this.openAPI, operation)), bodyParam.baseType);
|
||||
op.requestBodyExamples = new ExampleGenerator(schemas, this.openAPI).generate(null, new ArrayList<>(getConsumesInfo(this.openAPI, operation)), bodyParam.baseType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4058,6 +4085,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
param = ModelUtils.getReferencedParameter(this.openAPI, param);
|
||||
|
||||
CodegenParameter p = fromParameter(param, imports);
|
||||
p.setContent(getContent(param.getContent(), imports, "RequestParameter" + toModelName(param.getName())));
|
||||
|
||||
// ensure unique params
|
||||
if (ensureUniqueParams) {
|
||||
@@ -4265,8 +4293,10 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
r.setTypeProperties(responseSchema);
|
||||
r.setComposedSchemas(getComposedSchemas(responseSchema));
|
||||
if (ModelUtils.isArraySchema(responseSchema)) {
|
||||
r.simpleType = false;
|
||||
r.isArray = true;
|
||||
r.containerType = cp.containerType;
|
||||
ArraySchema as = (ArraySchema) responseSchema;
|
||||
CodegenProperty items = fromProperty("response", getSchemaItems(as));
|
||||
@@ -4286,6 +4316,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else if (ModelUtils.isUUIDSchema(responseSchema)) {
|
||||
r.isUuid = true;
|
||||
} else if (ModelUtils.isByteArraySchema(responseSchema)) {
|
||||
r.setIsString(false);
|
||||
r.isByteArray = true;
|
||||
} else if (ModelUtils.isBinarySchema(responseSchema)) {
|
||||
r.isFile = true; // file = binary in OAS3
|
||||
@@ -4321,6 +4352,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else if (ModelUtils.isTypeObjectSchema(responseSchema)) {
|
||||
if (ModelUtils.isFreeFormObject(openAPI, responseSchema)) {
|
||||
r.isFreeFormObject = true;
|
||||
} else {
|
||||
r.isModel = true;
|
||||
}
|
||||
r.simpleType = false;
|
||||
r.containerType = cp.containerType;
|
||||
@@ -4332,9 +4365,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
LOGGER.debug("Property type is not primitive: {}", cp.dataType);
|
||||
}
|
||||
|
||||
if (!r.isMap && !r.isArray) {
|
||||
r.simpleType = true;
|
||||
}
|
||||
r.primitiveType = (r.baseType == null || languageSpecificPrimitives().contains(r.baseType));
|
||||
|
||||
if (r.baseType == null) {
|
||||
@@ -4506,6 +4536,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
Schema parameterSchema;
|
||||
if (parameter.getSchema() != null) {
|
||||
parameterSchema = parameter.getSchema();
|
||||
CodegenProperty prop = fromProperty(parameter.getName(), parameterSchema);
|
||||
codegenParameter.setSchema(prop);
|
||||
} else if (parameter.getContent() != null) {
|
||||
Content content = parameter.getContent();
|
||||
if (content.size() > 1) {
|
||||
@@ -4538,7 +4570,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return codegenParameter;
|
||||
}
|
||||
|
||||
parameterSchema = unaliasSchema(parameterSchema, Collections.<String, String>emptyMap());
|
||||
parameterSchema = unaliasSchema(parameterSchema, Collections.emptyMap());
|
||||
if (parameterSchema == null) {
|
||||
LOGGER.warn("warning! Schema not found for parameter \" {} \", using String", parameter.getName());
|
||||
parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition.");
|
||||
@@ -4547,6 +4579,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
ModelUtils.syncValidationProperties(parameterSchema, codegenParameter);
|
||||
codegenParameter.setTypeProperties(parameterSchema);
|
||||
codegenParameter.setComposedSchemas(getComposedSchemas(parameterSchema));
|
||||
|
||||
if (Boolean.TRUE.equals(parameterSchema.getNullable())) { // use nullable defined in the spec
|
||||
codegenParameter.isNullable = true;
|
||||
@@ -4761,7 +4794,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<CodegenSecurity> codegenSecurities = new ArrayList<CodegenSecurity>(securitySchemeMap.size());
|
||||
List<CodegenSecurity> codegenSecurities = new ArrayList<>(securitySchemeMap.size());
|
||||
for (String key : securitySchemeMap.keySet()) {
|
||||
final SecurityScheme securityScheme = securitySchemeMap.get(key);
|
||||
if (SecurityScheme.Type.APIKEY.equals(securityScheme.getType())) {
|
||||
@@ -4777,12 +4810,12 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
final CodegenSecurity cs = defaultCodegenSecurity(key, securityScheme);
|
||||
cs.isKeyInHeader = cs.isKeyInQuery = cs.isKeyInCookie = cs.isApiKey = cs.isOAuth = false;
|
||||
cs.isBasic = true;
|
||||
if ("basic".equals(securityScheme.getScheme())) {
|
||||
if ("basic".equalsIgnoreCase(securityScheme.getScheme())) {
|
||||
cs.isBasicBasic = true;
|
||||
} else if ("bearer".equals(securityScheme.getScheme())) {
|
||||
} else if ("bearer".equalsIgnoreCase(securityScheme.getScheme())) {
|
||||
cs.isBasicBearer = true;
|
||||
cs.bearerFormat = securityScheme.getBearerFormat();
|
||||
} else if ("signature".equals(securityScheme.getScheme())) {
|
||||
} else if ("signature".equalsIgnoreCase(securityScheme.getScheme())) {
|
||||
// HTTP signature as defined in https://datatracker.ietf.org/doc/draft-cavage-http-signatures/
|
||||
// The registry of security schemes is maintained by IANA.
|
||||
// https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml
|
||||
@@ -4861,7 +4894,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
protected void setReservedWordsLowerCase(List<String> words) {
|
||||
reservedWords = new HashSet<String>();
|
||||
reservedWords = new HashSet<>();
|
||||
for (String word : words) {
|
||||
reservedWords.add(word.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
@@ -4924,9 +4957,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return null;
|
||||
}
|
||||
|
||||
final List<Map<String, Object>> output = new ArrayList<Map<String, Object>>(examples.size());
|
||||
final List<Map<String, Object>> output = new ArrayList<>(examples.size());
|
||||
for (Map.Entry<String, Object> entry : examples.entrySet()) {
|
||||
final Map<String, Object> kv = new HashMap<String, Object>();
|
||||
final Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("contentType", entry.getKey());
|
||||
kv.put("example", entry.getValue());
|
||||
output.add(kv);
|
||||
@@ -4982,7 +5015,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
co, Map<String, List<CodegenOperation>> operations) {
|
||||
List<CodegenOperation> opList = operations.get(tag);
|
||||
if (opList == null) {
|
||||
opList = new ArrayList<CodegenOperation>();
|
||||
opList = new ArrayList<>();
|
||||
operations.put(tag, opList);
|
||||
}
|
||||
// check for operationId uniqueness
|
||||
@@ -5090,8 +5123,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
m.hasVars = true;
|
||||
m.hasEnums = false; // TODO need to fix as its false in both cases
|
||||
|
||||
Set<String> mandatory = required == null ? Collections.<String>emptySet()
|
||||
: new TreeSet<String>(required);
|
||||
Set<String> mandatory = required == null ? Collections.emptySet()
|
||||
: new TreeSet<>(required);
|
||||
|
||||
// update "vars" without parent's properties (all, required)
|
||||
addVars(m, m.vars, properties, mandatory);
|
||||
@@ -5103,8 +5136,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
if (allProperties != null) {
|
||||
Set<String> allMandatory = allRequired == null ? Collections.<String>emptySet()
|
||||
: new TreeSet<String>(allRequired);
|
||||
Set<String> allMandatory = allRequired == null ? Collections.emptySet()
|
||||
: new TreeSet<>(allRequired);
|
||||
// update "vars" with parent's properties (all, required)
|
||||
addVars(m, m.allVars, allProperties, allMandatory);
|
||||
m.allMandatory = allMandatory;
|
||||
@@ -5114,14 +5147,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// loop through list to update property name with toVarName
|
||||
Set<String> renamedMandatory = new ConcurrentSkipListSet<String>();
|
||||
Set<String> renamedMandatory = new ConcurrentSkipListSet<>();
|
||||
Iterator<String> mandatoryIterator = m.mandatory.iterator();
|
||||
while (mandatoryIterator.hasNext()) {
|
||||
renamedMandatory.add(toVarName(mandatoryIterator.next()));
|
||||
}
|
||||
m.mandatory = renamedMandatory;
|
||||
|
||||
Set<String> renamedAllMandatory = new ConcurrentSkipListSet<String>();
|
||||
Set<String> renamedAllMandatory = new ConcurrentSkipListSet<>();
|
||||
Iterator<String> allMandatoryIterator = m.allMandatory.iterator();
|
||||
while (allMandatoryIterator.hasNext()) {
|
||||
renamedAllMandatory.add(toVarName(allMandatoryIterator.next()));
|
||||
@@ -5171,17 +5204,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
cm.hasOnlyReadOnly = false;
|
||||
}
|
||||
|
||||
// TODO revise the logic to include map
|
||||
if (cp.isContainer) {
|
||||
addImport(cm, typeMapping.get("array"));
|
||||
}
|
||||
|
||||
addImport(cm, cp.baseType);
|
||||
CodegenProperty innerCp = cp;
|
||||
while (innerCp != null) {
|
||||
addImport(cm, innerCp.complexType);
|
||||
innerCp = innerCp.items;
|
||||
}
|
||||
addImportsForPropertyType(cm, cp);
|
||||
|
||||
// if required, add to the list "requiredVars"
|
||||
if (Boolean.TRUE.equals(cp.required)) {
|
||||
@@ -5202,6 +5225,28 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given property, adds all needed imports to the model
|
||||
* This includes a flat property type (e.g. property type: ReferencedModel)
|
||||
* as well as container type (property type: array of ReferencedModel's)
|
||||
*
|
||||
* @param model The codegen representation of the OAS schema.
|
||||
* @param property The codegen representation of the OAS schema's property.
|
||||
*/
|
||||
protected void addImportsForPropertyType(CodegenModel model, CodegenProperty property) {
|
||||
// TODO revise the logic to include map
|
||||
if (property.isContainer) {
|
||||
addImport(model, typeMapping.get("array"));
|
||||
}
|
||||
|
||||
addImport(model, property.baseType);
|
||||
CodegenProperty innerCp = property;
|
||||
while (innerCp != null) {
|
||||
addImport(model, innerCp.complexType);
|
||||
innerCp = innerCp.items;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine all of the types in the model definitions (schemas) that are aliases of
|
||||
* simple types.
|
||||
@@ -5574,7 +5619,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @return sanitized string
|
||||
*/
|
||||
public String sanitizeName(String name, String removeCharRegEx) {
|
||||
return sanitizeName(name, removeCharRegEx, new ArrayList<String>());
|
||||
return sanitizeName(name, removeCharRegEx, new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5833,7 +5878,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
enumName = String.valueOf(value);
|
||||
} else {
|
||||
enumName = value.toString().substring(truncateIdx);
|
||||
if ("".equals(enumName)) {
|
||||
if (enumName.isEmpty()) {
|
||||
enumName = value.toString();
|
||||
}
|
||||
}
|
||||
@@ -6063,7 +6108,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<String> produces = new ConcurrentSkipListSet<String>();
|
||||
Set<String> produces = new ConcurrentSkipListSet<>();
|
||||
|
||||
for (ApiResponse r : operation.getResponses().values()) {
|
||||
ApiResponse response = ModelUtils.getReferencedApiResponse(openAPI, r);
|
||||
@@ -6114,7 +6159,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
LOGGER.debug("debugging fromRequestBodyToFormParameters= {}", body);
|
||||
Schema schema = ModelUtils.getSchemaFromRequestBody(body);
|
||||
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
|
||||
List<String> allRequired = new ArrayList<String>();
|
||||
List<String> allRequired = new ArrayList<>();
|
||||
Map<String, Schema> properties = new LinkedHashMap<>();
|
||||
// this traverses a composed schema and extracts all properties in each schema into properties
|
||||
// TODO in the future have this return one codegenParameter of type object or composed which includes all definition
|
||||
@@ -6156,6 +6201,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
Schema ps = unaliasSchema(propertySchema, importMapping);
|
||||
ModelUtils.syncValidationProperties(ps, codegenParameter);
|
||||
codegenParameter.setTypeProperties(ps);
|
||||
codegenParameter.setComposedSchemas(getComposedSchemas(ps));
|
||||
if (ps.getPattern() != null) {
|
||||
codegenParameter.pattern = toRegularExpression(ps.getPattern());
|
||||
}
|
||||
@@ -6294,7 +6340,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
codegenParameter.datatypeWithEnum = codegenProperty.datatypeWithEnum;
|
||||
codegenParameter.enumName = codegenProperty.enumName;
|
||||
}
|
||||
|
||||
|
||||
// import
|
||||
if (codegenProperty.complexType != null) {
|
||||
imports.add(codegenProperty.complexType);
|
||||
@@ -6536,6 +6582,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected void updateRequestBodyForString(CodegenParameter codegenParameter, Schema schema, Set<String> imports, String bodyParameterName) {
|
||||
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
|
||||
if (ModelUtils.isByteArraySchema(schema)) {
|
||||
codegenParameter.setIsString(false);
|
||||
codegenParameter.isByteArray = true;
|
||||
} else if (ModelUtils.isBinarySchema(schema)) {
|
||||
codegenParameter.isBinary = true;
|
||||
@@ -6559,6 +6606,77 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
codegenParameter.pattern = toRegularExpression(schema.getPattern());
|
||||
}
|
||||
|
||||
protected String toMediaTypeSchemaName(String contentType, String mediaTypeSchemaSuffix) {
|
||||
return "SchemaFor" + mediaTypeSchemaSuffix + toModelName(contentType);
|
||||
}
|
||||
|
||||
private CodegenParameter heeaderToCodegenParameter(Header header, String headerName, Set<String> imports, String mediaTypeSchemaSuffix) {
|
||||
if (header == null) {
|
||||
return null;
|
||||
}
|
||||
Parameter headerParam = new Parameter();
|
||||
headerParam.setName(headerName);
|
||||
headerParam.setIn("header");
|
||||
headerParam.setDescription(header.getDescription());
|
||||
headerParam.setRequired(header.getRequired());
|
||||
headerParam.setDeprecated(header.getDeprecated());
|
||||
Header.StyleEnum style = header.getStyle();
|
||||
if (style != null) {
|
||||
headerParam.setStyle(Parameter.StyleEnum.valueOf(style.name()));
|
||||
}
|
||||
headerParam.setExplode(header.getExplode());
|
||||
headerParam.setSchema(header.getSchema());
|
||||
headerParam.setExamples(header.getExamples());
|
||||
headerParam.setExample(header.getExample());
|
||||
headerParam.setContent(header.getContent());
|
||||
headerParam.setExtensions(header.getExtensions());
|
||||
CodegenParameter param = fromParameter(headerParam, imports);
|
||||
param.setContent(getContent(headerParam.getContent(), imports, mediaTypeSchemaSuffix));
|
||||
return param;
|
||||
}
|
||||
|
||||
protected LinkedHashMap<String, CodegenMediaType> getContent(Content content, Set<String> imports, String mediaTypeSchemaSuffix) {
|
||||
if (content == null) {
|
||||
return null;
|
||||
}
|
||||
LinkedHashMap<String, CodegenMediaType> cmtContent = new LinkedHashMap<>();
|
||||
for (Entry<String, MediaType> contentEntry: content.entrySet()) {
|
||||
MediaType mt = contentEntry.getValue();
|
||||
LinkedHashMap<String, CodegenEncoding> ceMap = null;
|
||||
if (mt.getEncoding() != null ) {
|
||||
ceMap = new LinkedHashMap<>();
|
||||
Map<String, Encoding> encMap = mt.getEncoding();
|
||||
for (Entry<String, Encoding> encodingEntry: encMap.entrySet()) {
|
||||
Encoding enc = encodingEntry.getValue();
|
||||
List<CodegenParameter> headers = new ArrayList<>();
|
||||
if (enc.getHeaders() != null) {
|
||||
Map<String, Header> encHeaders = enc.getHeaders();
|
||||
for (Entry<String, Header> headerEntry: encHeaders.entrySet()) {
|
||||
String headerName = headerEntry.getKey();
|
||||
Header header = ModelUtils.getReferencedHeader(this.openAPI, headerEntry.getValue());
|
||||
CodegenParameter param = heeaderToCodegenParameter(header, headerName, imports, mediaTypeSchemaSuffix);
|
||||
headers.add(param);
|
||||
}
|
||||
}
|
||||
CodegenEncoding ce = new CodegenEncoding(
|
||||
enc.getContentType(),
|
||||
headers,
|
||||
enc.getStyle().toString(),
|
||||
enc.getExplode().booleanValue(),
|
||||
enc.getAllowReserved().booleanValue()
|
||||
);
|
||||
String propName = encodingEntry.getKey();
|
||||
ceMap.put(propName, ce);
|
||||
}
|
||||
}
|
||||
String contentType = contentEntry.getKey();
|
||||
CodegenProperty schemaProp = fromProperty(toMediaTypeSchemaName(contentType, mediaTypeSchemaSuffix), mt.getSchema());
|
||||
CodegenMediaType codegenMt = new CodegenMediaType(schemaProp, ceMap);
|
||||
cmtContent.put(contentType, codegenMt);
|
||||
}
|
||||
return cmtContent;
|
||||
}
|
||||
|
||||
public CodegenParameter fromRequestBody(RequestBody body, Set<String> imports, String bodyParameterName) {
|
||||
if (body == null) {
|
||||
LOGGER.error("body in fromRequestBody cannot be null!");
|
||||
@@ -6580,6 +6698,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("Request body cannot be null. Possible cause: missing schema in body parameter (OAS v2): " + body);
|
||||
}
|
||||
codegenParameter.setContent(getContent(body.getContent(), imports, "RequestBody"));
|
||||
|
||||
if (StringUtils.isNotBlank(schema.get$ref())) {
|
||||
name = ModelUtils.getSimpleRef(schema.get$ref());
|
||||
@@ -6590,6 +6709,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
ModelUtils.syncValidationProperties(unaliasedSchema, codegenParameter);
|
||||
codegenParameter.setTypeProperties(unaliasedSchema);
|
||||
codegenParameter.setComposedSchemas(getComposedSchemas(unaliasedSchema));
|
||||
// TODO in the future switch al the below schema usages to unaliasedSchema
|
||||
// because it keeps models as refs and will not get their referenced schemas
|
||||
if (ModelUtils.isArraySchema(schema)) {
|
||||
@@ -6633,6 +6753,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else if (ModelUtils.isObjectSchema(schema)) {
|
||||
// object type schema OR (AnyType schema with properties defined)
|
||||
this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, false);
|
||||
} else {
|
||||
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
|
||||
}
|
||||
addVarsRequiredVarsAdditionalProps(schema, codegenParameter);
|
||||
} else {
|
||||
@@ -6956,7 +7078,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
cm.name = type;
|
||||
cm.classname = type;
|
||||
cm.vendorExtensions.put("x-is-one-of-interface", true);
|
||||
cm.interfaceModels = new ArrayList<CodegenModel>();
|
||||
cm.interfaceModels = new ArrayList<>();
|
||||
|
||||
addOneOfInterfaces.add(cm);
|
||||
}
|
||||
@@ -7154,4 +7276,30 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected String getCollectionFormat(CodegenParameter codegenParameter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private CodegenComposedSchemas getComposedSchemas(Schema schema) {
|
||||
if (!(schema instanceof ComposedSchema)) {
|
||||
return null;
|
||||
}
|
||||
ComposedSchema cs = (ComposedSchema) schema;
|
||||
return new CodegenComposedSchemas(
|
||||
getComposedProperties(cs.getAllOf(), "allOf"),
|
||||
getComposedProperties(cs.getOneOf(), "oneOf"),
|
||||
getComposedProperties(cs.getAnyOf(), "anyOf")
|
||||
);
|
||||
}
|
||||
|
||||
private List<CodegenProperty> getComposedProperties(List<Schema> xOfCollection, String collectionName) {
|
||||
if (xOfCollection == null) {
|
||||
return null;
|
||||
}
|
||||
List<CodegenProperty> xOf = new ArrayList<>();
|
||||
int i = 0;
|
||||
for (Schema xOfSchema: xOfCollection) {
|
||||
CodegenProperty cp = fromProperty(collectionName + "_" + i, xOfSchema);
|
||||
xOf.add(cp);
|
||||
i += 1;
|
||||
}
|
||||
return xOf;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +268,11 @@ public class DefaultGenerator implements Generator {
|
||||
URL url = URLPathUtils.getServerURL(openAPI, config.serverVariableOverrides());
|
||||
contextPath = removeTrailingSlash(config.escapeText(url.getPath())); // for backward compatibility
|
||||
basePathWithoutHost = contextPath;
|
||||
basePath = removeTrailingSlash(config.escapeText(URLPathUtils.getHost(openAPI, config.serverVariableOverrides())));
|
||||
if (URLPathUtils.isRelativeUrl(openAPI.getServers())) {
|
||||
basePath = removeTrailingSlash(basePathWithoutHost);
|
||||
} else {
|
||||
basePath = removeTrailingSlash(config.escapeText(URLPathUtils.getHost(openAPI, config.serverVariableOverrides())));
|
||||
}
|
||||
}
|
||||
|
||||
private void configureOpenAPIInfo() {
|
||||
|
||||
@@ -145,6 +145,14 @@ public interface IJsonSchemaValidationProperties {
|
||||
|
||||
void setIsAnyType(boolean isAnyType);
|
||||
|
||||
CodegenComposedSchemas getComposedSchemas();
|
||||
|
||||
void setComposedSchemas(CodegenComposedSchemas composedSchemas);
|
||||
|
||||
boolean getHasMultipleTypes();
|
||||
|
||||
void setHasMultipleTypes(boolean hasMultipleTypes);
|
||||
|
||||
/**
|
||||
* Syncs all the schema's type properties into the IJsonSchemaValidationProperties instance
|
||||
* for now this only supports types without format information
|
||||
|
||||
@@ -129,6 +129,6 @@ public class SpecValidationException extends RuntimeException {
|
||||
});
|
||||
|
||||
return super.getMessage() + " | " +
|
||||
"Error count: " + errorCount + ", Warning count: " + warningCount + sb.toString();
|
||||
"Error count: " + errorCount + ", Warning count: " + warningCount + sb;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class TemplateManager implements TemplatingExecutor, TemplateProcessor {
|
||||
* @param name The location of the template
|
||||
* @return The raw template contents
|
||||
*/
|
||||
@SuppressWarnings({"java:S112"})
|
||||
@SuppressWarnings("java:S112")
|
||||
// ignored rule java:S112 as RuntimeException is used to match previous exception type
|
||||
public String readTemplate(String name) {
|
||||
if (name == null || name.contains("..")) {
|
||||
|
||||
@@ -26,7 +26,7 @@ public class TemplatingEngineLoader {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
@SuppressWarnings({"java:S112"}) // ignore java:S112 as generic RuntimeException is acceptable here
|
||||
@SuppressWarnings("java:S112") // ignore java:S112 as generic RuntimeException is acceptable here
|
||||
public static TemplatingEngineAdapter byIdentifier(String id) {
|
||||
ServiceLoader<TemplatingEngineAdapter> loader = ServiceLoader.load(TemplatingEngineAdapter.class, TemplatingEngineLoader.class.getClassLoader());
|
||||
|
||||
@@ -42,7 +42,7 @@ public class TemplatingEngineLoader {
|
||||
// Attempt to load skipping SPI
|
||||
return (TemplatingEngineAdapter) Class.forName(id).getDeclaredConstructor().newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(String.format(Locale.ROOT, "Couldn't load template engine adapter %s. Available options: %n%s", id, sb.toString()), e);
|
||||
throw new RuntimeException(String.format(Locale.ROOT, "Couldn't load template engine adapter %s. Available options: %n%s", id, sb), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,9 +534,17 @@ public class CodegenConfigurator {
|
||||
if (validationMessages.size() > 0) {
|
||||
Set<String> warnings = new HashSet<>();
|
||||
if (specification != null) {
|
||||
List<String> unusedModels = ModelUtils.getUnusedSchemas(specification);
|
||||
if (unusedModels != null) {
|
||||
unusedModels.forEach(name -> warnings.add("Unused model: " + name));
|
||||
|
||||
// Wrap the getUnusedSchemas() in try catch block so it catches the NPE
|
||||
// when the input spec file is not correct
|
||||
try{
|
||||
List<String> unusedModels = ModelUtils.getUnusedSchemas(specification);
|
||||
if (unusedModels != null) {
|
||||
unusedModels.forEach(name -> warnings.add("Unused model: " + name));
|
||||
}
|
||||
} catch (Exception e){
|
||||
System.err.println("[error] There is an error with OpenAPI specification parsed from the input spec file: " + inputSpec);
|
||||
System.err.println("[error] Please make sure the spec file has correct format and all required fields are populated with valid value.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ public class ExampleGenerator {
|
||||
}
|
||||
} else if (modelName != null && mediaType.startsWith(MIME_TYPE_XML)) {
|
||||
final Schema schema = this.examples.get(modelName);
|
||||
String example = new XmlExampleGenerator(this.examples).toXml(schema, 0, Collections.<String>emptySet());
|
||||
String example = new XmlExampleGenerator(this.examples).toXml(schema, 0, Collections.emptySet());
|
||||
if (example != null) {
|
||||
kv.put(EXAMPLE, example);
|
||||
output.add(kv);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class XmlExampleGenerator {
|
||||
}
|
||||
|
||||
public String toXml(Schema schema) {
|
||||
return toXml(null, schema, 0, Collections.<String>emptySet());
|
||||
return toXml(null, schema, 0, Collections.emptySet());
|
||||
}
|
||||
|
||||
protected String toXml(Schema schema, int indent, Collection<String> path) {
|
||||
|
||||
@@ -41,7 +41,7 @@ public class RootedFileRule extends Rule {
|
||||
}
|
||||
|
||||
private String getExtensionPart(final String input, int stopIndex) {
|
||||
return input.substring(stopIndex > 0 ? stopIndex+1: input.length(), input.length());
|
||||
return input.substring(stopIndex > 0 ? stopIndex+1: input.length());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,7 +50,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
protected List<Map<String, Object>> orderedModels;
|
||||
protected final Map<String, List<String>> modelDepends;
|
||||
protected final Map<String, String> nullableTypeMapping;
|
||||
protected final HashMap<String, String> operationsScopes;
|
||||
protected final Map<String, String> operationsScopes;
|
||||
protected int scopeIndex = 0;
|
||||
|
||||
public AbstractAdaCodegen() {
|
||||
@@ -155,7 +155,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
"xor")
|
||||
);
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("date", "Swagger.Date");
|
||||
typeMapping.put("DateTime", "Swagger.Datetime");
|
||||
typeMapping.put("string", "Swagger.UString");
|
||||
@@ -172,7 +172,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
typeMapping.put("binary", "Swagger.Binary");
|
||||
|
||||
// Mapping to convert an Ada required type to an optional type (nullable).
|
||||
nullableTypeMapping = new HashMap<String, String>();
|
||||
nullableTypeMapping = new HashMap<>();
|
||||
nullableTypeMapping.put("Swagger.Date", "Swagger.Nullable_Date");
|
||||
nullableTypeMapping.put("Swagger.Datetime", "Swagger.Nullable_Date");
|
||||
nullableTypeMapping.put("Swagger.UString", "Swagger.Nullable_UString");
|
||||
@@ -181,10 +181,10 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
nullableTypeMapping.put("Boolean", "Swagger.Nullable_Boolean");
|
||||
nullableTypeMapping.put("Swagger.Object", "Swagger.Object");
|
||||
|
||||
modelDepends = new HashMap<String, List<String>>();
|
||||
orderedModels = new ArrayList<Map<String, Object>>();
|
||||
operationsScopes = new HashMap<String, String>();
|
||||
super.importMapping = new HashMap<String, String>();
|
||||
modelDepends = new HashMap<>();
|
||||
orderedModels = new ArrayList<>();
|
||||
operationsScopes = new HashMap<>();
|
||||
super.importMapping = new HashMap<>();
|
||||
|
||||
// CLI options
|
||||
addOption(CodegenConstants.PROJECT_NAME, "GNAT project name",
|
||||
@@ -193,7 +193,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
modelNameSuffix = "Type";
|
||||
embeddedTemplateDir = templateDir = "Ada";
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList("integer", "boolean", "number", "long", "float",
|
||||
"double", "object", "string", "date", "DateTime", "binary"));
|
||||
}
|
||||
@@ -651,7 +651,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
Object v = model.get("model");
|
||||
if (v instanceof CodegenModel) {
|
||||
CodegenModel m = (CodegenModel) v;
|
||||
List<String> d = new ArrayList<String>();
|
||||
List<String> d = new ArrayList<>();
|
||||
for (CodegenProperty p : m.vars) {
|
||||
boolean isModel = false;
|
||||
CodegenProperty item = p;
|
||||
@@ -687,8 +687,8 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
// if I find a model that has no dependencies, or all of its dependencies are in revisedOrderedModels, consider it the independentModel
|
||||
// put the independentModel at the end of revisedOrderedModels, and remove it from orderedModels
|
||||
//
|
||||
List<Map<String, Object>> revisedOrderedModels = new ArrayList<Map<String, Object>>();
|
||||
List<String> collectedModelNames = new ArrayList<String>();
|
||||
List<Map<String, Object>> revisedOrderedModels = new ArrayList<>();
|
||||
List<String> collectedModelNames = new ArrayList<>();
|
||||
int sizeOrderedModels = orderedModels.size();
|
||||
for (int i = 0; i < sizeOrderedModels; i++) {
|
||||
Map<String, Object> independentModel = null;
|
||||
@@ -760,7 +760,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
* @return the authMethods to be used by the operation with its required scopes.
|
||||
*/
|
||||
private List<CodegenSecurity> postProcessAuthMethod(List<CodegenSecurity> authMethods, Map<String, List<String>> scopes) {
|
||||
List<CodegenSecurity> result = (scopes == null) ? null : new ArrayList<CodegenSecurity>();
|
||||
List<CodegenSecurity> result = (scopes == null) ? null : new ArrayList<>();
|
||||
if (authMethods != null) {
|
||||
for (CodegenSecurity authMethod : authMethods) {
|
||||
if (authMethod.scopes != null) {
|
||||
@@ -803,7 +803,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
opSecurity.isKeyInQuery = authMethod.isKeyInQuery;
|
||||
opSecurity.flow = authMethod.flow;
|
||||
opSecurity.tokenUrl = authMethod.tokenUrl;
|
||||
List<Map<String, Object>> opAuthScopes = new ArrayList<Map<String, Object>>();
|
||||
List<Map<String, Object>> opAuthScopes = new ArrayList<>();
|
||||
for (String opScopeName : opScopes) {
|
||||
for (Map<String, Object> scope : authMethod.scopes) {
|
||||
String name = (String) scope.get("scope");
|
||||
|
||||
@@ -81,9 +81,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
protected boolean supportNullable = Boolean.FALSE;
|
||||
|
||||
// nullable type
|
||||
protected Set<String> nullableType = new HashSet<String>();
|
||||
protected Set<String> nullableType = new HashSet<>();
|
||||
|
||||
protected Set<String> valueTypes = new HashSet<String>();
|
||||
protected Set<String> valueTypes = new HashSet<>();
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractCSharpCodegen.class);
|
||||
|
||||
@@ -104,14 +104,14 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
outputFolder = "generated-code" + File.separator + this.getName();
|
||||
embeddedTemplateDir = templateDir = this.getName();
|
||||
|
||||
collectionTypes = new HashSet<String>(
|
||||
collectionTypes = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"IList", "List",
|
||||
"ICollection", "Collection",
|
||||
"IEnumerable")
|
||||
);
|
||||
|
||||
mapTypes = new HashSet<String>(
|
||||
mapTypes = new HashSet<>(
|
||||
Arrays.asList("IDictionary")
|
||||
);
|
||||
|
||||
@@ -141,7 +141,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
);
|
||||
|
||||
// TODO: Either include fully qualified names here or handle in DefaultCodegen via lastIndexOf(".") search
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"String",
|
||||
"string",
|
||||
@@ -184,7 +184,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
|
||||
// Nullable types here assume C# 2 support is not part of base
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("string", "string");
|
||||
typeMapping.put("binary", "byte[]");
|
||||
typeMapping.put("ByteArray", "byte[]");
|
||||
@@ -207,11 +207,11 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
typeMapping.put("AnyType", "Object");
|
||||
|
||||
// nullable type
|
||||
nullableType = new HashSet<String>(
|
||||
nullableType = new HashSet<>(
|
||||
Arrays.asList("decimal", "bool", "int", "float", "long", "double", "DateTime", "DateTimeOffset", "Guid")
|
||||
);
|
||||
// value Types
|
||||
valueTypes = new HashSet<String>(
|
||||
valueTypes = new HashSet<>(
|
||||
Arrays.asList("decimal", "bool", "int", "float", "long", "double")
|
||||
);
|
||||
}
|
||||
@@ -463,9 +463,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
*
|
||||
* @param models processed models to be further processed for enum references
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@SuppressWarnings("unchecked")
|
||||
private void postProcessEnumRefs(final Map<String, Object> models) {
|
||||
Map<String, CodegenModel> enumRefs = new HashMap<String, CodegenModel>();
|
||||
Map<String, CodegenModel> enumRefs = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : models.entrySet()) {
|
||||
CodegenModel model = ModelUtils.getModelByName(entry.getKey(), models);
|
||||
if (model.isEnum) {
|
||||
@@ -1325,7 +1325,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// only process files with .cs extension
|
||||
if ("cs".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = csharpPostProcessFile + " " + file.toString();
|
||||
String command = csharpPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
||||
@@ -323,7 +323,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
}
|
||||
// only process files with cpp extension
|
||||
if ("cpp".equals(FilenameUtils.getExtension(file.toString())) || "h".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = cppPostProcessFile + " " + file.toString();
|
||||
String command = cppPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
|
||||
@@ -340,7 +340,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
|
||||
// replace all characters that have a mapping but ignore underscores
|
||||
// append an underscore to each replacement so that it can be camelized
|
||||
if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) {
|
||||
if (name.chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character)))) {
|
||||
name = escape(name, specialCharReplacements, Collections.singletonList("_"), "_");
|
||||
}
|
||||
// remove the rest
|
||||
@@ -505,7 +505,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
super.postProcessModelProperty(model, property);
|
||||
if (!model.isEnum && property.isEnum) {
|
||||
// These are inner enums, enums which do not exist as models, just as properties.
|
||||
// They are handled via the enum_inline template and and are generated in the
|
||||
// They are handled via the enum_inline template and are generated in the
|
||||
// same file as the containing class. To prevent name clashes the inline enum classes
|
||||
// are prefix with the classname of the containing class in the template.
|
||||
// Here the datatypeWithEnum template variable gets updated to match that scheme.
|
||||
@@ -529,9 +529,9 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List<Server> servers) {
|
||||
final CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers);
|
||||
for (CodegenResponse r : op.responses) {
|
||||
// By default only set types are automatically added to operation imports, not sure why.
|
||||
// By default, only set types are automatically added to operation imports, not sure why.
|
||||
// Add all container type imports here, by default 'dart:core' imports are skipped
|
||||
// but other sub classes may required specific container type imports.
|
||||
// but other sub-classes may require specific container type imports.
|
||||
if (r.containerType != null && typeMapping().containsKey(r.containerType)) {
|
||||
final String value = typeMapping().get(r.containerType);
|
||||
if (needToImport(value)) {
|
||||
@@ -752,7 +752,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
// process all files with dart extension
|
||||
if ("dart".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
// currently supported is "dartfmt -w" and "dart format"
|
||||
String command = dartPostProcessFile + " " + file.toString();
|
||||
String command = dartPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
||||
@@ -53,9 +53,9 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
"redefine", "rename", "require", "rescue", "Result", "retry", "select", "separate", "then", "True",
|
||||
"TUPLE", "undefine", "until", "variant", "Void", "when", "xor"));
|
||||
|
||||
defaultIncludes = new HashSet<String>(Arrays.asList("map", "array"));
|
||||
defaultIncludes = new HashSet<>(Arrays.asList("map", "array"));
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList("BOOLEAN", "INTEGER_8", "INTEGER_16", "INTEGER_32", "INTEGER_64", "NATURAL_8",
|
||||
"NATURAL_16", "NATURAL_32", "NATURAL_64", "REAL_32", "REAL_64"));
|
||||
|
||||
@@ -559,7 +559,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
|
||||
public Map<String, String> createMapping(String key, String value) {
|
||||
Map<String, String> customImport = new HashMap<String, String>();
|
||||
Map<String, String> customImport = new HashMap<>();
|
||||
customImport.put(key, value);
|
||||
|
||||
return customImport;
|
||||
@@ -592,7 +592,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
|
||||
public String toEiffelFeatureStyle(String operationId) {
|
||||
if (operationId.startsWith("get_")) {
|
||||
return operationId.substring(4, operationId.length());
|
||||
return operationId.substring(4);
|
||||
} else {
|
||||
return operationId;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user