forked from loafle/openapi-generator-original
Compare commits
85 Commits
v7.0.0
...
skip-form-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f235f0854 | ||
|
|
d6695056fe | ||
|
|
196c2b1642 | ||
|
|
c6d355e8d4 | ||
|
|
ad589c7700 | ||
|
|
cd0fde41f1 | ||
|
|
8b15d4820e | ||
|
|
1901bf23ea | ||
|
|
78f3b19b58 | ||
|
|
5ee18156db | ||
|
|
14cfca7b06 | ||
|
|
c354bf86ff | ||
|
|
4e15e1a813 | ||
|
|
18df6ed85f | ||
|
|
128d9da8a1 | ||
|
|
75c2e934da | ||
|
|
c614b9d9b1 | ||
|
|
026fa514c3 | ||
|
|
6ea8ff3a17 | ||
|
|
005566c6e3 | ||
|
|
dee536f7f7 | ||
|
|
fbff32c5d7 | ||
|
|
d1808405ca | ||
|
|
3817e40f47 | ||
|
|
270238e060 | ||
|
|
75ac4a2f58 | ||
|
|
acb798b58b | ||
|
|
b1ec110aa3 | ||
|
|
b34a10aee7 | ||
|
|
0192baed42 | ||
|
|
ecb56f1e88 | ||
|
|
1b32088c2d | ||
|
|
4b7a808a9f | ||
|
|
065b48177b | ||
|
|
8608103c9f | ||
|
|
a9301a6c16 | ||
|
|
29f0d22713 | ||
|
|
f3eb07408d | ||
|
|
4418b59b47 | ||
|
|
616e8df8d0 | ||
|
|
74cd73bd6c | ||
|
|
c510ea4b3d | ||
|
|
09704951f0 | ||
|
|
47a85e880b | ||
|
|
b59719a6ea | ||
|
|
dad677f63d | ||
|
|
6434c86afd | ||
|
|
ebc9bcda44 | ||
|
|
69c3f567ce | ||
|
|
8c2de11ac2 | ||
|
|
a2177570b3 | ||
|
|
40731ed52d | ||
|
|
c0abeceb85 | ||
|
|
c74ed98282 | ||
|
|
71b33db7ee | ||
|
|
07a5920b2f | ||
|
|
72da3b2c76 | ||
|
|
5954daea18 | ||
|
|
4a1c70f2f1 | ||
|
|
e73143d777 | ||
|
|
a0350c6533 | ||
|
|
bceae5695e | ||
|
|
9cc5513a1c | ||
|
|
20692aa891 | ||
|
|
35f5852cc0 | ||
|
|
134dc98a71 | ||
|
|
8386a6eaaf | ||
|
|
611a60411b | ||
|
|
b1564d8002 | ||
|
|
b14f99df92 | ||
|
|
5ab1badbef | ||
|
|
9b6e6b3e49 | ||
|
|
b5867ebf2b | ||
|
|
020415facc | ||
|
|
b457c3de70 | ||
|
|
1a654eba5c | ||
|
|
56105fbbe6 | ||
|
|
55252f4b25 | ||
|
|
21cbd1ab71 | ||
|
|
6310ecdb0f | ||
|
|
0dcd8b42b0 | ||
|
|
ec835fbd94 | ||
|
|
0f8f18e727 | ||
|
|
80121aa88f | ||
|
|
c7100b9e61 |
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -21,5 +21,5 @@
|
|||||||
./bin/utils/ensure-up-to-date
|
./bin/utils/ensure-up-to-date
|
||||||
```
|
```
|
||||||
Commit all changed files.
|
Commit all changed files.
|
||||||
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master` (6.3.0) (minor release - breaking changes with fallbacks), `7.0.x` (breaking changes without fallbacks)
|
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master` (7.0.1 - patch release), `7.1.x` (minor release - breaking changes with fallbacks), `8.0.x` (breaking changes without fallbacks)
|
||||||
- [ ] If your PR is targeting a particular programming language, @mention the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) members, so they are more likely to review the pull request.
|
- [ ] If your PR is targeting a particular programming language, @mention the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) members, so they are more likely to review the pull request.
|
||||||
|
|||||||
2
.github/workflows/docker.yaml
vendored
2
.github/workflows/docker.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Test run-in-docker.sh
|
- name: Test run-in-docker.sh
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
2
.github/workflows/gradle-plugin-tests.yaml
vendored
2
.github/workflows/gradle-plugin-tests.yaml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
name: Gradle plugin tests
|
name: Gradle plugin tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
2
.github/workflows/gradle-test.yaml
vendored
2
.github/workflows/gradle-test.yaml
vendored
@@ -30,7 +30,7 @@ jobs:
|
|||||||
- samples/client/petstore/java/okhttp-gson-group-parameter
|
- samples/client/petstore/java/okhttp-gson-group-parameter
|
||||||
- samples/client/petstore/java/webclient-swagger2
|
- samples/client/petstore/java/webclient-swagger2
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
4
.github/workflows/linux.yaml
vendored
4
.github/workflows/linux.yaml
vendored
@@ -20,7 +20,7 @@ jobs:
|
|||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up JDK ${{ matrix.java }}
|
- name: Set up JDK ${{ matrix.java }}
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
@@ -85,7 +85,7 @@ jobs:
|
|||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Setup Maven
|
- name: Setup Maven
|
||||||
uses: s4u/setup-maven-action@v1.9.0
|
uses: s4u/setup-maven-action@v1.9.0
|
||||||
with:
|
with:
|
||||||
|
|||||||
2
.github/workflows/maven-plugin-tests.yaml
vendored
2
.github/workflows/maven-plugin-tests.yaml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
name: Maven plugin tests
|
name: Maven plugin tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
2
.github/workflows/misc-test.yaml
vendored
2
.github/workflows/misc-test.yaml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
name: Misc tests
|
name: Misc tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: ruby/setup-ruby@v1
|
- uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: '2.6'
|
ruby-version: '2.6'
|
||||||
|
|||||||
8
.github/workflows/openapi-generator.yaml
vendored
8
.github/workflows/openapi-generator.yaml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@@ -53,7 +53,7 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- build
|
- build
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@@ -90,7 +90,7 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- build
|
- build
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@@ -129,7 +129,7 @@ jobs:
|
|||||||
- build
|
- build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
name: Build c libcurl client
|
name: Build c libcurl client
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|||||||
2
.github/workflows/samples-cpp-qt-client.yaml
vendored
2
.github/workflows/samples-cpp-qt-client.yaml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
tools: 'tools_openssl_x64'
|
tools: 'tools_openssl_x64'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: jurplel/install-qt-action@v3
|
- uses: jurplel/install-qt-action@v3
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.qt-version }}
|
version: ${{ matrix.qt-version }}
|
||||||
|
|||||||
2
.github/workflows/samples-dart.yaml
vendored
2
.github/workflows/samples-dart.yaml
vendored
@@ -17,7 +17,7 @@ jobs:
|
|||||||
name: Tests Dart
|
name: Tests Dart
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ jobs:
|
|||||||
# clients
|
# clients
|
||||||
- samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0
|
- samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-dotnet@v3.2.0
|
- uses: actions/setup-dotnet@v3.2.0
|
||||||
with:
|
with:
|
||||||
dotnet-version: 3.1.*
|
dotnet-version: 3.1.*
|
||||||
|
|||||||
2
.github/workflows/samples-dotnet.yaml
vendored
2
.github/workflows/samples-dotnet.yaml
vendored
@@ -42,7 +42,7 @@ jobs:
|
|||||||
- samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse
|
- samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse
|
||||||
- samples/server/petstore/aspnetcore-6.0-nullableReferenceTypes
|
- samples/server/petstore/aspnetcore-6.0-nullableReferenceTypes
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-dotnet@v3.2.0
|
- uses: actions/setup-dotnet@v3.2.0
|
||||||
with:
|
with:
|
||||||
dotnet-version: '7.0.x'
|
dotnet-version: '7.0.x'
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ jobs:
|
|||||||
# clients
|
# clients
|
||||||
- samples/client/echo_api/csharp-restsharp/
|
- samples/client/echo_api/csharp-restsharp/
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-dotnet@v3.2.0
|
- uses: actions/setup-dotnet@v3.2.0
|
||||||
with:
|
with:
|
||||||
dotnet-version: '6.0.x'
|
dotnet-version: '6.0.x'
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ jobs:
|
|||||||
# build C# API client (property, parameter name mappings)
|
# build C# API client (property, parameter name mappings)
|
||||||
- samples/client/petstore/csharp-restsharp-name-parameter-mappings
|
- samples/client/petstore/csharp-restsharp-name-parameter-mappings
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-dotnet@v3.2.0
|
- uses: actions/setup-dotnet@v3.2.0
|
||||||
with:
|
with:
|
||||||
dotnet-version: '6.0.x'
|
dotnet-version: '6.0.x'
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ jobs:
|
|||||||
- samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse
|
- samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse
|
||||||
- samples/server/petstore/aspnetcore-6.0-nullableReferenceTypes
|
- samples/server/petstore/aspnetcore-6.0-nullableReferenceTypes
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-dotnet@v3.2.0
|
- uses: actions/setup-dotnet@v3.2.0
|
||||||
with:
|
with:
|
||||||
dotnet-version: '6.0.x'
|
dotnet-version: '6.0.x'
|
||||||
|
|||||||
2
.github/workflows/samples-elm.yaml
vendored
2
.github/workflows/samples-elm.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
|||||||
- samples/client/petstore/elm
|
- samples/client/petstore/elm
|
||||||
- samples/openapi3/client/elm
|
- samples/openapi3/client/elm
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: jorelali/setup-elm@v5
|
- uses: jorelali/setup-elm@v5
|
||||||
with:
|
with:
|
||||||
elm-version: 0.19.1
|
elm-version: 0.19.1
|
||||||
|
|||||||
2
.github/workflows/samples-erlang.yaml
vendored
2
.github/workflows/samples-erlang.yaml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
- samples/client/petstore/erlang-client/
|
- samples/client/petstore/erlang-client/
|
||||||
- samples/client/petstore/erlang-proper/
|
- samples/client/petstore/erlang-proper/
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: erlef/setup-beam@v1
|
- uses: erlef/setup-beam@v1
|
||||||
with:
|
with:
|
||||||
otp-version: '22.2'
|
otp-version: '22.2'
|
||||||
|
|||||||
2
.github/workflows/samples-go.yaml
vendored
2
.github/workflows/samples-go.yaml
vendored
@@ -24,7 +24,7 @@ jobs:
|
|||||||
- samples/server/petstore/go-api-server/
|
- samples/server/petstore/go-api-server/
|
||||||
- samples/server/petstore/go-chi-server/
|
- samples/server/petstore/go-chi-server/
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "stable"
|
go-version: "stable"
|
||||||
|
|||||||
2
.github/workflows/samples-groovy.yaml
vendored
2
.github/workflows/samples-groovy.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
|||||||
sample:
|
sample:
|
||||||
- samples/client/petstore/groovy
|
- samples/client/petstore/groovy
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
2
.github/workflows/samples-haskell.yaml
vendored
2
.github/workflows/samples-haskell.yaml
vendored
@@ -24,7 +24,7 @@ jobs:
|
|||||||
- samples/server/petstore/haskell-servant/
|
- samples/server/petstore/haskell-servant/
|
||||||
- samples/client/petstore/haskell-http-client/
|
- samples/client/petstore/haskell-http-client/
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: haskell/actions/setup@v2
|
- uses: haskell/actions/setup@v2
|
||||||
with:
|
with:
|
||||||
# ghc-version: '8.8.4' # Exact version of ghc to use
|
# ghc-version: '8.8.4' # Exact version of ghc to use
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ jobs:
|
|||||||
- samples/client/echo_api/java/native
|
- samples/client/echo_api/java/native
|
||||||
- samples/client/echo_api/java/feign-gson
|
- samples/client/echo_api/java/feign-gson
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
- samples/client/echo_api/java/feign-gson
|
- samples/client/echo_api/java/feign-gson
|
||||||
- samples/client/echo_api/java/okhttp-gson
|
- samples/client/echo_api/java/okhttp-gson
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ jobs:
|
|||||||
- samples/client/petstore/java/webclient-swagger2
|
- samples/client/petstore/java/webclient-swagger2
|
||||||
- samples/client/petstore/java/vertx
|
- samples/client/petstore/java/vertx
|
||||||
- samples/client/petstore/java/jersey2-java8-localdatetime
|
- samples/client/petstore/java/jersey2-java8-localdatetime
|
||||||
- samples/client/petstore/java/resteasy
|
|
||||||
- samples/client/petstore/java/google-api-client
|
- samples/client/petstore/java/google-api-client
|
||||||
- samples/client/petstore/java/rest-assured
|
- samples/client/petstore/java/rest-assured
|
||||||
- samples/client/petstore/java/rest-assured-jackson
|
- samples/client/petstore/java/rest-assured-jackson
|
||||||
@@ -63,7 +62,7 @@ jobs:
|
|||||||
- samples/client/petstore/java/resttemplate-swagger2/
|
- samples/client/petstore/java/resttemplate-swagger2/
|
||||||
- samples/openapi3/client/petstore/java/jersey2-java8-swagger2/
|
- samples/openapi3/client/petstore/java/jersey2-java8-swagger2/
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
@@ -78,4 +77,4 @@ jobs:
|
|||||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||||
- name: Build
|
- name: Build
|
||||||
working-directory: ${{ matrix.sample }}
|
working-directory: ${{ matrix.sample }}
|
||||||
run: mvn clean package
|
run: mvn clean package
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
- samples/client/petstore/java/resttemplate-jakarta
|
- samples/client/petstore/java/resttemplate-jakarta
|
||||||
- samples/client/petstore/java/webclient-jakarta
|
- samples/client/petstore/java/webclient-jakarta
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
2
.github/workflows/samples-java-helidon.yaml
vendored
2
.github/workflows/samples-java-helidon.yaml
vendored
@@ -23,7 +23,7 @@ jobs:
|
|||||||
- samples/server/petstore/java-helidon-server/se
|
- samples/server/petstore/java-helidon-server/se
|
||||||
version: [17]
|
version: [17]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ jobs:
|
|||||||
- samples/server/petstore/java-play-framework-no-swagger-ui
|
- samples/server/petstore/java-play-framework-no-swagger-ui
|
||||||
- samples/server/petstore/java-play-framework-no-wrap-calls
|
- samples/server/petstore/java-play-framework-no-wrap-calls
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
- samples/server/petstore/java-pkmst/
|
- samples/server/petstore/java-pkmst/
|
||||||
- samples/server/petstore/java-undertow/
|
- samples/server/petstore/java-undertow/
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
2
.github/workflows/samples-jaxrs.yaml
vendored
2
.github/workflows/samples-jaxrs.yaml
vendored
@@ -40,7 +40,7 @@ jobs:
|
|||||||
- samples/server/petstore/jaxrs-cxf-non-spring-app
|
- samples/server/petstore/jaxrs-cxf-non-spring-app
|
||||||
- samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations
|
- samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
2
.github/workflows/samples-jdk17.yaml
vendored
2
.github/workflows/samples-jdk17.yaml
vendored
@@ -45,7 +45,7 @@ jobs:
|
|||||||
- samples/client/petstore/spring-http-interface-reactive
|
- samples/client/petstore/spring-http-interface-reactive
|
||||||
- samples/client/petstore/spring-http-interface
|
- samples/client/petstore/spring-http-interface
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
2
.github/workflows/samples-julia.yaml
vendored
2
.github/workflows/samples-julia.yaml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
name: Tests Julia
|
name: Tests Julia
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: julia-actions/setup-julia@v1
|
- uses: julia-actions/setup-julia@v1
|
||||||
with:
|
with:
|
||||||
version: 1.8
|
version: 1.8
|
||||||
|
|||||||
2
.github/workflows/samples-kotlin-client.yaml
vendored
2
.github/workflows/samples-kotlin-client.yaml
vendored
@@ -65,7 +65,7 @@ jobs:
|
|||||||
- samples/client/petstore/kotlin-name-parameter-mappings
|
- samples/client/petstore/kotlin-name-parameter-mappings
|
||||||
- samples/client/others/kotlin-jvm-okhttp-parameter-tests
|
- samples/client/others/kotlin-jvm-okhttp-parameter-tests
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
# comment out due to gradle build failure
|
# comment out due to gradle build failure
|
||||||
# - samples/server/petstore/kotlin-spring-default/
|
# - samples/server/petstore/kotlin-spring-default/
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
2
.github/workflows/samples-kotlin-server.yaml
vendored
2
.github/workflows/samples-kotlin-server.yaml
vendored
@@ -43,7 +43,7 @@ jobs:
|
|||||||
# no build.gradle file
|
# no build.gradle file
|
||||||
#- samples/server/petstore/kotlin-vertx-modelMutable
|
#- samples/server/petstore/kotlin-vertx-modelMutable
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
2
.github/workflows/samples-php7.yaml
vendored
2
.github/workflows/samples-php7.yaml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
# servers
|
# servers
|
||||||
- samples/server/petstore/php-laravel/lib/
|
- samples/server/petstore/php-laravel/lib/
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Setup PHP with tools
|
- name: Setup PHP with tools
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
2
.github/workflows/samples-php8.yaml
vendored
2
.github/workflows/samples-php8.yaml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
# servers
|
# servers
|
||||||
- samples/server/petstore/php-symfony/SymfonyBundle-php/
|
- samples/server/petstore/php-symfony/SymfonyBundle-php/
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Setup PHP with tools
|
- name: Setup PHP with tools
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ jobs:
|
|||||||
# clients
|
# clients
|
||||||
- samples/client/echo_api/python
|
- samples/client/echo_api/python
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.7'
|
python-version: '3.7'
|
||||||
|
|||||||
2
.github/workflows/samples-python-server.yaml
vendored
2
.github/workflows/samples-python-server.yaml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
# servers
|
# servers
|
||||||
- samples/server/petstore/python-aiohttp/
|
- samples/server/petstore/python-aiohttp/
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.7'
|
python-version: '3.7'
|
||||||
|
|||||||
2
.github/workflows/samples-rust.yaml
vendored
2
.github/workflows/samples-rust.yaml
vendored
@@ -25,7 +25,7 @@ jobs:
|
|||||||
- samples/client/petstore/rust/
|
- samples/client/petstore/rust/
|
||||||
- samples/server/petstore/rust-server/
|
- samples/server/petstore/rust-server/
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
|
|||||||
2
.github/workflows/samples-scala.yaml
vendored
2
.github/workflows/samples-scala.yaml
vendored
@@ -31,7 +31,7 @@ jobs:
|
|||||||
- samples/server/petstore/scalatra
|
- samples/server/petstore/scalatra
|
||||||
- samples/server/petstore/scala-finch # cannot be tested with jdk11
|
- samples/server/petstore/scala-finch # cannot be tested with jdk11
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
2
.github/workflows/samples-spring-jdk17.yaml
vendored
2
.github/workflows/samples-spring-jdk17.yaml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
# clients
|
# clients
|
||||||
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
|
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
9
.github/workflows/samples-spring.yaml
vendored
9
.github/workflows/samples-spring.yaml
vendored
@@ -3,10 +3,16 @@ name: Samples Java Spring
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
|
# clients
|
||||||
|
- 'samples/client/petstore/spring*/**'
|
||||||
|
# servers
|
||||||
- 'samples/server/petstore/spring*/**'
|
- 'samples/server/petstore/spring*/**'
|
||||||
- 'samples/openapi3/server/petstore/spring*/**'
|
- 'samples/openapi3/server/petstore/spring*/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
|
# clients
|
||||||
|
- 'samples/client/petstore/spring*/**'
|
||||||
|
# servers
|
||||||
- 'samples/server/petstore/spring*/**'
|
- 'samples/server/petstore/spring*/**'
|
||||||
- 'samples/openapi3/server/petstore/spring*/**'
|
- 'samples/openapi3/server/petstore/spring*/**'
|
||||||
jobs:
|
jobs:
|
||||||
@@ -27,6 +33,7 @@ jobs:
|
|||||||
- samples/openapi3/client/petstore/spring-cloud-async
|
- samples/openapi3/client/petstore/spring-cloud-async
|
||||||
- samples/openapi3/client/petstore/spring-cloud-spring-pageable
|
- samples/openapi3/client/petstore/spring-cloud-spring-pageable
|
||||||
- samples/client/petstore/spring-cloud-tags
|
- samples/client/petstore/spring-cloud-tags
|
||||||
|
- samples/client/petstore/spring-cloud-deprecated
|
||||||
# servers
|
# servers
|
||||||
- samples/server/petstore/springboot
|
- samples/server/petstore/springboot
|
||||||
- samples/openapi3/server/petstore/springboot
|
- samples/openapi3/server/petstore/springboot
|
||||||
@@ -49,7 +56,7 @@ jobs:
|
|||||||
- samples/server/petstore/springboot-spring-pageable-without-j8
|
- samples/server/petstore/springboot-spring-pageable-without-j8
|
||||||
- samples/server/petstore/springboot-spring-pageable
|
- samples/server/petstore/springboot-spring-pageable
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|||||||
2
.github/workflows/samples-swift.yaml
vendored
2
.github/workflows/samples-swift.yaml
vendored
@@ -40,7 +40,7 @@ jobs:
|
|||||||
name: Build Swift samples
|
name: Build Swift samples
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: swift-actions/setup-swift@v1
|
- uses: swift-actions/setup-swift@v1
|
||||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
with:
|
with:
|
||||||
|
|||||||
2
.github/workflows/samples-zapier.yaml
vendored
2
.github/workflows/samples-zapier.yaml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
sample:
|
sample:
|
||||||
- samples/client/petstore/zapier
|
- samples/client/petstore/zapier
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|||||||
2
.github/workflows/sonar.yml
vendored
2
.github/workflows/sonar.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.repository_owner == 'OpenAPITools' }}
|
if: ${{ github.repository_owner == 'OpenAPITools' }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
2
.github/workflows/windows.yaml
vendored
2
.github/workflows/windows.yaml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
java: [11, 17]
|
java: [11, 17]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Set up JDK ${{ matrix.java }}
|
- name: Set up JDK ${{ matrix.java }}
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -89,6 +89,7 @@ samples/client/petstore/cpp-restsdk/cmake_install.cmake
|
|||||||
**/.gradle
|
**/.gradle
|
||||||
samples/client/petstore/java/hello.txt
|
samples/client/petstore/java/hello.txt
|
||||||
samples/client/petstore/java/okhttp-gson/hello.txt
|
samples/client/petstore/java/okhttp-gson/hello.txt
|
||||||
|
samples/client/petstore/java/okhttp-gson-3.1/hello.txt
|
||||||
samples/client/petstore/java/jersey1/hello.txt
|
samples/client/petstore/java/jersey1/hello.txt
|
||||||
samples/client/petstore/java/jersey2-java8/hello.txt
|
samples/client/petstore/java/jersey2-java8/hello.txt
|
||||||
samples/client/petstore/java/jersey2/hello.txt
|
samples/client/petstore/java/jersey2/hello.txt
|
||||||
@@ -183,6 +184,7 @@ samples/client/petstore/python-asyncio/.pytest_cache/
|
|||||||
|
|
||||||
# PHP
|
# PHP
|
||||||
samples/client/petstore/php/OpenAPIClient-php/composer.lock
|
samples/client/petstore/php/OpenAPIClient-php/composer.lock
|
||||||
|
samples/client/petstore/php-nextgen/OpenAPIClient-php/composer.lock
|
||||||
samples/client/petstore/php-dt/composer.lock
|
samples/client/petstore/php-dt/composer.lock
|
||||||
samples/client/petstore/php-dt-modern/composer.lock
|
samples/client/petstore/php-dt-modern/composer.lock
|
||||||
samples/openapi3/server/petstore/php-symfony/SymfonyBundle-php/composer.lock
|
samples/openapi3/server/petstore/php-symfony/SymfonyBundle-php/composer.lock
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.0.0`):
|
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.0.1`):
|
||||||
[](https://app.travis-ci.com/github/OpenAPITools/openapi-generator/builds)
|
[](https://app.travis-ci.com/github/OpenAPITools/openapi-generator/builds)
|
||||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
|
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
|
||||||
@@ -1168,7 +1168,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
|||||||
| Perl | @wing328 (2017/07) [:heart:](https://www.patreon.com/wing328) @yue9944882 (2019/06) |
|
| Perl | @wing328 (2017/07) [:heart:](https://www.patreon.com/wing328) @yue9944882 (2019/06) |
|
||||||
| PHP | @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), [@ybelenko](https://github.com/ybelenko) (2018/07), @renepardon (2018/12) |
|
| PHP | @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), [@ybelenko](https://github.com/ybelenko) (2018/07), @renepardon (2018/12) |
|
||||||
| PowerShell | @wing328 (2020/05) |
|
| PowerShell | @wing328 (2020/05) |
|
||||||
| Python | @spacether (2019/11) [:heart:][spacether sponsorship] @krjakbrjak (2023/02) |
|
| Python | @krjakbrjak (2023/02) |
|
||||||
| R | @Ramanth (2019/07) @saigiridhar21 (2019/07) |
|
| R | @Ramanth (2019/07) @saigiridhar21 (2019/07) |
|
||||||
| Ruby | @cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) |
|
| Ruby | @cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) |
|
||||||
| Rust | @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) @jacob-pro (2022/10) |
|
| Rust | @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) @jacob-pro (2022/10) |
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# for csharp generichost
|
||||||
|
generatorName: csharp
|
||||||
|
outputDir: samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
|
||||||
|
library: generichost
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||||
|
additionalProperties:
|
||||||
|
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
|
||||||
|
useCompareNetObjects: true
|
||||||
|
disallowAdditionalPropertiesIfNotPresent: false
|
||||||
|
useSourceGeneration: true
|
||||||
|
packageName: UseSourceGeneration
|
||||||
@@ -6,3 +6,8 @@ templateDir: modules/openapi-generator/src/main/resources/Java
|
|||||||
additionalProperties:
|
additionalProperties:
|
||||||
artifactId: echo-api-native
|
artifactId: echo-api-native
|
||||||
hideGenerationTimestamp: "true"
|
hideGenerationTimestamp: "true"
|
||||||
|
|
||||||
|
typeMappings:
|
||||||
|
OffsetDateTime: "Instant"
|
||||||
|
importMappings:
|
||||||
|
OffsetDateTime: "java.time.Instant"
|
||||||
|
|||||||
16
bin/configs/java-okhttp-gson-3.1.yaml
Normal file
16
bin/configs/java-okhttp-gson-3.1.yaml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
generatorName: java
|
||||||
|
outputDir: samples/client/petstore/java/okhttp-gson-3.1
|
||||||
|
library: okhttp-gson
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/3_1/java/petstore.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||||
|
nameMappings:
|
||||||
|
_type: underscoreType
|
||||||
|
type_: typeWithUnderscore
|
||||||
|
parameterNameMappings:
|
||||||
|
_type: underscoreType
|
||||||
|
type_: typeWithUnderscore
|
||||||
|
additionalProperties:
|
||||||
|
artifactId: petstore-okhttp-gson-31
|
||||||
|
hideGenerationTimestamp: "true"
|
||||||
|
useOneOfDiscriminatorLookup: "true"
|
||||||
|
disallowAdditionalPropertiesIfNotPresent: false
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
generatorName: java
|
generatorName: java
|
||||||
outputDir: samples/client/petstore/java/resteasy
|
outputDir: samples/client/petstore/java/resteasy
|
||||||
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/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
artifactId: petstore-resteasy
|
artifactId: petstore-resteasy
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
generatorName: java
|
generatorName: java
|
||||||
outputDir: samples/client/petstore/java/resttemplate-withXml
|
outputDir: samples/client/petstore/java/resttemplate-withXml
|
||||||
library: resttemplate
|
library: resttemplate
|
||||||
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/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
java8: true
|
java8: true
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
generatorName: java
|
generatorName: java
|
||||||
outputDir: samples/client/petstore/java/resttemplate
|
outputDir: samples/client/petstore/java/resttemplate
|
||||||
library: resttemplate
|
library: resttemplate
|
||||||
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/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
artifactId: petstore-resttemplate
|
artifactId: petstore-resttemplate
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
generatorName: java
|
generatorName: java
|
||||||
outputDir: samples/client/petstore/java/vertx
|
outputDir: samples/client/petstore/java/vertx
|
||||||
library: vertx
|
library: vertx
|
||||||
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/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
artifactId: petstore-vertx
|
artifactId: petstore-vertx
|
||||||
|
|||||||
@@ -4,3 +4,5 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
|||||||
templateDir: modules/openapi-generator/src/main/resources/lua
|
templateDir: modules/openapi-generator/src/main/resources/lua
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
packageName: petstore
|
packageName: petstore
|
||||||
|
nameMappings:
|
||||||
|
phone: mobile
|
||||||
|
|||||||
@@ -4,3 +4,7 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-e
|
|||||||
templateDir: modules/openapi-generator/src/main/resources/perl
|
templateDir: modules/openapi-generator/src/main/resources/perl
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
hideGenerationTimestamp: "true"
|
hideGenerationTimestamp: "true"
|
||||||
|
nameMappings:
|
||||||
|
NullableMessage: system_message
|
||||||
|
modelNameMappings:
|
||||||
|
DeprecatedObject: DeprecatedModel
|
||||||
|
|||||||
4
bin/configs/php-nextgen.yaml
Normal file
4
bin/configs/php-nextgen.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
generatorName: php-nextgen
|
||||||
|
outputDir: samples/client/petstore/php-nextgen/OpenAPIClient-php
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/php-nextgen
|
||||||
@@ -14,3 +14,7 @@ additionalProperties:
|
|||||||
projectUri: https://github.com/OpenAPITools/openapi-generator
|
projectUri: https://github.com/OpenAPITools/openapi-generator
|
||||||
releaseNotes: 'This is a sample project'
|
releaseNotes: 'This is a sample project'
|
||||||
tags: 'PetStore,powershell,sdk'
|
tags: 'PetStore,powershell,sdk'
|
||||||
|
nameMappings:
|
||||||
|
name_mapping: SomethingElse
|
||||||
|
modelNameMappings:
|
||||||
|
model-mapping: NewModel
|
||||||
|
|||||||
13
bin/configs/spring-cloud-deprecated-oas3.yaml
Normal file
13
bin/configs/spring-cloud-deprecated-oas3.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
generatorName: spring
|
||||||
|
library: spring-cloud
|
||||||
|
outputDir: samples/client/petstore/spring-cloud-deprecated
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-deprecated-fields.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||||
|
additionalProperties:
|
||||||
|
groupId: org.openapitools.openapi3
|
||||||
|
documentationProvider: springdoc
|
||||||
|
artifactId: spring-cloud-deprecated
|
||||||
|
interfaceOnly: "true"
|
||||||
|
singleContentTypes: "true"
|
||||||
|
hideGenerationTimestamp: "true"
|
||||||
|
useTags: "true"
|
||||||
@@ -50,6 +50,7 @@ The following generators are available:
|
|||||||
* [perl](generators/perl.md)
|
* [perl](generators/perl.md)
|
||||||
* [php](generators/php.md)
|
* [php](generators/php.md)
|
||||||
* [php-dt (beta)](generators/php-dt.md)
|
* [php-dt (beta)](generators/php-dt.md)
|
||||||
|
* [php-nextgen (beta)](generators/php-nextgen.md)
|
||||||
* [powershell (beta)](generators/powershell.md)
|
* [powershell (beta)](generators/powershell.md)
|
||||||
* [python](generators/python.md)
|
* [python](generators/python.md)
|
||||||
* [r](generators/r.md)
|
* [r](generators/r.md)
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
||||||
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |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|
|
|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|
|
||||||
|
|useSourceGeneration|Use source generation where available (only `generichost` library supports this option).| |false|
|
||||||
|validatable|Generates self-validatable models.| |true|
|
|validatable|Generates self-validatable models.| |true|
|
||||||
|zeroBasedEnums|Enumerations with string values will start from 0 when true, 1 when false. If not set, enumerations with string values will start from 0 if the first value is 'unknown', case insensitive.| |null|
|
|zeroBasedEnums|Enumerations with string values will start from 0 when true, 1 when false. If not set, enumerations with string values will start from 0 if the first value is 'unknown', case insensitive.| |null|
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|
||||||
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries| |false|
|
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries| |false|
|
||||||
|useBeanValidation|Use BeanValidation API annotations| |false|
|
|useBeanValidation|Use BeanValidation API annotations| |false|
|
||||||
|
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
|
||||||
|useGzipFeature|Send gzip-encoded requests| |false|
|
|useGzipFeature|Send gzip-encoded requests| |false|
|
||||||
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |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. Only jersey2, jersey3, native, okhttp-gson support this option.| |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. Only jersey2, jersey3, native, okhttp-gson support this option.| |false|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|interfaceOnly|Whether to generate only API interface stubs without the server files. This option is currently supported only when using jaxrs-spec library.| |false|
|
|interfaceOnly|Whether to generate only API interface stubs without the server files. This option is currently supported only when using jaxrs-spec library.| |false|
|
||||||
|library|library template (sub-template)|<dl><dt>**ktor**</dt><dd>ktor framework</dd><dt>**jaxrs-spec**</dt><dd>JAX-RS spec only</dd></dl>|ktor|
|
|library|library template (sub-template)|<dl><dt>**ktor**</dt><dd>ktor framework</dd><dt>**jaxrs-spec**</dt><dd>JAX-RS spec only</dd></dl>|ktor|
|
||||||
|modelMutable|Create mutable models| |false|
|
|modelMutable|Create mutable models| |false|
|
||||||
|
|omitGradleWrapper|Whether to omit Gradle wrapper for creating a sub project.| |false|
|
||||||
|packageName|Generated artifact package name.| |org.openapitools.server|
|
|packageName|Generated artifact package name.| |org.openapitools.server|
|
||||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||||
|returnResponse|Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true. This option is currently supported only when using jaxrs-spec library.| |false|
|
|returnResponse|Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true. This option is currently supported only when using jaxrs-spec library.| |false|
|
||||||
|
|||||||
269
docs/generators/php-nextgen.md
Normal file
269
docs/generators/php-nextgen.md
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
---
|
||||||
|
title: Documentation for the php-nextgen Generator
|
||||||
|
---
|
||||||
|
|
||||||
|
## METADATA
|
||||||
|
|
||||||
|
| Property | Value | Notes |
|
||||||
|
| -------- | ----- | ----- |
|
||||||
|
| generator name | php-nextgen | pass this to the generate command after -g |
|
||||||
|
| generator stability | BETA | |
|
||||||
|
| generator type | CLIENT | |
|
||||||
|
| generator language | PHP | |
|
||||||
|
| generator default templating engine | mustache | |
|
||||||
|
| helpTxt | Generates a PHP client library (beta). | |
|
||||||
|
|
||||||
|
## CONFIG OPTIONS
|
||||||
|
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|
|
||||||
|
|apiPackage|package for generated api classes| |null|
|
||||||
|
|artifactUrl|artifact URL in generated pom.xml| |null|
|
||||||
|
|artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null|
|
||||||
|
|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`).| |null|
|
||||||
|
|developerOrganization|developer organization in generated pom.xml| |null|
|
||||||
|
|developerOrganizationUrl|developer organization URL in generated pom.xml| |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|
|
||||||
|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|
||||||
|
|hideGenerationTimestamp|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |true|
|
||||||
|
|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null|
|
||||||
|
|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|
|
||||||
|
|licenseName|The name of the license| |null|
|
||||||
|
|modelPackage|package for generated models| |null|
|
||||||
|
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
|
||||||
|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||||
|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||||
|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||||
|
|srcBasePath|The directory to serve as source root.| |null|
|
||||||
|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |snake_case|
|
||||||
|
|
||||||
|
## IMPORT MAPPING
|
||||||
|
|
||||||
|
| Type/Alias | Imports |
|
||||||
|
| ---------- | ------- |
|
||||||
|
|
||||||
|
|
||||||
|
## INSTANTIATION TYPES
|
||||||
|
|
||||||
|
| Type/Alias | Instantiated By |
|
||||||
|
| ---------- | --------------- |
|
||||||
|
|array|array|
|
||||||
|
|map|array|
|
||||||
|
|
||||||
|
|
||||||
|
## LANGUAGE PRIMITIVES
|
||||||
|
|
||||||
|
<ul class="column-ul">
|
||||||
|
<li>\DateTime</li>
|
||||||
|
<li>\SplFileObject</li>
|
||||||
|
<li>array</li>
|
||||||
|
<li>bool</li>
|
||||||
|
<li>boolean</li>
|
||||||
|
<li>byte</li>
|
||||||
|
<li>float</li>
|
||||||
|
<li>int</li>
|
||||||
|
<li>integer</li>
|
||||||
|
<li>mixed</li>
|
||||||
|
<li>number</li>
|
||||||
|
<li>object</li>
|
||||||
|
<li>string</li>
|
||||||
|
<li>void</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
## RESERVED WORDS
|
||||||
|
|
||||||
|
<ul class="column-ul">
|
||||||
|
<li>__halt_compiler</li>
|
||||||
|
<li>_header_accept</li>
|
||||||
|
<li>_tempbody</li>
|
||||||
|
<li>abstract</li>
|
||||||
|
<li>and</li>
|
||||||
|
<li>array</li>
|
||||||
|
<li>as</li>
|
||||||
|
<li>break</li>
|
||||||
|
<li>callable</li>
|
||||||
|
<li>case</li>
|
||||||
|
<li>catch</li>
|
||||||
|
<li>class</li>
|
||||||
|
<li>clone</li>
|
||||||
|
<li>const</li>
|
||||||
|
<li>continue</li>
|
||||||
|
<li>declare</li>
|
||||||
|
<li>default</li>
|
||||||
|
<li>die</li>
|
||||||
|
<li>do</li>
|
||||||
|
<li>echo</li>
|
||||||
|
<li>else</li>
|
||||||
|
<li>elseif</li>
|
||||||
|
<li>empty</li>
|
||||||
|
<li>enddeclare</li>
|
||||||
|
<li>endfor</li>
|
||||||
|
<li>endforeach</li>
|
||||||
|
<li>endif</li>
|
||||||
|
<li>endswitch</li>
|
||||||
|
<li>endwhile</li>
|
||||||
|
<li>eval</li>
|
||||||
|
<li>exit</li>
|
||||||
|
<li>extends</li>
|
||||||
|
<li>final</li>
|
||||||
|
<li>for</li>
|
||||||
|
<li>foreach</li>
|
||||||
|
<li>formparams</li>
|
||||||
|
<li>function</li>
|
||||||
|
<li>global</li>
|
||||||
|
<li>goto</li>
|
||||||
|
<li>headerparams</li>
|
||||||
|
<li>httpbody</li>
|
||||||
|
<li>if</li>
|
||||||
|
<li>implements</li>
|
||||||
|
<li>include</li>
|
||||||
|
<li>include_once</li>
|
||||||
|
<li>instanceof</li>
|
||||||
|
<li>insteadof</li>
|
||||||
|
<li>interface</li>
|
||||||
|
<li>isset</li>
|
||||||
|
<li>list</li>
|
||||||
|
<li>namespace</li>
|
||||||
|
<li>new</li>
|
||||||
|
<li>or</li>
|
||||||
|
<li>print</li>
|
||||||
|
<li>private</li>
|
||||||
|
<li>protected</li>
|
||||||
|
<li>public</li>
|
||||||
|
<li>queryparams</li>
|
||||||
|
<li>require</li>
|
||||||
|
<li>require_once</li>
|
||||||
|
<li>resourcepath</li>
|
||||||
|
<li>return</li>
|
||||||
|
<li>static</li>
|
||||||
|
<li>switch</li>
|
||||||
|
<li>throw</li>
|
||||||
|
<li>trait</li>
|
||||||
|
<li>try</li>
|
||||||
|
<li>unset</li>
|
||||||
|
<li>use</li>
|
||||||
|
<li>var</li>
|
||||||
|
<li>while</li>
|
||||||
|
<li>xor</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
|
||||||
|
|Uuid|✗|
|
||||||
|
|Array|✓|OAS2,OAS3
|
||||||
|
|Null|✗|OAS3
|
||||||
|
|AnyType|✗|OAS2,OAS3
|
||||||
|
|Object|✓|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
|
||||||
|
|allOf|✗|OAS2,OAS3
|
||||||
|
|anyOf|✗|OAS3
|
||||||
|
|oneOf|✗|OAS3
|
||||||
|
|not|✗|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
|
||||||
|
|SignatureAuth|✗|OAS3
|
||||||
|
|
||||||
|
### Wire Format Feature
|
||||||
|
| Name | Supported | Defined By |
|
||||||
|
| ---- | --------- | ---------- |
|
||||||
|
|JSON|✓|OAS2,OAS3
|
||||||
|
|XML|✓|OAS2,OAS3
|
||||||
|
|PROTOBUF|✗|ToolingExtension
|
||||||
|
|Custom|✗|OAS2,OAS3
|
||||||
@@ -14,9 +14,9 @@ title: Global Properties
|
|||||||
| verbose | Defines the verbosity | `true` or `false` |
|
| verbose | Defines the verbosity | `true` or `false` |
|
||||||
| generateAliasAsModel | Defines whether primitive types defined at the model/schema level will be wrapped in a model | `true` or `false` |
|
| generateAliasAsModel | Defines whether primitive types defined at the model/schema level will be wrapped in a model | `true` or `false` |
|
||||||
| org.openapitools.codegen.utils.oncelogger.enabled | Enable/disable the "OnceLogger" which reduces noise for select repeated logs | `true` or `false` |
|
| org.openapitools.codegen.utils.oncelogger.enabled | Enable/disable the "OnceLogger" which reduces noise for select repeated logs | `true` or `false` |
|
||||||
| supportingFiles | Allows the user to define which supporting files will be generated. Prefer using the more robust `.openapi-generator-ignore`. | no value, or a comma-separated string of file names |
|
| supportingFiles | Allows the user to define which supporting files will be generated. Prefer using the more robust `.openapi-generator-ignore`. | no value, or a colon-separated string of file names |
|
||||||
| models | Allows the user to define which models will be generated. Prefer using the more robust `.openapi-generator-ignore`. | no value, or a comma-separated string of model names |
|
| models | Allows the user to define which models will be generated. Prefer using the more robust `.openapi-generator-ignore`. | no value, or a colon-separated string of model names |
|
||||||
| apis | Allows the user to define which apis will be generated. Prefer using the more robust `.openapi-generator-ignore`. | no value, or a comma-separated string of api names |
|
| apis | Allows the user to define which apis will be generated. Prefer using the more robust `.openapi-generator-ignore`. | no value, or a colon-separated string of api names |
|
||||||
| apiDocs | Allows the user to define if api docs will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
|
| apiDocs | Allows the user to define if api docs will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
|
||||||
| modelDocs | Allows the user to define if model docs will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
|
| modelDocs | Allows the user to define if model docs will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
|
||||||
| apiTests | Allows the user to define if api tests will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
|
| apiTests | Allows the user to define if api tests will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` |
|
||||||
@@ -40,4 +40,4 @@ and
|
|||||||
java {jar} generate {opts} --global-property=models
|
java {jar} generate {opts} --global-property=models
|
||||||
```
|
```
|
||||||
|
|
||||||
Why the two differing ways to provide the same properties? We previously accepted a `-D` tooling option which resembled Java System Property declaration. In older versions of OpenAPI Generator, the option modified the SystemProperties collection directly and was truly a "system property". This option changed during the 4.x release in an effort to make OpenAPI Generator thread-safe and isolate its configuration via thread locals. We no longer mutate System Properties. In the 4.x release and earlier, specifying the tooling `-D` option with system properties intended for other tools like swagger-parser rather than passing them as true Java System Properties would lead to unexpected behavior for the user; if our tool set the system property _after_ invoking certain code, it would seem to the user like Java System Properties weren't working!
|
Why the two differing ways to provide the same properties? We previously accepted a `-D` tooling option which resembled Java System Property declaration. In older versions of OpenAPI Generator, the option modified the SystemProperties collection directly and was truly a "system property". This option changed during the 4.x release in an effort to make OpenAPI Generator thread-safe and isolate its configuration via thread locals. We no longer mutate System Properties. In the 4.x release and earlier, specifying the tooling `-D` option with system properties intended for other tools like swagger-parser rather than passing them as true Java System Properties would lead to unexpected behavior for the user; if our tool set the system property _after_ invoking certain code, it would seem to the user like Java System Properties weren't working!
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-project</artifactId>
|
<artifactId>openapi-generator-project</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>7.0.0</version>
|
<version>7.0.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<artifactId>openapi-generator-project</artifactId>
|
<artifactId>openapi-generator-project</artifactId>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>7.0.0</version>
|
<version>7.0.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# RELEASE_VERSION
|
# RELEASE_VERSION
|
||||||
openApiGeneratorVersion=7.0.0
|
openApiGeneratorVersion=7.0.1-SNAPSHOT
|
||||||
# /RELEASE_VERSION
|
# /RELEASE_VERSION
|
||||||
|
|
||||||
# BEGIN placeholders
|
# BEGIN placeholders
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-project</artifactId>
|
<artifactId>openapi-generator-project</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>7.0.0</version>
|
<version>7.0.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# RELEASE_VERSION
|
# RELEASE_VERSION
|
||||||
openApiGeneratorVersion=7.0.0
|
openApiGeneratorVersion=7.0.1-SNAPSHOT
|
||||||
# /RELEASE_VERSION
|
# /RELEASE_VERSION
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>7.0.0</version>
|
<version>7.0.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>7.0.0</version>
|
<version>7.0.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>7.0.0</version>
|
<version>7.0.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>7.0.0</version>
|
<version>7.0.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>7.0.0</version>
|
<version>7.0.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>7.0.0</version>
|
<version>7.0.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-project</artifactId>
|
<artifactId>openapi-generator-project</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>7.0.0</version>
|
<version>7.0.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|||||||
@@ -520,15 +520,6 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
"generated-test-sources/openapi" : "generated-sources/openapi");
|
"generated-test-sources/openapi" : "generated-sources/openapi");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cleanupOutput) {
|
|
||||||
try {
|
|
||||||
FileUtils.deleteDirectory(output);
|
|
||||||
LOGGER.info("Previous run output is removed from {}", output);
|
|
||||||
} catch (IOException e) {
|
|
||||||
LOGGER.warn("Failed to clean-up output directory {}", output, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addCompileSourceRootIfConfigured();
|
addCompileSourceRootIfConfigured();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -566,10 +557,19 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cleanupOutput) {
|
||||||
|
try {
|
||||||
|
FileUtils.deleteDirectory(output);
|
||||||
|
LOGGER.info("Previous run output is removed from {}", output);
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.warn("Failed to clean up output directory {}", output, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// attempt to read from config file
|
// attempt to read from config file
|
||||||
CodegenConfigurator configurator = CodegenConfigurator.fromFile(configurationFile);
|
CodegenConfigurator configurator = CodegenConfigurator.fromFile(configurationFile);
|
||||||
|
|
||||||
// if a config file wasn't specified or we were unable to read it
|
// if a config file wasn't specified, or we were unable to read it
|
||||||
if (configurator == null) {
|
if (configurator == null) {
|
||||||
configurator = new CodegenConfigurator();
|
configurator = new CodegenConfigurator();
|
||||||
}
|
}
|
||||||
@@ -938,8 +938,8 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
/**
|
/**
|
||||||
* Calculate openapi specification file hash. If specification is hosted on remote resource it is downloaded first
|
* Calculate openapi specification file hash. If specification is hosted on remote resource it is downloaded first
|
||||||
*
|
*
|
||||||
* @param inputSpecFile - Openapi specification input file to calculate it's hash.
|
* @param inputSpecFile - Openapi specification input file to calculate its hash.
|
||||||
* Does not taken into account if input spec is hosted on remote resource
|
* Does not take into account if input spec is hosted on remote resource
|
||||||
* @return openapi specification file hash
|
* @return openapi specification file hash
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@@ -991,8 +991,8 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get specification hash file
|
* Get specification hash file
|
||||||
* @param inputSpecFile - Openapi specification input file to calculate it's hash.
|
* @param inputSpecFile - Openapi specification input file to calculate its hash.
|
||||||
* Does not taken into account if input spec is hosted on remote resource
|
* Does not take into account if input spec is hosted on remote resource
|
||||||
* @return a file with previously calculated hash
|
* @return a file with previously calculated hash
|
||||||
*/
|
*/
|
||||||
private File getHashFile(File inputSpecFile) {
|
private File getHashFile(File inputSpecFile) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-project</artifactId>
|
<artifactId>openapi-generator-project</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>7.0.0</version>
|
<version>7.0.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-project</artifactId>
|
<artifactId>openapi-generator-project</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>7.0.0</version>
|
<version>7.0.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|||||||
@@ -22,11 +22,13 @@ import io.swagger.v3.parser.core.models.AuthorizationValue;
|
|||||||
|
|
||||||
import org.openapitools.codegen.api.TemplateDefinition;
|
import org.openapitools.codegen.api.TemplateDefinition;
|
||||||
import org.openapitools.codegen.auth.AuthParser;
|
import org.openapitools.codegen.auth.AuthParser;
|
||||||
|
import org.openapitools.codegen.config.GeneratorSettings;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ClientOptInput {
|
public class ClientOptInput {
|
||||||
private CodegenConfig config;
|
private CodegenConfig config;
|
||||||
|
private GeneratorSettings generatorSettings;
|
||||||
private OpenAPI openAPI;
|
private OpenAPI openAPI;
|
||||||
private List<AuthorizationValue> auths;
|
private List<AuthorizationValue> auths;
|
||||||
private List<TemplateDefinition> userDefinedTemplates;
|
private List<TemplateDefinition> userDefinedTemplates;
|
||||||
@@ -36,6 +38,11 @@ public class ClientOptInput {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ClientOptInput generatorSettings(GeneratorSettings generatorSettings) {
|
||||||
|
this.setGeneratorSettings(generatorSettings);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ClientOptInput config(CodegenConfig codegenConfig) {
|
public ClientOptInput config(CodegenConfig codegenConfig) {
|
||||||
this.setConfig(codegenConfig);
|
this.setConfig(codegenConfig);
|
||||||
return this;
|
return this;
|
||||||
@@ -92,6 +99,20 @@ public class ClientOptInput {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public GeneratorSettings getGeneratorSettings() {
|
||||||
|
return generatorSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
private void setGeneratorSettings(GeneratorSettings generatorSettings) {
|
||||||
|
this.generatorSettings = generatorSettings;
|
||||||
|
// TODO: ClientOptInputs needs to be retired
|
||||||
|
if (this.openAPI != null) {
|
||||||
|
this.config.setOpenAPI(this.openAPI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public OpenAPI getOpenAPI() {
|
public OpenAPI getOpenAPI() {
|
||||||
return openAPI;
|
return openAPI;
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ public class CodegenSecurity {
|
|||||||
public CodegenSecurity filterByScopeNames(List<String> filterScopes) {
|
public CodegenSecurity filterByScopeNames(List<String> filterScopes) {
|
||||||
CodegenSecurity filteredSecurity = new CodegenSecurity(this);
|
CodegenSecurity filteredSecurity = new CodegenSecurity(this);
|
||||||
|
|
||||||
|
if (scopes == null) {
|
||||||
|
return filteredSecurity;
|
||||||
|
}
|
||||||
|
|
||||||
List<Map<String, Object>> returnedScopes = new ArrayList<Map<String, Object>>();
|
List<Map<String, Object>> returnedScopes = new ArrayList<Map<String, Object>>();
|
||||||
Map<String, Object> lastScope = null;
|
Map<String, Object> lastScope = null;
|
||||||
for (String filterScopeName : filterScopes) {
|
for (String filterScopeName : filterScopes) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
package org.openapitools.codegen;
|
package org.openapitools.codegen;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.github.benmanes.caffeine.cache.Cache;
|
import com.github.benmanes.caffeine.cache.Cache;
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||||
import com.github.benmanes.caffeine.cache.Ticker;
|
import com.github.benmanes.caffeine.cache.Ticker;
|
||||||
@@ -446,10 +447,13 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
.put("titlecase", new TitlecaseLambda())
|
.put("titlecase", new TitlecaseLambda())
|
||||||
.put("camelcase", new CamelCaseLambda(true).generator(this))
|
.put("camelcase", new CamelCaseLambda(true).generator(this))
|
||||||
.put("pascalcase", new CamelCaseLambda(false).generator(this))
|
.put("pascalcase", new CamelCaseLambda(false).generator(this))
|
||||||
|
.put("forwardslash", new ForwardSlashLambda())
|
||||||
|
.put("backslash", new BackSlashLambda())
|
||||||
.put("indented", new IndentedLambda())
|
.put("indented", new IndentedLambda())
|
||||||
.put("indented_8", new IndentedLambda(8, " ", false))
|
.put("indented_8", new IndentedLambda(8, " ", false))
|
||||||
.put("indented_12", new IndentedLambda(12, " ", false))
|
.put("indented_12", new IndentedLambda(12, " ", false))
|
||||||
.put("indented_16", new IndentedLambda(16, " ", false));
|
.put("indented_16", new IndentedLambda(16, " ", false));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerMustacheLambdas() {
|
private void registerMustacheLambdas() {
|
||||||
@@ -791,6 +795,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
Map<String, Object> allowableValues = cm.allowableValues;
|
Map<String, Object> allowableValues = cm.allowableValues;
|
||||||
List<Object> values = (List<Object>) allowableValues.get("values");
|
List<Object> values = (List<Object>) allowableValues.get("values");
|
||||||
List<Map<String, Object>> enumVars = buildEnumVars(values, cm.dataType);
|
List<Map<String, Object>> enumVars = buildEnumVars(values, cm.dataType);
|
||||||
|
postProcessEnumVars(enumVars);
|
||||||
// if "x-enum-varnames" or "x-enum-descriptions" defined, update varnames
|
// if "x-enum-varnames" or "x-enum-descriptions" defined, update varnames
|
||||||
updateEnumVarsWithExtensions(enumVars, cm.getVendorExtensions(), cm.dataType);
|
updateEnumVarsWithExtensions(enumVars, cm.getVendorExtensions(), cm.dataType);
|
||||||
cm.allowableValues.put("enumVars", enumVars);
|
cm.allowableValues.put("enumVars", enumVars);
|
||||||
@@ -1031,23 +1036,23 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
if (ModelUtils.isComposedSchema(s)) {
|
if (ModelUtils.isComposedSchema(s)) {
|
||||||
if (e.getKey().contains("/")) {
|
if (e.getKey().contains("/")) {
|
||||||
// if this is property schema, we also need to generate the oneOf interface model
|
// if this is property schema, we also need to generate the oneOf interface model
|
||||||
addOneOfNameExtension((ComposedSchema) s, nOneOf);
|
addOneOfNameExtension(s, nOneOf);
|
||||||
addOneOfInterfaceModel((ComposedSchema) s, nOneOf);
|
addOneOfInterfaceModel(s, nOneOf);
|
||||||
} else {
|
} else {
|
||||||
// else this is a component schema, so we will just use that as the oneOf interface model
|
// else this is a component schema, so we will just use that as the oneOf interface model
|
||||||
addOneOfNameExtension((ComposedSchema) s, n);
|
addOneOfNameExtension(s, n);
|
||||||
}
|
}
|
||||||
} else if (ModelUtils.isArraySchema(s)) {
|
} else if (ModelUtils.isArraySchema(s)) {
|
||||||
Schema items = ((ArraySchema) s).getItems();
|
Schema items = ((ArraySchema) s).getItems();
|
||||||
if (ModelUtils.isComposedSchema(items)) {
|
if (ModelUtils.isComposedSchema(items)) {
|
||||||
addOneOfNameExtension((ComposedSchema) items, nOneOf);
|
addOneOfNameExtension(items, nOneOf);
|
||||||
addOneOfInterfaceModel((ComposedSchema) items, nOneOf);
|
addOneOfInterfaceModel(items, nOneOf);
|
||||||
}
|
}
|
||||||
} else if (ModelUtils.isMapSchema(s)) {
|
} else if (ModelUtils.isMapSchema(s)) {
|
||||||
Schema addProps = ModelUtils.getAdditionalProperties(s);
|
Schema addProps = ModelUtils.getAdditionalProperties(s);
|
||||||
if (addProps != null && ModelUtils.isComposedSchema(addProps)) {
|
if (addProps != null && ModelUtils.isComposedSchema(addProps)) {
|
||||||
addOneOfNameExtension((ComposedSchema) addProps, nOneOf);
|
addOneOfNameExtension(addProps, nOneOf);
|
||||||
addOneOfInterfaceModel((ComposedSchema) addProps, nOneOf);
|
addOneOfInterfaceModel(addProps, nOneOf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2269,10 +2274,9 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
**/
|
**/
|
||||||
@SuppressWarnings("static-method")
|
@SuppressWarnings("static-method")
|
||||||
public String getSchemaType(Schema schema) {
|
public String getSchemaType(Schema schema) {
|
||||||
if (schema instanceof ComposedSchema) { // composed schema
|
if (ModelUtils.isComposedSchema(schema)) { // composed schema
|
||||||
ComposedSchema cs = (ComposedSchema) schema;
|
|
||||||
// Get the interfaces, i.e. the set of elements under 'allOf', 'anyOf' or 'oneOf'.
|
// Get the interfaces, i.e. the set of elements under 'allOf', 'anyOf' or 'oneOf'.
|
||||||
List<Schema> schemas = ModelUtils.getInterfaces(cs);
|
List<Schema> schemas = ModelUtils.getInterfaces(schema);
|
||||||
|
|
||||||
List<String> names = new ArrayList<>();
|
List<String> names = new ArrayList<>();
|
||||||
// Build a list of the schema types under each interface.
|
// Build a list of the schema types under each interface.
|
||||||
@@ -2282,12 +2286,12 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
names.add(getSingleSchemaType(s));
|
names.add(getSingleSchemaType(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cs.getAllOf() != null) {
|
if (schema.getAllOf() != null) {
|
||||||
return toAllOfName(names, cs);
|
return toAllOfName(names, schema);
|
||||||
} else if (cs.getAnyOf() != null) { // anyOf
|
} else if (schema.getAnyOf() != null) { // anyOf
|
||||||
return toAnyOfName(names, cs);
|
return toAnyOfName(names, schema);
|
||||||
} else if (cs.getOneOf() != null) { // oneOf
|
} else if (schema.getOneOf() != null) { // oneOf
|
||||||
return toOneOfName(names, cs);
|
return toOneOfName(names, schema);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2323,7 +2327,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* @return name of the allOf schema
|
* @return name of the allOf schema
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("static-method")
|
@SuppressWarnings("static-method")
|
||||||
public String toAllOfName(List<String> names, ComposedSchema composedSchema) {
|
public String toAllOfName(List<String> names, Schema composedSchema) {
|
||||||
Map<String, Object> exts = composedSchema.getExtensions();
|
Map<String, Object> exts = composedSchema.getExtensions();
|
||||||
if (exts != null && exts.containsKey("x-all-of-name")) {
|
if (exts != null && exts.containsKey("x-all-of-name")) {
|
||||||
return (String) exts.get("x-all-of-name");
|
return (String) exts.get("x-all-of-name");
|
||||||
@@ -2347,7 +2351,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* @return name of the anyOf schema
|
* @return name of the anyOf schema
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("static-method")
|
@SuppressWarnings("static-method")
|
||||||
public String toAnyOfName(List<String> names, ComposedSchema composedSchema) {
|
public String toAnyOfName(List<String> names, Schema composedSchema) {
|
||||||
return "anyOf<" + String.join(",", names) + ">";
|
return "anyOf<" + String.join(",", names) + ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2365,7 +2369,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* @return name of the oneOf schema
|
* @return name of the oneOf schema
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("static-method")
|
@SuppressWarnings("static-method")
|
||||||
public String toOneOfName(List<String> names, ComposedSchema composedSchema) {
|
public String toOneOfName(List<String> names, Schema composedSchema) {
|
||||||
Map<String, Object> exts = composedSchema.getExtensions();
|
Map<String, Object> exts = composedSchema.getExtensions();
|
||||||
if (exts != null && exts.containsKey("x-one-of-name")) {
|
if (exts != null && exts.containsKey("x-one-of-name")) {
|
||||||
return (String) exts.get("x-one-of-name");
|
return (String) exts.get("x-one-of-name");
|
||||||
@@ -2670,7 +2674,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
Map<NamedSchema, CodegenProperty> schemaCodegenPropertyCache = new HashMap<>();
|
Map<NamedSchema, CodegenProperty> schemaCodegenPropertyCache = new HashMap<>();
|
||||||
|
|
||||||
protected void updateModelForComposedSchema(CodegenModel m, Schema schema, Map<String, Schema> allDefinitions) {
|
protected void updateModelForComposedSchema(CodegenModel m, Schema schema, Map<String, Schema> allDefinitions) {
|
||||||
final ComposedSchema composed = (ComposedSchema) schema;
|
final Schema composed = schema;
|
||||||
Map<String, Schema> properties = new LinkedHashMap<>();
|
Map<String, Schema> properties = new LinkedHashMap<>();
|
||||||
List<String> required = new ArrayList<>();
|
List<String> required = new ArrayList<>();
|
||||||
Map<String, Schema> allProperties = new LinkedHashMap<>();
|
Map<String, Schema> allProperties = new LinkedHashMap<>();
|
||||||
@@ -2696,17 +2700,17 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
if (composed.getAllOf() != null) {
|
if (composed.getAllOf() != null) {
|
||||||
int modelImplCnt = 0; // only one inline object allowed in a ComposedModel
|
int modelImplCnt = 0; // only one inline object allowed in a ComposedModel
|
||||||
int modelDiscriminators = 0; // only one discriminator allowed in a ComposedModel
|
int modelDiscriminators = 0; // only one discriminator allowed in a ComposedModel
|
||||||
for (Schema innerSchema : composed.getAllOf()) { // TODO need to work with anyOf, oneOf as well
|
for (Object innerSchema : composed.getAllOf()) { // TODO need to work with anyOf, oneOf as well
|
||||||
if (m.discriminator == null && innerSchema.getDiscriminator() != null) {
|
if (m.discriminator == null && ((Schema) innerSchema).getDiscriminator() != null) {
|
||||||
LOGGER.debug("discriminator is set to null (not correctly set earlier): {}", m.name);
|
LOGGER.debug("discriminator is set to null (not correctly set earlier): {}", m.name);
|
||||||
m.setDiscriminator(createDiscriminator(m.name, innerSchema));
|
m.setDiscriminator(createDiscriminator(m.name, (Schema) innerSchema));
|
||||||
modelDiscriminators++;
|
modelDiscriminators++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (innerSchema.getXml() != null) {
|
if (((Schema) innerSchema).getXml() != null) {
|
||||||
m.xmlPrefix = innerSchema.getXml().getPrefix();
|
m.xmlPrefix = ((Schema) innerSchema).getXml().getPrefix();
|
||||||
m.xmlNamespace = innerSchema.getXml().getNamespace();
|
m.xmlNamespace = ((Schema) innerSchema).getXml().getNamespace();
|
||||||
m.xmlName = innerSchema.getXml().getName();
|
m.xmlName = ((Schema) innerSchema).getXml().getName();
|
||||||
}
|
}
|
||||||
if (modelDiscriminators > 1) {
|
if (modelDiscriminators > 1) {
|
||||||
LOGGER.error("Allof composed schema is inheriting >1 discriminator. Only use one discriminator: {}", composed);
|
LOGGER.error("Allof composed schema is inheriting >1 discriminator. Only use one discriminator: {}", composed);
|
||||||
@@ -2884,7 +2888,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void updateModelForObject(CodegenModel m, Schema schema) {
|
protected void updateModelForObject(CodegenModel m, Schema schema) {
|
||||||
if (schema.getProperties() != null || schema.getRequired() != null && !(schema instanceof ComposedSchema)) {
|
if (schema.getProperties() != null || schema.getRequired() != null && !(ModelUtils.isComposedSchema(schema))) {
|
||||||
// passing null to allProperties and allRequired as there's no parent
|
// passing null to allProperties and allRequired as there's no parent
|
||||||
addVars(m, unaliasPropertySchema(schema.getProperties()), schema.getRequired(), null, null);
|
addVars(m, unaliasPropertySchema(schema.getProperties()), schema.getRequired(), null, null);
|
||||||
}
|
}
|
||||||
@@ -2913,7 +2917,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
addAdditionPropertiesToCodeGenModel(m, schema);
|
addAdditionPropertiesToCodeGenModel(m, schema);
|
||||||
m.isMap = true;
|
m.isMap = true;
|
||||||
}
|
}
|
||||||
if (schema.getProperties() != null || schema.getRequired() != null && !(schema instanceof ComposedSchema)) {
|
if (schema.getProperties() != null || schema.getRequired() != null && !(ModelUtils.isComposedSchema(schema))) {
|
||||||
// passing null to allProperties and allRequired as there's no parent
|
// passing null to allProperties and allRequired as there's no parent
|
||||||
addVars(m, unaliasPropertySchema(schema.getProperties()), schema.getRequired(), null, null);
|
addVars(m, unaliasPropertySchema(schema.getProperties()), schema.getRequired(), null, null);
|
||||||
}
|
}
|
||||||
@@ -3118,7 +3122,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
m.setRef(schema.get$ref());
|
m.setRef(schema.get$ref());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (schema instanceof ComposedSchema) {
|
if (ModelUtils.isComposedSchema(schema)) {
|
||||||
updateModelForComposedSchema(m, schema, allDefinitions);
|
updateModelForComposedSchema(m, schema, allDefinitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3252,11 +3256,11 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
return cp;
|
return cp;
|
||||||
}
|
}
|
||||||
if (ModelUtils.isComposedSchema(refSchema)) {
|
if (ModelUtils.isComposedSchema(refSchema)) {
|
||||||
ComposedSchema composedSchema = (ComposedSchema) refSchema;
|
Schema composedSchema = refSchema;
|
||||||
if (composedSchema.getAllOf() != null) {
|
if (composedSchema.getAllOf() != null) {
|
||||||
// If our discriminator is in one of the allOf schemas break when we find it
|
// If our discriminator is in one of the allOf schemas break when we find it
|
||||||
for (Schema allOf : composedSchema.getAllOf()) {
|
for (Object allOf : composedSchema.getAllOf()) {
|
||||||
CodegenProperty cp = discriminatorFound(composedSchemaName, allOf, discPropName, visitedSchemas);
|
CodegenProperty cp = discriminatorFound(composedSchemaName, (Schema) allOf, discPropName, visitedSchemas);
|
||||||
if (cp != null) {
|
if (cp != null) {
|
||||||
return cp;
|
return cp;
|
||||||
}
|
}
|
||||||
@@ -3265,9 +3269,9 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
if (composedSchema.getOneOf() != null && composedSchema.getOneOf().size() != 0) {
|
if (composedSchema.getOneOf() != null && composedSchema.getOneOf().size() != 0) {
|
||||||
// All oneOf definitions must contain the discriminator
|
// All oneOf definitions must contain the discriminator
|
||||||
CodegenProperty cp = new CodegenProperty();
|
CodegenProperty cp = new CodegenProperty();
|
||||||
for (Schema oneOf : composedSchema.getOneOf()) {
|
for (Object oneOf : composedSchema.getOneOf()) {
|
||||||
String modelName = ModelUtils.getSimpleRef(oneOf.get$ref());
|
String modelName = ModelUtils.getSimpleRef(((Schema) oneOf).get$ref());
|
||||||
CodegenProperty thisCp = discriminatorFound(composedSchemaName, oneOf, discPropName, visitedSchemas);
|
CodegenProperty thisCp = discriminatorFound(composedSchemaName, (Schema) oneOf, discPropName, visitedSchemas);
|
||||||
if (thisCp == null) {
|
if (thisCp == null) {
|
||||||
LOGGER.warn(
|
LOGGER.warn(
|
||||||
"'{}' defines discriminator '{}', but the referenced OneOf schema '{}' is missing {}",
|
"'{}' defines discriminator '{}', but the referenced OneOf schema '{}' is missing {}",
|
||||||
@@ -3288,9 +3292,9 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
if (composedSchema.getAnyOf() != null && composedSchema.getAnyOf().size() != 0) {
|
if (composedSchema.getAnyOf() != null && composedSchema.getAnyOf().size() != 0) {
|
||||||
// All anyOf definitions must contain the discriminator because a min of one must be selected
|
// All anyOf definitions must contain the discriminator because a min of one must be selected
|
||||||
CodegenProperty cp = new CodegenProperty();
|
CodegenProperty cp = new CodegenProperty();
|
||||||
for (Schema anyOf : composedSchema.getAnyOf()) {
|
for (Object anyOf : composedSchema.getAnyOf()) {
|
||||||
String modelName = ModelUtils.getSimpleRef(anyOf.get$ref());
|
String modelName = ModelUtils.getSimpleRef(((Schema) anyOf).get$ref());
|
||||||
CodegenProperty thisCp = discriminatorFound(composedSchemaName, anyOf, discPropName, visitedSchemas);
|
CodegenProperty thisCp = discriminatorFound(composedSchemaName, (Schema) anyOf, discPropName, visitedSchemas);
|
||||||
if (thisCp == null) {
|
if (thisCp == null) {
|
||||||
LOGGER.warn(
|
LOGGER.warn(
|
||||||
"'{}' defines discriminator '{}', but the referenced AnyOf schema '{}' is missing {}",
|
"'{}' defines discriminator '{}', but the referenced AnyOf schema '{}' is missing {}",
|
||||||
@@ -3339,11 +3343,11 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
Discriminator disc = new Discriminator();
|
Discriminator disc = new Discriminator();
|
||||||
if (ModelUtils.isComposedSchema(refSchema)) {
|
if (ModelUtils.isComposedSchema(refSchema)) {
|
||||||
ComposedSchema composedSchema = (ComposedSchema) refSchema;
|
Schema composedSchema = refSchema;
|
||||||
if (composedSchema.getAllOf() != null) {
|
if (composedSchema.getAllOf() != null) {
|
||||||
// If our discriminator is in one of the allOf schemas break when we find it
|
// If our discriminator is in one of the allOf schemas break when we find it
|
||||||
for (Schema allOf : composedSchema.getAllOf()) {
|
for (Object allOf : composedSchema.getAllOf()) {
|
||||||
foundDisc = recursiveGetDiscriminator(allOf, visitedSchemas);
|
foundDisc = recursiveGetDiscriminator((Schema) allOf, visitedSchemas);
|
||||||
if (foundDisc != null) {
|
if (foundDisc != null) {
|
||||||
disc.setPropertyName(foundDisc.getPropertyName());
|
disc.setPropertyName(foundDisc.getPropertyName());
|
||||||
disc.setMapping(foundDisc.getMapping());
|
disc.setMapping(foundDisc.getMapping());
|
||||||
@@ -3356,13 +3360,13 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
Integer hasDiscriminatorCnt = 0;
|
Integer hasDiscriminatorCnt = 0;
|
||||||
Integer hasNullTypeCnt = 0;
|
Integer hasNullTypeCnt = 0;
|
||||||
Set<String> discriminatorsPropNames = new HashSet<>();
|
Set<String> discriminatorsPropNames = new HashSet<>();
|
||||||
for (Schema oneOf : composedSchema.getOneOf()) {
|
for (Object oneOf : composedSchema.getOneOf()) {
|
||||||
if (ModelUtils.isNullType(oneOf)) {
|
if (ModelUtils.isNullType((Schema) oneOf)) {
|
||||||
// The null type does not have a discriminator. Skip.
|
// The null type does not have a discriminator. Skip.
|
||||||
hasNullTypeCnt++;
|
hasNullTypeCnt++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foundDisc = recursiveGetDiscriminator(oneOf, visitedSchemas);
|
foundDisc = recursiveGetDiscriminator((Schema) oneOf, visitedSchemas);
|
||||||
if (foundDisc != null) {
|
if (foundDisc != null) {
|
||||||
discriminatorsPropNames.add(foundDisc.getPropertyName());
|
discriminatorsPropNames.add(foundDisc.getPropertyName());
|
||||||
hasDiscriminatorCnt++;
|
hasDiscriminatorCnt++;
|
||||||
@@ -3385,13 +3389,13 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
Integer hasDiscriminatorCnt = 0;
|
Integer hasDiscriminatorCnt = 0;
|
||||||
Integer hasNullTypeCnt = 0;
|
Integer hasNullTypeCnt = 0;
|
||||||
Set<String> discriminatorsPropNames = new HashSet<>();
|
Set<String> discriminatorsPropNames = new HashSet<>();
|
||||||
for (Schema anyOf : composedSchema.getAnyOf()) {
|
for (Object anyOf : composedSchema.getAnyOf()) {
|
||||||
if (ModelUtils.isNullType(anyOf)) {
|
if (ModelUtils.isNullType((Schema) anyOf)) {
|
||||||
// The null type does not have a discriminator. Skip.
|
// The null type does not have a discriminator. Skip.
|
||||||
hasNullTypeCnt++;
|
hasNullTypeCnt++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foundDisc = recursiveGetDiscriminator(anyOf, visitedSchemas);
|
foundDisc = recursiveGetDiscriminator((Schema) anyOf, visitedSchemas);
|
||||||
if (foundDisc != null) {
|
if (foundDisc != null) {
|
||||||
discriminatorsPropNames.add(foundDisc.getPropertyName());
|
discriminatorsPropNames.add(foundDisc.getPropertyName());
|
||||||
hasDiscriminatorCnt++;
|
hasDiscriminatorCnt++;
|
||||||
@@ -3426,7 +3430,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* @param c The ComposedSchema that contains the discriminator and oneOf/anyOf schemas
|
* @param c The ComposedSchema that contains the discriminator and oneOf/anyOf schemas
|
||||||
* @return the list of oneOf and anyOf MappedModel that need to be added to the discriminator map
|
* @return the list of oneOf and anyOf MappedModel that need to be added to the discriminator map
|
||||||
*/
|
*/
|
||||||
protected List<MappedModel> getOneOfAnyOfDescendants(String composedSchemaName, String discPropName, ComposedSchema c) {
|
protected List<MappedModel> getOneOfAnyOfDescendants(String composedSchemaName, String discPropName, Schema c) {
|
||||||
ArrayList<List<Schema>> listOLists = new ArrayList<>();
|
ArrayList<List<Schema>> listOLists = new ArrayList<>();
|
||||||
listOLists.add(c.getOneOf());
|
listOLists.add(c.getOneOf());
|
||||||
listOLists.add(c.getAnyOf());
|
listOLists.add(c.getAnyOf());
|
||||||
@@ -3506,8 +3510,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
Schema child = schemas.get(childName);
|
Schema child = schemas.get(childName);
|
||||||
if (ModelUtils.isComposedSchema(child)) {
|
if (ModelUtils.isComposedSchema(child)) {
|
||||||
ComposedSchema composedChild = (ComposedSchema) child;
|
List<Schema> parents = child.getAllOf();
|
||||||
List<Schema> parents = composedChild.getAllOf();
|
|
||||||
if (parents != null) {
|
if (parents != null) {
|
||||||
for (Schema parent : parents) {
|
for (Schema parent : parents) {
|
||||||
String ref = parent.get$ref();
|
String ref = parent.get$ref();
|
||||||
@@ -3620,7 +3623,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
// if there are composed oneOf/anyOf schemas, add them to this discriminator
|
// if there are composed oneOf/anyOf schemas, add them to this discriminator
|
||||||
if (ModelUtils.isComposedSchema(schema) && !this.getLegacyDiscriminatorBehavior()) {
|
if (ModelUtils.isComposedSchema(schema) && !this.getLegacyDiscriminatorBehavior()) {
|
||||||
List<MappedModel> otherDescendants = getOneOfAnyOfDescendants(schemaName, discriminatorPropertyName, (ComposedSchema) schema);
|
List<MappedModel> otherDescendants = getOneOfAnyOfDescendants(schemaName, discriminatorPropertyName, schema);
|
||||||
for (MappedModel otherDescendant : otherDescendants) {
|
for (MappedModel otherDescendant : otherDescendants) {
|
||||||
if (!uniqueDescendants.contains(otherDescendant)) {
|
if (!uniqueDescendants.contains(otherDescendant)) {
|
||||||
uniqueDescendants.add(otherDescendant);
|
uniqueDescendants.add(otherDescendant);
|
||||||
@@ -3654,15 +3657,18 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* @param visitedSchemas circuit-breaker - the schemas with which the method was called before for recursive structures
|
* @param visitedSchemas circuit-breaker - the schemas with which the method was called before for recursive structures
|
||||||
*/
|
*/
|
||||||
protected void addProperties(Map<String, Schema> properties, List<String> required, Schema schema, Set<Schema> visitedSchemas) {
|
protected void addProperties(Map<String, Schema> properties, List<String> required, Schema schema, Set<Schema> visitedSchemas) {
|
||||||
|
if (schema == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!visitedSchemas.add(schema)) {
|
if (!visitedSchemas.add(schema)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (schema instanceof ComposedSchema) {
|
if (ModelUtils.isComposedSchema(schema)) {
|
||||||
ComposedSchema composedSchema = (ComposedSchema) schema;
|
|
||||||
|
|
||||||
if (composedSchema.getAllOf() != null) {
|
if (schema.getAllOf() != null) {
|
||||||
for (Schema component : composedSchema.getAllOf()) {
|
for (Object component : schema.getAllOf()) {
|
||||||
addProperties(properties, required, component, visitedSchemas);
|
addProperties(properties, required, (Schema) component, visitedSchemas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3670,15 +3676,15 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
required.addAll(schema.getRequired());
|
required.addAll(schema.getRequired());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (composedSchema.getOneOf() != null) {
|
if (schema.getOneOf() != null) {
|
||||||
for (Schema component : composedSchema.getOneOf()) {
|
for (Object component : schema.getOneOf()) {
|
||||||
addProperties(properties, required, component, visitedSchemas);
|
addProperties(properties, required, (Schema) component, visitedSchemas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (composedSchema.getAnyOf() != null) {
|
if (schema.getAnyOf() != null) {
|
||||||
for (Schema component : composedSchema.getAnyOf()) {
|
for (Object component : schema.getAnyOf()) {
|
||||||
addProperties(properties, required, component, visitedSchemas);
|
addProperties(properties, required, (Schema) component, visitedSchemas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3762,10 +3768,11 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
if (Boolean.FALSE.equals(p.getNullable())) {
|
if (Boolean.FALSE.equals(p.getNullable())) {
|
||||||
LOGGER.warn("Schema '{}' is any type, which includes the 'null' value. 'nullable' cannot be set to 'false'", p.getName());
|
LOGGER.warn("Schema '{}' is any type, which includes the 'null' value. 'nullable' cannot be set to 'false'", p.getName());
|
||||||
}
|
}
|
||||||
ComposedSchema composedSchema = p instanceof ComposedSchema
|
|
||||||
? (ComposedSchema) p
|
property.isNullable = property.isNullable ||
|
||||||
: null;
|
!(ModelUtils.isComposedSchema(p)) ||
|
||||||
property.isNullable = property.isNullable || composedSchema == null || composedSchema.getAllOf() == null || composedSchema.getAllOf().size() == 0;
|
p.getAllOf() == null ||
|
||||||
|
p.getAllOf().size() == 0;
|
||||||
if (languageSpecificPrimitives.contains(property.dataType)) {
|
if (languageSpecificPrimitives.contains(property.dataType)) {
|
||||||
property.isPrimitiveType = true;
|
property.isPrimitiveType = true;
|
||||||
}
|
}
|
||||||
@@ -5742,7 +5749,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* @param model codegen model
|
* @param model codegen model
|
||||||
* @param modelName model name
|
* @param modelName model name
|
||||||
*/
|
*/
|
||||||
protected void addImport(ComposedSchema composed, Schema childSchema, CodegenModel model, String modelName ) {
|
protected void addImport(Schema composed, Schema childSchema, CodegenModel model, String modelName ) {
|
||||||
if (composed == null || childSchema == null) {
|
if (composed == null || childSchema == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -6524,6 +6531,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
.findFirst();
|
.findFirst();
|
||||||
String dataType = (referencedSchema.isPresent()) ? getTypeDeclaration(referencedSchema.get()) : varDataType;
|
String dataType = (referencedSchema.isPresent()) ? getTypeDeclaration(referencedSchema.get()) : varDataType;
|
||||||
List<Map<String, Object>> enumVars = buildEnumVars(values, dataType);
|
List<Map<String, Object>> enumVars = buildEnumVars(values, dataType);
|
||||||
|
postProcessEnumVars(enumVars);
|
||||||
|
|
||||||
// if "x-enum-varnames" or "x-enum-descriptions" defined, update varnames
|
// if "x-enum-varnames" or "x-enum-descriptions" defined, update varnames
|
||||||
Map<String, Object> extensions = var.mostInnerItems != null ? var.mostInnerItems.getVendorExtensions() : var.getVendorExtensions();
|
Map<String, Object> extensions = var.mostInnerItems != null ? var.mostInnerItems.getVendorExtensions() : var.getVendorExtensions();
|
||||||
@@ -6562,26 +6570,23 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
protected List<Map<String, Object>> buildEnumVars(List<Object> values, String dataType) {
|
protected List<Map<String, Object>> buildEnumVars(List<Object> values, String dataType) {
|
||||||
List<Map<String, Object>> enumVars = new ArrayList<>();
|
List<Map<String, Object>> enumVars = new ArrayList<>();
|
||||||
int truncateIdx = 0;
|
int truncateIdx = isRemoveEnumValuePrefix()
|
||||||
|
? findCommonPrefixOfVars(values).length()
|
||||||
if (isRemoveEnumValuePrefix()) {
|
: 0;
|
||||||
String commonPrefix = findCommonPrefixOfVars(values);
|
|
||||||
truncateIdx = commonPrefix.length();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Object value : values) {
|
for (Object value : values) {
|
||||||
Map<String, Object> enumVar = new HashMap<>();
|
Map<String, Object> enumVar = new HashMap<>();
|
||||||
String enumName;
|
String enumName = truncateIdx == 0
|
||||||
if (truncateIdx == 0) {
|
? String.valueOf(value)
|
||||||
enumName = String.valueOf(value);
|
: value.toString().substring(truncateIdx);
|
||||||
} else {
|
|
||||||
enumName = value.toString().substring(truncateIdx);
|
if (enumName.isEmpty()) {
|
||||||
if (enumName.isEmpty()) {
|
enumName = value.toString();
|
||||||
enumName = value.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enumVar.put("name", toEnumVarName(enumName, dataType));
|
final String finalEnumName = toEnumVarName(enumName, dataType);
|
||||||
|
|
||||||
|
enumVar.put("name", finalEnumName);
|
||||||
enumVar.put("value", toEnumValue(String.valueOf(value), dataType));
|
enumVar.put("value", toEnumValue(String.valueOf(value), dataType));
|
||||||
enumVar.put("isString", isDataTypeString(dataType));
|
enumVar.put("isString", isDataTypeString(dataType));
|
||||||
enumVars.add(enumVar);
|
enumVars.add(enumVar);
|
||||||
@@ -6593,18 +6598,15 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
Map<String, Object> enumVar = new HashMap<>();
|
Map<String, Object> enumVar = new HashMap<>();
|
||||||
String enumName = enumUnknownDefaultCaseName;
|
String enumName = enumUnknownDefaultCaseName;
|
||||||
|
|
||||||
String enumValue;
|
String enumValue = isDataTypeString(dataType)
|
||||||
if (isDataTypeString(dataType)) {
|
? enumUnknownDefaultCaseName
|
||||||
enumValue = enumUnknownDefaultCaseName;
|
: // This is a dummy value that attempts to avoid collisions with previously specified cases.
|
||||||
} else {
|
// Int.max / 192
|
||||||
// This is a dummy value that attempts to avoid collisions with previously specified cases.
|
// The number 192 that is used to calculate this random value, is the Swift Evolution proposal for frozen/non-frozen enums.
|
||||||
// Int.max / 192
|
// [SE-0192](https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md)
|
||||||
// The number 192 that is used to calculate this random value, is the Swift Evolution proposal for frozen/non-frozen enums.
|
// Since this functionality was born in the Swift 5 generator and latter on broth to all generators
|
||||||
// [SE-0192](https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md)
|
// https://github.com/OpenAPITools/openapi-generator/pull/11013
|
||||||
// Since this functionality was born in the Swift 5 generator and latter on broth to all generators
|
String.valueOf(11184809);
|
||||||
// https://github.com/OpenAPITools/openapi-generator/pull/11013
|
|
||||||
enumValue = String.valueOf(11184809);
|
|
||||||
}
|
|
||||||
|
|
||||||
enumVar.put("name", toEnumVarName(enumName, dataType));
|
enumVar.put("name", toEnumVarName(enumName, dataType));
|
||||||
enumVar.put("value", toEnumValue(enumValue, dataType));
|
enumVar.put("value", toEnumValue(enumValue, dataType));
|
||||||
@@ -6615,6 +6617,27 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
return enumVars;
|
return enumVars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void postProcessEnumVars(List<Map<String, Object>> enumVars) {
|
||||||
|
Collections.reverse(enumVars);
|
||||||
|
enumVars.forEach(v -> {
|
||||||
|
String name = (String) v.get("name");
|
||||||
|
long count = enumVars.stream().filter(v1 -> v1.get("name").equals(name)).count();
|
||||||
|
if (count > 1) {
|
||||||
|
String uniqueEnumName = getUniqueEnumName(name, enumVars);
|
||||||
|
LOGGER.debug("Changing duplicate enumeration name from " + v.get("name") + " to " + uniqueEnumName);
|
||||||
|
v.put("name", uniqueEnumName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Collections.reverse(enumVars);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getUniqueEnumName(String name, List<Map<String, Object>> enumVars) {
|
||||||
|
long count = enumVars.stream().filter(v -> v.get("name").equals(name)).count();
|
||||||
|
return count > 1
|
||||||
|
? getUniqueEnumName(name + count, enumVars)
|
||||||
|
: name;
|
||||||
|
}
|
||||||
|
|
||||||
protected void updateEnumVarsWithExtensions(List<Map<String, Object>> enumVars, Map<String, Object> vendorExtensions, String dataType) {
|
protected void updateEnumVarsWithExtensions(List<Map<String, Object>> enumVars, Map<String, Object> vendorExtensions, String dataType) {
|
||||||
if (vendorExtensions != null) {
|
if (vendorExtensions != null) {
|
||||||
updateEnumVarsWithExtensions(enumVars, vendorExtensions, "x-enum-varnames", "name");
|
updateEnumVarsWithExtensions(enumVars, vendorExtensions, "x-enum-varnames", "name");
|
||||||
@@ -6905,6 +6928,13 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
LOGGER.debug("debugging fromRequestBodyToFormParameters= {}", body);
|
LOGGER.debug("debugging fromRequestBodyToFormParameters= {}", body);
|
||||||
Schema schema = ModelUtils.getSchemaFromRequestBody(body);
|
Schema schema = ModelUtils.getSchemaFromRequestBody(body);
|
||||||
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
|
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
|
||||||
|
if(ModelUtils.isMapSchema(schema)) {
|
||||||
|
LOGGER.error("Form parameters with additionalProperties are not supported by OpenAPI Generator. Please report the issue to https://github.com/openapitools/openapi-generator if you need help.");
|
||||||
|
}
|
||||||
|
if(ModelUtils.isArraySchema(schema)) {
|
||||||
|
LOGGER.error("Array form parameters are not supported by OpenAPI Generator. Please report the issue to https://github.com/openapitools/openapi-generator if you need help.");
|
||||||
|
}
|
||||||
|
|
||||||
List<String> allRequired = new ArrayList<>();
|
List<String> allRequired = new ArrayList<>();
|
||||||
Map<String, Schema> properties = new LinkedHashMap<>();
|
Map<String, Schema> properties = new LinkedHashMap<>();
|
||||||
// this traverses a composed schema and extracts all properties in each schema into properties
|
// this traverses a composed schema and extracts all properties in each schema into properties
|
||||||
@@ -6913,6 +6943,8 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
// https://github.com/OpenAPITools/openapi-generator/issues/10415
|
// https://github.com/OpenAPITools/openapi-generator/issues/10415
|
||||||
addProperties(properties, allRequired, schema, new HashSet<>());
|
addProperties(properties, allRequired, schema, new HashSet<>());
|
||||||
|
|
||||||
|
boolean isOneOfOrAnyOf = ModelUtils.isOneOf(schema) || ModelUtils.isAnyOf(schema);
|
||||||
|
|
||||||
if (!properties.isEmpty()) {
|
if (!properties.isEmpty()) {
|
||||||
for (Map.Entry<String, Schema> entry : properties.entrySet()) {
|
for (Map.Entry<String, Schema> entry : properties.entrySet()) {
|
||||||
CodegenParameter codegenParameter;
|
CodegenParameter codegenParameter;
|
||||||
@@ -6920,14 +6952,14 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
// value => property schema
|
// value => property schema
|
||||||
String propertyName = entry.getKey();
|
String propertyName = entry.getKey();
|
||||||
Schema propertySchema = entry.getValue();
|
Schema propertySchema = entry.getValue();
|
||||||
if (ModelUtils.isMapSchema(propertySchema)) {
|
|
||||||
LOGGER.error("Map of form parameters not supported. Please report the issue to https://github.com/openapitools/openapi-generator if you need help.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
codegenParameter = fromFormProperty(propertyName, propertySchema, imports);
|
codegenParameter = fromFormProperty(propertyName, propertySchema, imports);
|
||||||
|
|
||||||
// Set 'required' flag defined in the schema element
|
if (isOneOfOrAnyOf) {
|
||||||
if (!codegenParameter.required && schema.getRequired() != null) {
|
// for oneOf/anyOf, mark all the properties collected from the sub-schemas as optional
|
||||||
|
// so that users can choose which property to include in the form parameters
|
||||||
|
codegenParameter.required = false;
|
||||||
|
} else if (!codegenParameter.required && schema.getRequired() != null) {
|
||||||
|
// Set 'required' flag defined in the schema element
|
||||||
codegenParameter.required = schema.getRequired().contains(entry.getKey());
|
codegenParameter.required = schema.getRequired().contains(entry.getKey());
|
||||||
} else if (!codegenParameter.required) {
|
} else if (!codegenParameter.required) {
|
||||||
// Set 'required' flag for properties declared inside the allOf
|
// Set 'required' flag for properties declared inside the allOf
|
||||||
@@ -7496,9 +7528,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
String name = null;
|
String name = null;
|
||||||
LOGGER.debug("Request body = {}", body);
|
LOGGER.debug("Request body = {}", body);
|
||||||
Schema schema = ModelUtils.getSchemaFromRequestBody(body);
|
Schema schema = ModelUtils.getSchemaFromRequestBody(body);
|
||||||
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"));
|
codegenParameter.setContent(getContent(body.getContent(), imports, "RequestBody"));
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(schema.get$ref())) {
|
if (StringUtils.isNotBlank(schema.get$ref())) {
|
||||||
@@ -7563,7 +7592,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
|
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addJsonSchemaForBodyRequestInCaseItsNotPresent(codegenParameter, body);
|
addJsonSchemaForBodyRequestInCaseItsNotPresent(codegenParameter, body);
|
||||||
|
|
||||||
// set the parameter's example value
|
// set the parameter's example value
|
||||||
@@ -7904,12 +7932,12 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
/**
|
/**
|
||||||
* Add "x-one-of-name" extension to a given oneOf schema (assuming it has at least 1 oneOf elements)
|
* Add "x-one-of-name" extension to a given oneOf schema (assuming it has at least 1 oneOf elements)
|
||||||
*
|
*
|
||||||
* @param s schema to add the extension to
|
* @param schema schema to add the extension to
|
||||||
* @param name name of the parent oneOf schema
|
* @param name name of the parent oneOf schema
|
||||||
*/
|
*/
|
||||||
public void addOneOfNameExtension(ComposedSchema s, String name) {
|
public void addOneOfNameExtension(Schema schema, String name) {
|
||||||
if (s.getOneOf() != null && s.getOneOf().size() > 0) {
|
if (schema.getOneOf() != null && schema.getOneOf().size() > 0) {
|
||||||
s.addExtension("x-one-of-name", name);
|
schema.addExtension("x-one-of-name", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7919,7 +7947,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* @param cs ComposedSchema object to create as interface model
|
* @param cs ComposedSchema object to create as interface model
|
||||||
* @param type name to use for the generated interface model
|
* @param type name to use for the generated interface model
|
||||||
*/
|
*/
|
||||||
public void addOneOfInterfaceModel(ComposedSchema cs, String type) {
|
public void addOneOfInterfaceModel(Schema cs, String type) {
|
||||||
if (cs.getOneOf() == null) {
|
if (cs.getOneOf() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -7928,9 +7956,9 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
cm.setDiscriminator(createDiscriminator("", cs));
|
cm.setDiscriminator(createDiscriminator("", cs));
|
||||||
|
|
||||||
for (Schema o : Optional.ofNullable(cs.getOneOf()).orElse(Collections.emptyList())) {
|
for (Object o : Optional.ofNullable(cs.getOneOf()).orElse(Collections.emptyList())) {
|
||||||
if (o.get$ref() == null) {
|
if (((Schema) o).get$ref() == null) {
|
||||||
if (cm.discriminator != null && o.get$ref() == null) {
|
if (cm.discriminator != null && ((Schema) o).get$ref() == null) {
|
||||||
// OpenAPI spec states that inline objects should not be considered when discriminator is used
|
// OpenAPI spec states that inline objects should not be considered when discriminator is used
|
||||||
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#discriminatorObject
|
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#discriminatorObject
|
||||||
LOGGER.warn("Ignoring inline object in oneOf definition of {}, since discriminator is used", type);
|
LOGGER.warn("Ignoring inline object in oneOf definition of {}, since discriminator is used", type);
|
||||||
@@ -7939,7 +7967,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cm.oneOf.add(toModelName(ModelUtils.getSimpleRef(o.get$ref())));
|
cm.oneOf.add(toModelName(ModelUtils.getSimpleRef(((Schema) o).get$ref())));
|
||||||
}
|
}
|
||||||
cm.name = type;
|
cm.name = type;
|
||||||
cm.classname = type;
|
cm.classname = type;
|
||||||
@@ -8110,7 +8138,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CodegenComposedSchemas getComposedSchemas(Schema schema) {
|
private CodegenComposedSchemas getComposedSchemas(Schema schema) {
|
||||||
if (!(schema instanceof ComposedSchema) && schema.getNot() == null) {
|
if (!(ModelUtils.isComposedSchema(schema)) && schema.getNot() == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Schema notSchema = schema.getNot();
|
Schema notSchema = schema.getNot();
|
||||||
@@ -8121,11 +8149,10 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
List<CodegenProperty> allOf = new ArrayList<>();
|
List<CodegenProperty> allOf = new ArrayList<>();
|
||||||
List<CodegenProperty> oneOf = new ArrayList<>();
|
List<CodegenProperty> oneOf = new ArrayList<>();
|
||||||
List<CodegenProperty> anyOf = new ArrayList<>();
|
List<CodegenProperty> anyOf = new ArrayList<>();
|
||||||
if (schema instanceof ComposedSchema) {
|
if (ModelUtils.isComposedSchema(schema)) {
|
||||||
ComposedSchema cs = (ComposedSchema) schema;
|
allOf = getComposedProperties(schema.getAllOf(), "all_of");
|
||||||
allOf = getComposedProperties(cs.getAllOf(), "all_of");
|
oneOf = getComposedProperties(schema.getOneOf(), "one_of");
|
||||||
oneOf = getComposedProperties(cs.getOneOf(), "one_of");
|
anyOf = getComposedProperties(schema.getAnyOf(), "any_of");
|
||||||
anyOf = getComposedProperties(cs.getAnyOf(), "any_of");
|
|
||||||
}
|
}
|
||||||
return new CodegenComposedSchemas(
|
return new CodegenComposedSchemas(
|
||||||
allOf,
|
allOf,
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.openapitools.codegen.api.TemplateDefinition;
|
import org.openapitools.codegen.api.TemplateDefinition;
|
||||||
import org.openapitools.codegen.api.TemplatePathLocator;
|
import org.openapitools.codegen.api.TemplatePathLocator;
|
||||||
import org.openapitools.codegen.api.TemplateProcessor;
|
import org.openapitools.codegen.api.TemplateProcessor;
|
||||||
|
import org.openapitools.codegen.config.GeneratorSettings;
|
||||||
import org.openapitools.codegen.config.GlobalSettings;
|
import org.openapitools.codegen.config.GlobalSettings;
|
||||||
import org.openapitools.codegen.api.TemplatingEngineAdapter;
|
import org.openapitools.codegen.api.TemplatingEngineAdapter;
|
||||||
import org.openapitools.codegen.api.TemplateFileType;
|
import org.openapitools.codegen.api.TemplateFileType;
|
||||||
@@ -57,6 +58,7 @@ import org.openapitools.codegen.utils.ImplementationVersion;
|
|||||||
import org.openapitools.codegen.utils.ModelUtils;
|
import org.openapitools.codegen.utils.ModelUtils;
|
||||||
import org.openapitools.codegen.utils.ProcessUtils;
|
import org.openapitools.codegen.utils.ProcessUtils;
|
||||||
import org.openapitools.codegen.utils.URLPathUtils;
|
import org.openapitools.codegen.utils.URLPathUtils;
|
||||||
|
import org.openapitools.codegen.utils.SemVer;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -253,10 +255,18 @@ public class DefaultGenerator implements Generator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config.processOpts();
|
config.processOpts();
|
||||||
|
if (opts != null && opts.getGeneratorSettings() != null) {
|
||||||
|
config.typeMapping().putAll(opts.getGeneratorSettings().getTypeMappings());
|
||||||
|
config.importMapping().putAll(opts.getGeneratorSettings().getImportMappings());
|
||||||
|
}
|
||||||
|
|
||||||
// normalize the spec
|
// normalize the spec
|
||||||
try {
|
try {
|
||||||
if (config.getUseOpenAPINormalizer()) {
|
if (config.getUseOpenAPINormalizer()) {
|
||||||
|
SemVer version = new SemVer(openAPI.getOpenapi());
|
||||||
|
if (version.atLeast("3.1.0")) {
|
||||||
|
config.openapiNormalizer().put("NORMALIZE_31SPEC", "true");
|
||||||
|
}
|
||||||
OpenAPINormalizer openapiNormalizer = new OpenAPINormalizer(openAPI, config.openapiNormalizer());
|
OpenAPINormalizer openapiNormalizer = new OpenAPINormalizer(openAPI, config.openapiNormalizer());
|
||||||
openapiNormalizer.normalize();
|
openapiNormalizer.normalize();
|
||||||
}
|
}
|
||||||
@@ -456,7 +466,7 @@ public class DefaultGenerator implements Generator {
|
|||||||
|
|
||||||
Boolean skipFormModel = GlobalSettings.getProperty(CodegenConstants.SKIP_FORM_MODEL) != null ?
|
Boolean skipFormModel = GlobalSettings.getProperty(CodegenConstants.SKIP_FORM_MODEL) != null ?
|
||||||
Boolean.valueOf(GlobalSettings.getProperty(CodegenConstants.SKIP_FORM_MODEL)) :
|
Boolean.valueOf(GlobalSettings.getProperty(CodegenConstants.SKIP_FORM_MODEL)) :
|
||||||
getGeneratorPropertyDefaultSwitch(CodegenConstants.SKIP_FORM_MODEL, true);
|
getGeneratorPropertyDefaultSwitch(CodegenConstants.SKIP_FORM_MODEL, false);
|
||||||
|
|
||||||
// process models only
|
// process models only
|
||||||
for (String name : modelKeys) {
|
for (String name : modelKeys) {
|
||||||
@@ -478,9 +488,9 @@ public class DefaultGenerator implements Generator {
|
|||||||
if (unusedModels.contains(name)) {
|
if (unusedModels.contains(name)) {
|
||||||
if (Boolean.FALSE.equals(skipFormModel)) {
|
if (Boolean.FALSE.equals(skipFormModel)) {
|
||||||
// if skipFormModel sets to true, still generate the model and log the result
|
// if skipFormModel sets to true, still generate the model and log the result
|
||||||
LOGGER.info("Model {} (marked as unused due to form parameters) is generated due to the global property `skipFormModel` set to false", name);
|
LOGGER.info("Model {} (marked as unused due to form parameters) is generated due to the global property `skipFormModel` set to false (default)", name);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("Model {} not generated since it's marked as unused (due to form parameters) and `skipFormModel` (global property) set to true (default)", name);
|
LOGGER.info("Model {} not generated since it's marked as unused (due to form parameters) and `skipFormModel` (global property) set to true", name);
|
||||||
// TODO: Should this be added to dryRun? If not, this seems like a weird place to return early from processing.
|
// TODO: Should this be added to dryRun? If not, this seems like a weird place to return early from processing.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,32 +216,30 @@ public class InlineModelResolver {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (schema instanceof ComposedSchema) {
|
if (ModelUtils.isComposedSchema(schema)) {
|
||||||
// allOf, anyOf, oneOf
|
// allOf, anyOf, oneOf
|
||||||
ComposedSchema m = (ComposedSchema) schema;
|
boolean isSingleAllOf = schema.getAllOf() != null && schema.getAllOf().size() == 1;
|
||||||
|
boolean isReadOnly = schema.getReadOnly() != null && schema.getReadOnly();
|
||||||
boolean isSingleAllOf = m.getAllOf() != null && m.getAllOf().size() == 1;
|
boolean isNullable = schema.getNullable() != null && schema.getNullable();
|
||||||
boolean isReadOnly = m.getReadOnly() != null && m.getReadOnly();
|
|
||||||
boolean isNullable = m.getNullable() != null && m.getNullable();
|
|
||||||
|
|
||||||
if (isSingleAllOf && (isReadOnly || isNullable)) {
|
if (isSingleAllOf && (isReadOnly || isNullable)) {
|
||||||
// Check if this composed schema only contains an allOf and a readOnly or nullable.
|
// Check if this composed schema only contains an allOf and a readOnly or nullable.
|
||||||
ComposedSchema c = new ComposedSchema();
|
ComposedSchema c = new ComposedSchema();
|
||||||
c.setAllOf(m.getAllOf());
|
c.setAllOf(schema.getAllOf());
|
||||||
c.setReadOnly(m.getReadOnly());
|
c.setReadOnly(schema.getReadOnly());
|
||||||
c.setNullable(m.getNullable());
|
c.setNullable(schema.getNullable());
|
||||||
if (m.equals(c)) {
|
if (schema.equals(c)) {
|
||||||
return isModelNeeded(m.getAllOf().get(0), visitedSchemas);
|
return isModelNeeded((Schema) schema.getAllOf().get(0), visitedSchemas);
|
||||||
}
|
}
|
||||||
} else if (isSingleAllOf && StringUtils.isNotEmpty(m.getAllOf().get(0).get$ref())) {
|
} else if (isSingleAllOf && StringUtils.isNotEmpty(((Schema) schema.getAllOf().get(0)).get$ref())) {
|
||||||
// single allOf and it's a ref
|
// single allOf and it's a ref
|
||||||
return isModelNeeded(m.getAllOf().get(0), visitedSchemas);
|
return isModelNeeded((Schema) schema.getAllOf().get(0), visitedSchemas);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m.getAllOf() != null && !m.getAllOf().isEmpty()) {
|
if (schema.getAllOf() != null && !schema.getAllOf().isEmpty()) {
|
||||||
// check to ensure at least one of the allOf item is model
|
// check to ensure at least one of the allOf item is model
|
||||||
for (Schema inner : m.getAllOf()) {
|
for (Object inner : schema.getAllOf()) {
|
||||||
if (isModelNeeded(ModelUtils.getReferencedSchema(openAPI, inner), visitedSchemas)) {
|
if (isModelNeeded(ModelUtils.getReferencedSchema(openAPI, (Schema) inner), visitedSchemas)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,10 +247,10 @@ public class InlineModelResolver {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m.getAnyOf() != null && !m.getAnyOf().isEmpty()) {
|
if (schema.getAnyOf() != null && !schema.getAnyOf().isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (m.getOneOf() != null && !m.getOneOf().isEmpty()) {
|
if (schema.getOneOf() != null && !schema.getOneOf().isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,7 +271,7 @@ public class InlineModelResolver {
|
|||||||
// any to catch OpenAPI violations
|
// any to catch OpenAPI violations
|
||||||
if (isModelNeeded(schema) || "object".equals(schema.getType()) ||
|
if (isModelNeeded(schema) || "object".equals(schema.getType()) ||
|
||||||
schema.getProperties() != null || schema.getAdditionalProperties() != null ||
|
schema.getProperties() != null || schema.getAdditionalProperties() != null ||
|
||||||
schema instanceof ComposedSchema) {
|
ModelUtils.isComposedSchema(schema)) {
|
||||||
LOGGER.error("Illegal schema found with $ref combined with other properties," +
|
LOGGER.error("Illegal schema found with $ref combined with other properties," +
|
||||||
" no properties should be defined alongside a $ref:\n " + schema.toString());
|
" no properties should be defined alongside a $ref:\n " + schema.toString());
|
||||||
}
|
}
|
||||||
@@ -295,13 +293,13 @@ public class InlineModelResolver {
|
|||||||
// If this schema should be split into its own model, do so
|
// If this schema should be split into its own model, do so
|
||||||
Schema refSchema = this.makeSchemaInComponents(schemaName, prop);
|
Schema refSchema = this.makeSchemaInComponents(schemaName, prop);
|
||||||
props.put(propName, refSchema);
|
props.put(propName, refSchema);
|
||||||
} else if (prop instanceof ComposedSchema) {
|
} else if (ModelUtils.isComposedSchema(prop)) {
|
||||||
ComposedSchema m = (ComposedSchema) prop;
|
if (prop.getAllOf() != null && prop.getAllOf().size() == 1 &&
|
||||||
if (m.getAllOf() != null && m.getAllOf().size() == 1 &&
|
!(((Schema) prop.getAllOf().get(0)).getType() == null ||
|
||||||
!(m.getAllOf().get(0).getType() == null || "object".equals(m.getAllOf().get(0).getType()))) {
|
"object".equals(((Schema) prop.getAllOf().get(0)).getType()))) {
|
||||||
// allOf with only 1 type (non-model)
|
// allOf with only 1 type (non-model)
|
||||||
LOGGER.info("allOf schema used by the property `{}` replaced by its only item (a type)", propName);
|
LOGGER.info("allOf schema used by the property `{}` replaced by its only item (a type)", propName);
|
||||||
props.put(propName, m.getAllOf().get(0));
|
props.put(propName, (Schema) prop.getAllOf().get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -357,71 +355,69 @@ public class InlineModelResolver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check allOf, anyOf, oneOf for inline models
|
// Check allOf, anyOf, oneOf for inline models
|
||||||
if (schema instanceof ComposedSchema) {
|
if (ModelUtils.isComposedSchema(schema)) {
|
||||||
ComposedSchema m = (ComposedSchema) schema;
|
if (schema.getAllOf() != null) {
|
||||||
if (m.getAllOf() != null) {
|
|
||||||
List<Schema> newAllOf = new ArrayList<Schema>();
|
List<Schema> newAllOf = new ArrayList<Schema>();
|
||||||
boolean atLeastOneModel = false;
|
boolean atLeastOneModel = false;
|
||||||
for (Schema inner : m.getAllOf()) {
|
for (Object inner : schema.getAllOf()) {
|
||||||
String schemaName = resolveModelName(inner.getTitle(), modelPrefix + "_allOf");
|
String schemaName = resolveModelName(((Schema) inner).getTitle(), modelPrefix + "_allOf");
|
||||||
// Recurse to create $refs for inner models
|
// Recurse to create $refs for inner models
|
||||||
gatherInlineModels(inner, schemaName);
|
gatherInlineModels((Schema) inner, schemaName);
|
||||||
if (isModelNeeded(inner)) {
|
if (isModelNeeded((Schema) inner)) {
|
||||||
if (Boolean.TRUE.equals(this.refactorAllOfInlineSchemas)) {
|
if (Boolean.TRUE.equals(this.refactorAllOfInlineSchemas)) {
|
||||||
Schema refSchema = this.makeSchemaInComponents(schemaName, inner);
|
Schema refSchema = this.makeSchemaInComponents(schemaName, (Schema) inner);
|
||||||
newAllOf.add(refSchema); // replace with ref
|
newAllOf.add(refSchema); // replace with ref
|
||||||
atLeastOneModel = true;
|
atLeastOneModel = true;
|
||||||
} else { // do not refactor allOf inline schemas
|
} else { // do not refactor allOf inline schemas
|
||||||
newAllOf.add(inner);
|
newAllOf.add((Schema) inner);
|
||||||
atLeastOneModel = true;
|
atLeastOneModel = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newAllOf.add(inner);
|
newAllOf.add((Schema) inner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (atLeastOneModel) {
|
if (atLeastOneModel) {
|
||||||
m.setAllOf(newAllOf);
|
schema.setAllOf(newAllOf);
|
||||||
} else {
|
} else {
|
||||||
// allOf is just one or more types only so do not generate the inline allOf model
|
// allOf is just one or more types only so do not generate the inline allOf model
|
||||||
if (m.getAllOf().size() == 1) {
|
if (schema.getAllOf().size() == 1) {
|
||||||
// handle earlier in this function when looping through properties
|
// handle earlier in this function when looping through properties
|
||||||
} else if (m.getAllOf().size() > 1) {
|
} else if (schema.getAllOf().size() > 1) {
|
||||||
LOGGER.warn("allOf schema `{}` containing multiple types (not model) is not supported at the moment.", schema.getName());
|
LOGGER.warn("allOf schema `{}` containing multiple types (not model) is not supported at the moment.", schema.getName());
|
||||||
} else {
|
} else {
|
||||||
LOGGER.error("allOf schema `{}` contains no items.", schema.getName());
|
LOGGER.error("allOf schema `{}` contains no items.", schema.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m.getAnyOf() != null) {
|
if (schema.getAnyOf() != null) {
|
||||||
List<Schema> newAnyOf = new ArrayList<Schema>();
|
List<Schema> newAnyOf = new ArrayList<Schema>();
|
||||||
for (Schema inner : m.getAnyOf()) {
|
for (Object inner : schema.getAnyOf()) {
|
||||||
String schemaName = resolveModelName(inner.getTitle(), modelPrefix + "_anyOf");
|
String schemaName = resolveModelName(((Schema) inner).getTitle(), modelPrefix + "_anyOf");
|
||||||
// Recurse to create $refs for inner models
|
// Recurse to create $refs for inner models
|
||||||
gatherInlineModels(inner, schemaName);
|
gatherInlineModels((Schema) inner, schemaName);
|
||||||
if (isModelNeeded(inner)) {
|
if (isModelNeeded((Schema) inner)) {
|
||||||
Schema refSchema = this.makeSchemaInComponents(schemaName, inner);
|
Schema refSchema = this.makeSchemaInComponents(schemaName, (Schema) inner);
|
||||||
newAnyOf.add(refSchema); // replace with ref
|
newAnyOf.add(refSchema); // replace with ref
|
||||||
} else {
|
} else {
|
||||||
newAnyOf.add(inner);
|
newAnyOf.add((Schema) inner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.setAnyOf(newAnyOf);
|
schema.setAnyOf(newAnyOf);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (m.getOneOf() != null) {
|
if (schema.getOneOf() != null) {
|
||||||
List<Schema> newOneOf = new ArrayList<Schema>();
|
List<Schema> newOneOf = new ArrayList<Schema>();
|
||||||
for (Schema inner : m.getOneOf()) {
|
for (Object inner : schema.getOneOf()) {
|
||||||
String schemaName = resolveModelName(inner.getTitle(), modelPrefix + "_oneOf");
|
String schemaName = resolveModelName(((Schema) inner).getTitle(), modelPrefix + "_oneOf");
|
||||||
// Recurse to create $refs for inner models
|
// Recurse to create $refs for inner models
|
||||||
gatherInlineModels(inner, schemaName);
|
gatherInlineModels((Schema) inner, schemaName);
|
||||||
if (isModelNeeded(inner)) {
|
if (isModelNeeded((Schema) inner)) {
|
||||||
Schema refSchema = this.makeSchemaInComponents(schemaName, inner);
|
Schema refSchema = this.makeSchemaInComponents(schemaName, (Schema) inner);
|
||||||
newOneOf.add(refSchema); // replace with ref
|
newOneOf.add(refSchema); // replace with ref
|
||||||
} else {
|
} else {
|
||||||
newOneOf.add(inner);
|
newOneOf.add((Schema) inner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.setOneOf(newOneOf);
|
schema.setOneOf(newOneOf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check not schema
|
// Check not schema
|
||||||
@@ -638,11 +634,10 @@ public class InlineModelResolver {
|
|||||||
} else if (ModelUtils.isOneOf(model)) { // contains oneOf only
|
} else if (ModelUtils.isOneOf(model)) { // contains oneOf only
|
||||||
gatherInlineModels(model, modelName);
|
gatherInlineModels(model, modelName);
|
||||||
} else if (ModelUtils.isComposedSchema(model)) {
|
} else if (ModelUtils.isComposedSchema(model)) {
|
||||||
ComposedSchema m = (ComposedSchema) model;
|
|
||||||
// inline child schemas
|
// inline child schemas
|
||||||
flattenComposedChildren(modelName + "_allOf", m.getAllOf(), !Boolean.TRUE.equals(this.refactorAllOfInlineSchemas));
|
flattenComposedChildren(modelName + "_allOf", model.getAllOf(), !Boolean.TRUE.equals(this.refactorAllOfInlineSchemas));
|
||||||
flattenComposedChildren(modelName + "_anyOf", m.getAnyOf(), false);
|
flattenComposedChildren(modelName + "_anyOf", model.getAnyOf(), false);
|
||||||
flattenComposedChildren(modelName + "_oneOf", m.getOneOf(), false);
|
flattenComposedChildren(modelName + "_oneOf", model.getOneOf(), false);
|
||||||
} else {
|
} else {
|
||||||
gatherInlineModels(model, modelName);
|
gatherInlineModels(model, modelName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.openapitools.codegen;
|
|||||||
|
|
||||||
import io.swagger.v3.oas.models.*;
|
import io.swagger.v3.oas.models.*;
|
||||||
import io.swagger.v3.oas.models.callbacks.Callback;
|
import io.swagger.v3.oas.models.callbacks.Callback;
|
||||||
|
import io.swagger.v3.oas.models.headers.Header;
|
||||||
import io.swagger.v3.oas.models.media.*;
|
import io.swagger.v3.oas.models.media.*;
|
||||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||||
@@ -87,6 +88,9 @@ public class OpenAPINormalizer {
|
|||||||
// the allOf contains a new schema containing the properties in the top level
|
// the allOf contains a new schema containing the properties in the top level
|
||||||
final String REFACTOR_ALLOF_WITH_PROPERTIES_ONLY = "REFACTOR_ALLOF_WITH_PROPERTIES_ONLY";
|
final String REFACTOR_ALLOF_WITH_PROPERTIES_ONLY = "REFACTOR_ALLOF_WITH_PROPERTIES_ONLY";
|
||||||
|
|
||||||
|
// when set to true, normalize OpenAPI 3.1 spec to make it work with the generator
|
||||||
|
final String NORMALIZE_31SPEC = "NORMALIZE_31SPEC";
|
||||||
|
|
||||||
// ============= end of rules =============
|
// ============= end of rules =============
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,6 +119,7 @@ public class OpenAPINormalizer {
|
|||||||
ruleNames.add(SET_TAGS_FOR_ALL_OPERATIONS);
|
ruleNames.add(SET_TAGS_FOR_ALL_OPERATIONS);
|
||||||
ruleNames.add(ADD_UNSIGNED_TO_INTEGER_WITH_INVALID_MAX_VALUE);
|
ruleNames.add(ADD_UNSIGNED_TO_INTEGER_WITH_INVALID_MAX_VALUE);
|
||||||
ruleNames.add(REFACTOR_ALLOF_WITH_PROPERTIES_ONLY);
|
ruleNames.add(REFACTOR_ALLOF_WITH_PROPERTIES_ONLY);
|
||||||
|
ruleNames.add(NORMALIZE_31SPEC);
|
||||||
|
|
||||||
// rules that are default to true
|
// rules that are default to true
|
||||||
rules.put(SIMPLIFY_ONEOF_ANYOF, true);
|
rules.put(SIMPLIFY_ONEOF_ANYOF, true);
|
||||||
@@ -148,7 +153,7 @@ public class OpenAPINormalizer {
|
|||||||
|
|
||||||
// loop through all the rules
|
// loop through all the rules
|
||||||
for (Map.Entry<String, String> rule : inputRules.entrySet()) {
|
for (Map.Entry<String, String> rule : inputRules.entrySet()) {
|
||||||
LOGGER.info("processing rule {} => {}", rule.getKey(), rule.getValue());
|
LOGGER.debug("processing rule {} => {}", rule.getKey(), rule.getValue());
|
||||||
if (!ruleNames.contains(rule.getKey())) { // invalid rule name
|
if (!ruleNames.contains(rule.getKey())) { // invalid rule name
|
||||||
LOGGER.warn("Invalid openapi-normalizer rule name: ", rule.getKey());
|
LOGGER.warn("Invalid openapi-normalizer rule name: ", rule.getKey());
|
||||||
} else if (enableAll) {
|
} else if (enableAll) {
|
||||||
@@ -247,11 +252,13 @@ public class OpenAPINormalizer {
|
|||||||
} else if (mediaType.getSchema() == null) {
|
} else if (mediaType.getSchema() == null) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
normalizeSchema(mediaType.getSchema(), new HashSet<>());
|
Schema newSchema = normalizeSchema(mediaType.getSchema(), new HashSet<>());
|
||||||
|
mediaType.setSchema(newSchema);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes schemas in RequestBody
|
* Normalizes schemas in RequestBody
|
||||||
*
|
*
|
||||||
@@ -291,7 +298,8 @@ public class OpenAPINormalizer {
|
|||||||
if (parameter.getSchema() == null) {
|
if (parameter.getSchema() == null) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
normalizeSchema(parameter.getSchema(), new HashSet<>());
|
Schema newSchema = normalizeSchema(parameter.getSchema(), new HashSet<>());
|
||||||
|
parameter.setSchema(newSchema);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,10 +320,29 @@ public class OpenAPINormalizer {
|
|||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
normalizeContent(responsesEntry.getValue().getContent());
|
normalizeContent(responsesEntry.getValue().getContent());
|
||||||
|
normalizeHeaders(responsesEntry.getValue().getHeaders());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalizes schemas in headers
|
||||||
|
*
|
||||||
|
* @param headers a map of headers
|
||||||
|
*/
|
||||||
|
private void normalizeHeaders(Map<String, Header> headers) {
|
||||||
|
if (headers == null || headers.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String headerKey : headers.keySet()) {
|
||||||
|
Header h = headers.get(headerKey);
|
||||||
|
Schema updatedHeader = normalizeSchema(h.getSchema(), new HashSet<>());
|
||||||
|
h.setSchema(updatedHeader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes schemas in components
|
* Normalizes schemas in components
|
||||||
*/
|
*/
|
||||||
@@ -408,7 +435,7 @@ public class OpenAPINormalizer {
|
|||||||
} else if (schema instanceof IntegerSchema) {
|
} else if (schema instanceof IntegerSchema) {
|
||||||
normalizeIntegerSchema(schema, visitedSchemas);
|
normalizeIntegerSchema(schema, visitedSchemas);
|
||||||
} else if (schema instanceof Schema) {
|
} else if (schema instanceof Schema) {
|
||||||
normalizeSchemaWithOnlyProperties(schema, visitedSchemas);
|
return normalizeSimpleSchema(schema, visitedSchemas);
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("Unknown schema type found in normalizer: " + schema);
|
throw new RuntimeException("Unknown schema type found in normalizer: " + schema);
|
||||||
}
|
}
|
||||||
@@ -416,6 +443,10 @@ public class OpenAPINormalizer {
|
|||||||
return schema;
|
return schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Schema normalizeSimpleSchema(Schema schema, Set<Schema> visitedSchemas) {
|
||||||
|
return processNormalize31Spec(schema, visitedSchemas);
|
||||||
|
}
|
||||||
|
|
||||||
private void normalizeBooleanSchema(Schema schema, Set<Schema> visitedSchemas) {
|
private void normalizeBooleanSchema(Schema schema, Set<Schema> visitedSchemas) {
|
||||||
processSimplifyBooleanEnum(schema);
|
processSimplifyBooleanEnum(schema);
|
||||||
}
|
}
|
||||||
@@ -424,10 +455,6 @@ public class OpenAPINormalizer {
|
|||||||
processAddUnsignedToIntegerWithInvalidMaxValue(schema);
|
processAddUnsignedToIntegerWithInvalidMaxValue(schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void normalizeSchemaWithOnlyProperties(Schema schema, Set<Schema> visitedSchemas) {
|
|
||||||
// normalize non-composed schema (e.g. schema with only properties)
|
|
||||||
}
|
|
||||||
|
|
||||||
private void normalizeProperties(Map<String, Schema> properties, Set<Schema> visitedSchemas) {
|
private void normalizeProperties(Map<String, Schema> properties, Set<Schema> visitedSchemas) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
return;
|
return;
|
||||||
@@ -670,9 +697,9 @@ public class OpenAPINormalizer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the schema is of type 'null'
|
* Check if the schema is of type 'null'
|
||||||
*
|
* <p>
|
||||||
* Return true if the schema's type is 'null' or not specified
|
* Return true if the schema's type is 'null' or not specified
|
||||||
*
|
*
|
||||||
* @param schema Schema
|
* @param schema Schema
|
||||||
*/
|
*/
|
||||||
private boolean isNullTypeSchema(Schema schema) {
|
private boolean isNullTypeSchema(Schema schema) {
|
||||||
@@ -803,7 +830,7 @@ public class OpenAPINormalizer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* When set to true, refactor schema with allOf and properties in the same level to a schema with allOf only and
|
* When set to true, refactor schema with allOf and properties in the same level to a schema with allOf only and
|
||||||
* the allOf contains a new schema containing the properties in the top level.
|
* the allOf contains a new schema containing the properties in the top level.
|
||||||
*
|
*
|
||||||
@@ -844,5 +871,75 @@ public class OpenAPINormalizer {
|
|||||||
return schema;
|
return schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When set to true, normalize schema so that it works well with the generator.
|
||||||
|
*
|
||||||
|
* @param schema Schema
|
||||||
|
* @param visitedSchemas a set of visited schemas
|
||||||
|
* @return Schema
|
||||||
|
*/
|
||||||
|
private Schema processNormalize31Spec(Schema schema, Set<Schema> visitedSchemas) {
|
||||||
|
if (!getRule(NORMALIZE_31SPEC)) {
|
||||||
|
return schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (schema == null || schema.getTypes() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// process null
|
||||||
|
if (schema.getTypes().contains("null")) {
|
||||||
|
schema.setNullable(true);
|
||||||
|
schema.getTypes().remove("null");
|
||||||
|
}
|
||||||
|
|
||||||
|
// only one item (type) left
|
||||||
|
if (schema.getTypes().size() == 1) {
|
||||||
|
String type = String.valueOf(schema.getTypes().iterator().next());
|
||||||
|
if ("array".equals(type)) {
|
||||||
|
ArraySchema as = new ArraySchema();
|
||||||
|
as.setXml(schema.getXml());
|
||||||
|
// `items` is also a json schema
|
||||||
|
if (StringUtils.isNotEmpty(schema.getItems().get$ref())) {
|
||||||
|
Schema ref = new Schema();
|
||||||
|
ref.set$ref(schema.getItems().get$ref());
|
||||||
|
as.setItems(ref);
|
||||||
|
} else { // inline schema (e.g. model, string, etc)
|
||||||
|
Schema updatedItems = normalizeSchema(schema.getItems(), visitedSchemas);
|
||||||
|
as.setItems(updatedItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
return as;
|
||||||
|
} else { // other primitive type such as string
|
||||||
|
// set type (3.0 spec) directly
|
||||||
|
schema.setType(type);
|
||||||
|
}
|
||||||
|
} else { // more than 1 item
|
||||||
|
// convert to anyOf and keep all other attributes (e.g. nullable, description)
|
||||||
|
// the same. No need to handle null as it should have been removed at this point.
|
||||||
|
for (Object type : schema.getTypes()) {
|
||||||
|
switch (String.valueOf(type)) {
|
||||||
|
case "string":
|
||||||
|
schema.addAnyOfItem(new StringSchema());
|
||||||
|
break;
|
||||||
|
case "integer":
|
||||||
|
schema.addAnyOfItem(new IntegerSchema());
|
||||||
|
break;
|
||||||
|
case "number":
|
||||||
|
schema.addAnyOfItem(new NumberSchema());
|
||||||
|
break;
|
||||||
|
case "boolean":
|
||||||
|
schema.addAnyOfItem(new BooleanSchema());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOGGER.error("Type {} not yet supported in openapi-normalizer to process OpenAPI 3.1 spec with multiple types.");
|
||||||
|
LOGGER.error("Please report the issue via https://github.com/OpenAPITools/openapi-generator/issues/new/.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return schema;
|
||||||
|
}
|
||||||
|
|
||||||
// ===================== end of rules =====================
|
// ===================== end of rules =====================
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -753,6 +753,7 @@ public class CodegenConfigurator {
|
|||||||
|
|
||||||
ClientOptInput input = new ClientOptInput()
|
ClientOptInput input = new ClientOptInput()
|
||||||
.config(config)
|
.config(config)
|
||||||
|
.generatorSettings(generatorSettings)
|
||||||
.userDefinedTemplates(userDefinedTemplates);
|
.userDefinedTemplates(userDefinedTemplates);
|
||||||
|
|
||||||
return input.openAPI((OpenAPI)context.getSpecDocument());
|
return input.openAPI((OpenAPI)context.getSpecDocument());
|
||||||
|
|||||||
@@ -287,10 +287,8 @@ public class ExampleGenerator {
|
|||||||
return "https://openapi-generator.tech";
|
return "https://openapi-generator.tech";
|
||||||
} else if (ModelUtils.isStringSchema(property)) {
|
} else if (ModelUtils.isStringSchema(property)) {
|
||||||
LOGGER.debug("String property");
|
LOGGER.debug("String property");
|
||||||
String defaultValue = (String) property.getDefault();
|
if (property.getDefault() != null) {
|
||||||
if (defaultValue != null && !defaultValue.isEmpty()) {
|
return String.valueOf(property.getDefault());
|
||||||
LOGGER.debug("Default value found: '{}'", defaultValue);
|
|
||||||
return defaultValue;
|
|
||||||
}
|
}
|
||||||
List<String> enumValues = property.getEnum();
|
List<String> enumValues = property.getEnum();
|
||||||
if (enumValues != null && !enumValues.isEmpty()) {
|
if (enumValues != null && !enumValues.isEmpty()) {
|
||||||
|
|||||||
@@ -759,8 +759,10 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
|||||||
}
|
}
|
||||||
|
|
||||||
CodegenProperty returnProperty = op.returnProperty;
|
CodegenProperty returnProperty = op.returnProperty;
|
||||||
|
CodegenProperty returnType = null;
|
||||||
if (returnProperty != null) {
|
if (returnProperty != null) {
|
||||||
CodegenProperty itemType = returnProperty.getItems();
|
CodegenProperty itemType = returnProperty.getItems();
|
||||||
|
returnType = itemType;
|
||||||
if (itemType != null) {
|
if (itemType != null) {
|
||||||
String dataType;
|
String dataType;
|
||||||
if (itemType.vendorExtensions.containsKey(X_ADA_VECTOR_TYPE_NAME)) {
|
if (itemType.vendorExtensions.containsKey(X_ADA_VECTOR_TYPE_NAME)) {
|
||||||
@@ -778,6 +780,73 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (CodegenResponse rsp : op.responses) {
|
||||||
|
|
||||||
|
if (rsp.dataType != null) {
|
||||||
|
String dataType = rsp.dataType;
|
||||||
|
if (returnType != null) {
|
||||||
|
if (returnType.vendorExtensions.containsKey(X_ADA_VECTOR_TYPE_NAME)) {
|
||||||
|
dataType = (String) returnType.vendorExtensions.get(X_ADA_VECTOR_TYPE_NAME);
|
||||||
|
rsp.vendorExtensions.put(X_ADA_TYPE_NAME, dataType);
|
||||||
|
}
|
||||||
|
rsp.vendorExtensions.put("x-is-model-type", isModelType(returnType));
|
||||||
|
rsp.vendorExtensions.put("x-is-stream-type", isStreamType(returnType));
|
||||||
|
rsp.vendorExtensions.put("x-is-nullable", returnType.isNull);
|
||||||
|
|
||||||
|
// Convert optional members to use the Nullable_<T> type.
|
||||||
|
Boolean required = returnType.getHasRequired();
|
||||||
|
if (!Boolean.TRUE.equals(required) && nullableTypeMapping.containsKey(dataType)) {
|
||||||
|
rsp.dataType = nullableTypeMapping.get(dataType);
|
||||||
|
rsp.vendorExtensions.put("x-is-required", false);
|
||||||
|
} else {
|
||||||
|
rsp.vendorExtensions.put("x-is-required", true);
|
||||||
|
}
|
||||||
|
if (!rsp.vendorExtensions.containsKey(X_ADA_SERIALIZE_OP)) {
|
||||||
|
if (returnType.isLong && !required) {
|
||||||
|
rsp.vendorExtensions.put(X_ADA_SERIALIZE_OP, "Write_Entity");
|
||||||
|
} else if (rsp.isLong && "int64".equals(returnType.dataFormat)) {
|
||||||
|
rsp.vendorExtensions.put(X_ADA_SERIALIZE_OP, "Write_Long_Entity");
|
||||||
|
} else {
|
||||||
|
rsp.vendorExtensions.put(X_ADA_SERIALIZE_OP, "Write_Entity");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rsp.vendorExtensions.put("x-scz-return", true);
|
||||||
|
} else {
|
||||||
|
rsp.vendorExtensions.put("x-scz-no-return", true);
|
||||||
|
if (returnProperty != null) {
|
||||||
|
if (!rsp.vendorExtensions.containsKey(X_ADA_TYPE_NAME)) {
|
||||||
|
rsp.vendorExtensions.put(X_ADA_TYPE_NAME, returnProperty.dataType);
|
||||||
|
}
|
||||||
|
rsp.vendorExtensions.put("x-is-model-type", isModelType(returnProperty));
|
||||||
|
rsp.vendorExtensions.put("x-is-stream-type", isStreamType(returnProperty));
|
||||||
|
rsp.vendorExtensions.put("x-is-nullable", returnProperty.isNull);
|
||||||
|
|
||||||
|
// Convert optional members to use the Nullable_<T> type.
|
||||||
|
Boolean required = returnProperty.getHasRequired();
|
||||||
|
if (!Boolean.TRUE.equals(required) && nullableTypeMapping.containsKey(dataType)) {
|
||||||
|
rsp.dataType = nullableTypeMapping.get(dataType);
|
||||||
|
rsp.vendorExtensions.put("x-is-required", false);
|
||||||
|
} else {
|
||||||
|
rsp.vendorExtensions.put("x-is-required", true);
|
||||||
|
}
|
||||||
|
if (!rsp.vendorExtensions.containsKey(X_ADA_SERIALIZE_OP)) {
|
||||||
|
if (returnProperty.isLong && !required) {
|
||||||
|
rsp.vendorExtensions.put(X_ADA_SERIALIZE_OP, "Write_Entity");
|
||||||
|
} else if (rsp.isLong && "int64".equals(returnProperty.dataFormat)) {
|
||||||
|
rsp.vendorExtensions.put(X_ADA_SERIALIZE_OP, "Write_Long_Entity");
|
||||||
|
} else {
|
||||||
|
rsp.vendorExtensions.put(X_ADA_SERIALIZE_OP, "Write_Entity");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (CodegenProperty header : rsp.headers) {
|
||||||
|
header.nameInCamelCase = toModelName(header.baseName);
|
||||||
|
header.nameInLowerCase = header.baseName.toLowerCase(Locale.ROOT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan the path parameter to construct a x-path-index that tells the index of
|
* Scan the path parameter to construct a x-path-index that tells the index of
|
||||||
* the path parameter.
|
* the path parameter.
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
|||||||
return "null";
|
return "null";
|
||||||
} else if (ModelUtils.isStringSchema(p)) {
|
} else if (ModelUtils.isStringSchema(p)) {
|
||||||
if (p.getDefault() != null) {
|
if (p.getDefault() != null) {
|
||||||
String _default = (String) p.getDefault();
|
String _default = String.valueOf(p.getDefault());
|
||||||
if (p.getEnum() == null) {
|
if (p.getEnum() == null) {
|
||||||
return "\"" + escapeText(_default) + "\"";
|
return "\"" + escapeText(_default) + "\"";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import io.swagger.v3.oas.models.media.ArraySchema;
|
|||||||
import io.swagger.v3.oas.models.media.Schema;
|
import io.swagger.v3.oas.models.media.Schema;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.text.StringEscapeUtils;
|
||||||
import org.openapitools.codegen.*;
|
import org.openapitools.codegen.*;
|
||||||
import org.openapitools.codegen.model.ModelMap;
|
import org.openapitools.codegen.model.ModelMap;
|
||||||
import org.openapitools.codegen.model.ModelsMap;
|
import org.openapitools.codegen.model.ModelsMap;
|
||||||
@@ -58,6 +59,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
protected boolean returnICollection = false;
|
protected boolean returnICollection = false;
|
||||||
protected boolean netCoreProjectFileFlag = false;
|
protected boolean netCoreProjectFileFlag = false;
|
||||||
protected boolean nullReferenceTypesFlag = false;
|
protected boolean nullReferenceTypesFlag = false;
|
||||||
|
protected boolean useSourceGeneration = false;
|
||||||
|
|
||||||
protected String modelPropertyNaming = CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.PascalCase.name();
|
protected String modelPropertyNaming = CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.PascalCase.name();
|
||||||
|
|
||||||
@@ -415,12 +417,15 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
.put("required", new RequiredParameterLambda())
|
.put("required", new RequiredParameterLambda())
|
||||||
.put("optional", new OptionalParameterLambda().generator(this))
|
.put("optional", new OptionalParameterLambda().generator(this))
|
||||||
.put("joinWithComma", new JoinWithCommaLambda())
|
.put("joinWithComma", new JoinWithCommaLambda())
|
||||||
|
.put("joinLinesWithComma", new JoinWithCommaLambda(false, "\n", ",\n"))
|
||||||
.put("trimLineBreaks", new TrimLineBreaksLambda())
|
.put("trimLineBreaks", new TrimLineBreaksLambda())
|
||||||
.put("trimTrailingWithNewLine", new TrimTrailingWhiteSpaceLambda(true))
|
.put("trimTrailingWithNewLine", new TrimTrailingWhiteSpaceLambda(true))
|
||||||
|
.put("trimTrailing", new TrimTrailingWhiteSpaceLambda(false))
|
||||||
.put("first", new FirstLambda(" "))
|
.put("first", new FirstLambda(" "))
|
||||||
.put("firstDot", new FirstLambda("\\."))
|
.put("firstDot", new FirstLambda("\\."))
|
||||||
.put("indent3", new IndentedLambda(12, " ", false))
|
.put("indent3", new IndentedLambda(12, " ", false))
|
||||||
.put("indent4", new IndentedLambda(16, " ", false));
|
.put("indent4", new IndentedLambda(16, " ", false))
|
||||||
|
.put("uniqueLinesWithNewLine", new UniqueLambda("\n", true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1349,6 +1354,14 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
return this.nullReferenceTypesFlag;
|
return this.nullReferenceTypesFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUseSourceGeneration(final Boolean useSourceGeneration) {
|
||||||
|
this.useSourceGeneration = useSourceGeneration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getUseSourceGeneration() {
|
||||||
|
return this.useSourceGeneration;
|
||||||
|
}
|
||||||
|
|
||||||
public void setInterfacePrefix(final String interfacePrefix) {
|
public void setInterfacePrefix(final String interfacePrefix) {
|
||||||
this.interfacePrefix = interfacePrefix;
|
this.interfacePrefix = interfacePrefix;
|
||||||
}
|
}
|
||||||
@@ -1381,7 +1394,13 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return escapeText(value);
|
final String partiallyEscaped = value
|
||||||
|
.replace("\n", "\\n")
|
||||||
|
.replace("\t", "\\t")
|
||||||
|
.replace("\r", "\\r")
|
||||||
|
.replaceAll("(?<!\\\\)\"", "\\\\\"");
|
||||||
|
|
||||||
|
return escapeUnsafeCharacters(partiallyEscaped);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -795,7 +795,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
|||||||
}
|
}
|
||||||
} else if (ModelUtils.isStringSchema(p)) {
|
} else if (ModelUtils.isStringSchema(p)) {
|
||||||
if (p.getDefault() != null) {
|
if (p.getDefault() != null) {
|
||||||
String _default = (String) p.getDefault();
|
String _default = String.valueOf(p.getDefault());
|
||||||
if (p.getEnum() == null) {
|
if (p.getEnum() == null) {
|
||||||
return "\"" + _default + "\"";
|
return "\"" + _default + "\"";
|
||||||
} else {
|
} else {
|
||||||
@@ -1133,5 +1133,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.F_SHARP; }
|
public GeneratorLanguage generatorLanguage() {
|
||||||
|
return GeneratorLanguage.F_SHARP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -986,10 +986,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
final_values.add(element.asText());
|
final_values.add(element.asText());
|
||||||
});
|
});
|
||||||
} else if (schema.getDefault() instanceof Collection) {
|
} else if (schema.getDefault() instanceof Collection) {
|
||||||
var _default = (Collection<String>) schema.getDefault();
|
var _default = (Collection<Object>) schema.getDefault();
|
||||||
List<String> final_values = _values;
|
List<String> final_values = _values;
|
||||||
_default.forEach((element) -> {
|
_default.forEach((element) -> {
|
||||||
final_values.add(element);
|
final_values.add(String.valueOf(element));
|
||||||
});
|
});
|
||||||
} else { // single value
|
} else { // single value
|
||||||
_values = java.util.Collections.singletonList(String.valueOf(schema.getDefault()));
|
_values = java.util.Collections.singletonList(String.valueOf(schema.getDefault()));
|
||||||
@@ -1062,7 +1062,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
} else { // has default value
|
} else { // has default value
|
||||||
return toArrayDefaultValue(cp, schema);
|
return toArrayDefaultValue(cp, schema);
|
||||||
}
|
}
|
||||||
} else if (ModelUtils.isMapSchema(schema) && !(schema instanceof ComposedSchema)) {
|
} else if (ModelUtils.isMapSchema(schema) && !(ModelUtils.isComposedSchema(schema))) {
|
||||||
if (schema.getProperties() != null && schema.getProperties().size() > 0) {
|
if (schema.getProperties() != null && schema.getProperties().size() > 0) {
|
||||||
// object is complex object with free-form additional properties
|
// object is complex object with free-form additional properties
|
||||||
if (schema.getDefault() != null) {
|
if (schema.getDefault() != null) {
|
||||||
@@ -1349,8 +1349,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
if (example == null) {
|
if (example == null) {
|
||||||
example = "null";
|
example = "null";
|
||||||
} else if (Boolean.TRUE.equals(p.isArray)) {
|
} else if (Boolean.TRUE.equals(p.isArray)) {
|
||||||
|
if (p.items != null && p.items.defaultValue != null) {
|
||||||
if (p.items.defaultValue != null) {
|
|
||||||
String innerExample;
|
String innerExample;
|
||||||
if ("String".equals(p.items.dataType)) {
|
if ("String".equals(p.items.dataType)) {
|
||||||
innerExample = "\"" + p.items.defaultValue + "\"";
|
innerExample = "\"" + p.items.defaultValue + "\"";
|
||||||
@@ -1646,11 +1645,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
.map(Schema::getProperties))
|
.map(Schema::getProperties))
|
||||||
.forEach(schemas -> schemas.replaceAll(
|
.forEach(schemas -> schemas.replaceAll(
|
||||||
(name, s) -> Stream.of(s)
|
(name, s) -> Stream.of(s)
|
||||||
.filter(schema -> schema instanceof ComposedSchema)
|
.filter(schema -> ModelUtils.isComposedSchema((Schema) schema))
|
||||||
.map(schema -> (ComposedSchema) schema)
|
//.map(schema -> (ComposedSchema) schema)
|
||||||
.filter(schema -> Objects.nonNull(schema.getAnyOf()))
|
.filter(schema -> Objects.nonNull(((Schema) schema).getAnyOf()))
|
||||||
.flatMap(schema -> schema.getAnyOf().stream())
|
.flatMap(schema -> ((Schema) schema).getAnyOf().stream())
|
||||||
.filter(schema -> Objects.nonNull(schema.getEnum()))
|
.filter(schema -> Objects.nonNull(((Schema) schema).getEnum()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse((Schema) s)));
|
.orElse((Schema) s)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ public abstract class AbstractJuliaCodegen extends DefaultCodegen {
|
|||||||
} else if (ModelUtils.isIntegerSchema(schema) || ModelUtils.isLongSchema(schema) || ModelUtils.isNumberSchema(schema)) {
|
} else if (ModelUtils.isIntegerSchema(schema) || ModelUtils.isLongSchema(schema) || ModelUtils.isNumberSchema(schema)) {
|
||||||
return schema.getDefault().toString();
|
return schema.getDefault().toString();
|
||||||
} else if (ModelUtils.isStringSchema(schema)) {
|
} else if (ModelUtils.isStringSchema(schema)) {
|
||||||
String _default = (String) schema.getDefault();
|
String _default = String.valueOf(schema.getDefault());
|
||||||
return "\"" + _default + "\"";
|
return "\"" + _default + "\"";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1143,7 +1143,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
|||||||
* ModelUtils.isMapSchema
|
* ModelUtils.isMapSchema
|
||||||
* In other generators, isMap is true for all type object schemas
|
* In other generators, isMap is true for all type object schemas
|
||||||
*/
|
*/
|
||||||
if (schema.getProperties() != null || schema.getRequired() != null && !(schema instanceof ComposedSchema)) {
|
if (schema.getProperties() != null || schema.getRequired() != null && !(ModelUtils.isComposedSchema(schema))) {
|
||||||
// passing null to allProperties and allRequired as there's no parent
|
// passing null to allProperties and allRequired as there's no parent
|
||||||
addVars(m, unaliasPropertySchema(schema.getProperties()), schema.getRequired(), null, null);
|
addVars(m, unaliasPropertySchema(schema.getProperties()), schema.getRequired(), null, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -454,6 +454,10 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
|||||||
this.srcBasePath = srcBasePath;
|
this.srcBasePath = srcBasePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTestBasePath(String testBasePath) {
|
||||||
|
this.testBasePath = testBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
public void setParameterNamingConvention(String variableNamingConvention) {
|
public void setParameterNamingConvention(String variableNamingConvention) {
|
||||||
this.variableNamingConvention = variableNamingConvention;
|
this.variableNamingConvention = variableNamingConvention;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,14 +182,16 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
|||||||
return p.getDefault().toString();
|
return p.getDefault().toString();
|
||||||
}
|
}
|
||||||
} else if (ModelUtils.isStringSchema(p)) {
|
} else if (ModelUtils.isStringSchema(p)) {
|
||||||
String defaultValue = (String)p.getDefault();
|
if (p.getDefault() != null) {
|
||||||
if (defaultValue != null) {
|
String defaultValue = String.valueOf(p.getDefault());
|
||||||
defaultValue = defaultValue.replace("\\", "\\\\")
|
if (defaultValue != null) {
|
||||||
.replace("'", "\'");
|
defaultValue = defaultValue.replace("\\", "\\\\")
|
||||||
if (Pattern.compile("\r\n|\r|\n").matcher(defaultValue).find()) {
|
.replace("'", "\'");
|
||||||
return "'''" + defaultValue + "'''";
|
if (Pattern.compile("\r\n|\r|\n").matcher(defaultValue).find()) {
|
||||||
} else {
|
return "'''" + defaultValue + "'''";
|
||||||
return "'" + defaultValue + "'";
|
} else {
|
||||||
|
return "'" + defaultValue + "'";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ModelUtils.isArraySchema(p)) {
|
} else if (ModelUtils.isArraySchema(p)) {
|
||||||
@@ -351,7 +353,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
|||||||
|
|
||||||
// correct "'"s into "'"s after toString()
|
// correct "'"s into "'"s after toString()
|
||||||
if (ModelUtils.isStringSchema(schema) && schema.getDefault() != null && !ModelUtils.isDateSchema(schema) && !ModelUtils.isDateTimeSchema(schema)) {
|
if (ModelUtils.isStringSchema(schema) && schema.getDefault() != null && !ModelUtils.isDateSchema(schema) && !ModelUtils.isDateTimeSchema(schema)) {
|
||||||
example = (String) schema.getDefault();
|
example = String.valueOf(schema.getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(example) && !"null".equals(example)) {
|
if (StringUtils.isNotBlank(example) && !"null".equals(example)) {
|
||||||
@@ -1745,6 +1747,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
|||||||
@Override
|
@Override
|
||||||
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) {
|
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) {
|
||||||
hasModelsToImport = false;
|
hasModelsToImport = false;
|
||||||
|
boolean importAnnotated = false;
|
||||||
TreeSet<String> typingImports = new TreeSet<>();
|
TreeSet<String> typingImports = new TreeSet<>();
|
||||||
TreeSet<String> pydanticImports = new TreeSet<>();
|
TreeSet<String> pydanticImports = new TreeSet<>();
|
||||||
TreeSet<String> datetimeImports = new TreeSet<>();
|
TreeSet<String> datetimeImports = new TreeSet<>();
|
||||||
@@ -1805,6 +1808,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
|||||||
param.vendorExtensions.put("x-py-typing", typing);
|
param.vendorExtensions.put("x-py-typing", typing);
|
||||||
} else {
|
} else {
|
||||||
param.vendorExtensions.put("x-py-typing", String.format(Locale.ROOT, "Annotated[%s, %s]", typing, fieldCustomization));
|
param.vendorExtensions.put("x-py-typing", String.format(Locale.ROOT, "Annotated[%s, %s]", typing, fieldCustomization));
|
||||||
|
importAnnotated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1836,6 +1840,12 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
|||||||
|
|
||||||
List<Map<String, String>> newImports = new ArrayList<>();
|
List<Map<String, String>> newImports = new ArrayList<>();
|
||||||
|
|
||||||
|
if (importAnnotated) {
|
||||||
|
Map<String, String> item = new HashMap<>();
|
||||||
|
item.put("import", String.format(Locale.ROOT, String.format(Locale.ROOT, "from typing_extensions import Annotated")));
|
||||||
|
newImports.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
// need datetime import
|
// need datetime import
|
||||||
if (!datetimeImports.isEmpty()) {
|
if (!datetimeImports.isEmpty()) {
|
||||||
Map<String, String> item = new HashMap<>();
|
Map<String, String> item = new HashMap<>();
|
||||||
|
|||||||
@@ -204,6 +204,20 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
|
|||||||
return addRegularExpressionDelimiter(pattern);
|
return addRegularExpressionDelimiter(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String addRegularExpressionDelimiter(String pattern) {
|
||||||
|
if (StringUtils.isEmpty(pattern)) {
|
||||||
|
return pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pattern.matches("^/.*")) {
|
||||||
|
// Perform a negative lookbehind on each `/` to ensure that it is escaped.
|
||||||
|
return "/" + pattern.replaceAll("(?<!\\\\)\\/", "\\\\/") + "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
return pattern;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toParamName(String name) {
|
public String toParamName(String name) {
|
||||||
// obtain the name from parameterNameMapping directly if provided
|
// obtain the name from parameterNameMapping directly if provided
|
||||||
|
|||||||
@@ -512,9 +512,9 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toParamName(String name) {
|
public String toParamName(String name) {
|
||||||
// obtain the name from nameMapping directly if provided
|
// obtain the name from parameterNameMapping directly if provided
|
||||||
if (nameMapping.containsKey(name)) {
|
if (parameterNameMapping.containsKey(name)) {
|
||||||
return nameMapping.get(name);
|
return parameterNameMapping.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
name = sanitizeName(name, "[^\\w$]");
|
name = sanitizeName(name, "[^\\w$]");
|
||||||
@@ -557,6 +557,11 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toModelName(final String name) {
|
public String toModelName(final String name) {
|
||||||
|
// obtain the name from modelNameMapping directly if provided
|
||||||
|
if (modelNameMapping.containsKey(name)) {
|
||||||
|
return modelNameMapping.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
String fullModelName = name;
|
String fullModelName = name;
|
||||||
fullModelName = addPrefix(fullModelName, modelNamePrefix);
|
fullModelName = addPrefix(fullModelName, modelNamePrefix);
|
||||||
fullModelName = addSuffix(fullModelName, modelNameSuffix);
|
fullModelName = addSuffix(fullModelName, modelNameSuffix);
|
||||||
@@ -630,6 +635,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
|||||||
} else if (ModelUtils.isBinarySchema(p)) {
|
} else if (ModelUtils.isBinarySchema(p)) {
|
||||||
return "ArrayBuffer";
|
return "ArrayBuffer";
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getTypeDeclaration(p);
|
return super.getTypeDeclaration(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -754,6 +760,17 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSchemaType(Schema p) {
|
public String getSchemaType(Schema p) {
|
||||||
|
// check if $ref is a model and modelNameMapping is used
|
||||||
|
if (StringUtils.isNotBlank(p.get$ref())) {
|
||||||
|
Schema unaliasSchema = unaliasSchema(p);
|
||||||
|
Schema actualSchema = ModelUtils.getReferencedSchema(openAPI, unaliasSchema);
|
||||||
|
String modelName = ModelUtils.getSimpleRef(unaliasSchema.get$ref());
|
||||||
|
|
||||||
|
if (ModelUtils.isModel(actualSchema) && modelNameMapping.containsKey(modelName)) {
|
||||||
|
return toModelName(modelNameMapping.get(modelName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String openAPIType = super.getSchemaType(p);
|
String openAPIType = super.getSchemaType(p);
|
||||||
String type = null;
|
String type = null;
|
||||||
if (ModelUtils.isComposedSchema(p)) {
|
if (ModelUtils.isComposedSchema(p)) {
|
||||||
@@ -1118,21 +1135,21 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toAnyOfName(List<String> names, ComposedSchema composedSchema) {
|
public String toAnyOfName(List<String> names, Schema composedSchema) {
|
||||||
List<String> types = getTypesFromSchemas(composedSchema.getAnyOf());
|
List<String> types = getTypesFromSchemas(composedSchema.getAnyOf());
|
||||||
|
|
||||||
return String.join(" | ", types);
|
return String.join(" | ", types);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toOneOfName(List<String> names, ComposedSchema composedSchema) {
|
public String toOneOfName(List<String> names, Schema composedSchema) {
|
||||||
List<String> types = getTypesFromSchemas(composedSchema.getOneOf());
|
List<String> types = getTypesFromSchemas(composedSchema.getOneOf());
|
||||||
|
|
||||||
return String.join(" | ", types);
|
return String.join(" | ", types);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toAllOfName(List<String> names, ComposedSchema composedSchema) {
|
public String toAllOfName(List<String> names, Schema composedSchema) {
|
||||||
List<String> types = getTypesFromSchemas(composedSchema.getAllOf());
|
List<String> types = getTypesFromSchemas(composedSchema.getAllOf());
|
||||||
|
|
||||||
return String.join(" & ", types);
|
return String.join(" & ", types);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user