mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-02-23 20:00:58 +00:00
Compare commits
107 Commits
python-ser
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4b64c4e5a | ||
|
|
4f00a34df6 | ||
|
|
1894a07c2c | ||
|
|
7cb6256bef | ||
|
|
c698c9fb3a | ||
|
|
c76700fcf4 | ||
|
|
d6c29051e3 | ||
|
|
6df3c420b0 | ||
|
|
e76e744a7a | ||
|
|
99d42520a9 | ||
|
|
1c49d5c342 | ||
|
|
3252fcf619 | ||
|
|
9432aaf4a3 | ||
|
|
bd7fc7f45f | ||
|
|
67a637fe8d | ||
|
|
561aa2e107 | ||
|
|
ff7fd36876 | ||
|
|
b1022e7a7e | ||
|
|
f9f411945d | ||
|
|
5a70edb063 | ||
|
|
2a2e470165 | ||
|
|
fffc21e3ee | ||
|
|
3d05d5aa9a | ||
|
|
73dcdd6976 | ||
|
|
a8ccfad285 | ||
|
|
3c092b4c30 | ||
|
|
45c3692fa0 | ||
|
|
4a17fcd007 | ||
|
|
1e71920d2b | ||
|
|
5e5ef12f86 | ||
|
|
e086c300ca | ||
|
|
1c25f2c39c | ||
|
|
8d998bf90c | ||
|
|
a53ebb3ad2 | ||
|
|
aeea8b1254 | ||
|
|
b96334ffad | ||
|
|
d47ab0f545 | ||
|
|
c804b46f0c | ||
|
|
96bfa522fb | ||
|
|
893e220fec | ||
|
|
b39aad0d56 | ||
|
|
33cce11a1d | ||
|
|
f5b4850cab | ||
|
|
6b7c3d069e | ||
|
|
a7d57cafff | ||
|
|
8d88b8219d | ||
|
|
2ee50ce900 | ||
|
|
c18015cccd | ||
|
|
7eeab03a57 | ||
|
|
59042aa647 | ||
|
|
d81b0524af | ||
|
|
54fe232d67 | ||
|
|
459f359bf4 | ||
|
|
07d60e010a | ||
|
|
38f0796759 | ||
|
|
561e5bf9ab | ||
|
|
9547ebdc98 | ||
|
|
48b7c85cd4 | ||
|
|
3ecb49060e | ||
|
|
40a0f6f83d | ||
|
|
a973d91560 | ||
|
|
b07f28604e | ||
|
|
d284a9aef1 | ||
|
|
de3bbd5e4e | ||
|
|
a25bed78cd | ||
|
|
aaa3500419 | ||
|
|
7c5f7cf4e5 | ||
|
|
2ab70fa46b | ||
|
|
95911180f6 | ||
|
|
1cafc1673a | ||
|
|
268213004e | ||
|
|
ad2044c581 | ||
|
|
f3a21a8bba | ||
|
|
811529cb66 | ||
|
|
883bd56ea9 | ||
|
|
897590ae6a | ||
|
|
3c052d8b64 | ||
|
|
34dc09b676 | ||
|
|
f8e1fadf4e | ||
|
|
41a8573437 | ||
|
|
fd17603109 | ||
|
|
7506b6ca02 | ||
|
|
3df34f6aab | ||
|
|
95e8360c19 | ||
|
|
ba8327386c | ||
|
|
8b6df51cdf | ||
|
|
66a211ec56 | ||
|
|
4da2d8095d | ||
|
|
d26f67c576 | ||
|
|
63151d3a68 | ||
|
|
6f211a20e8 | ||
|
|
82ad061fe9 | ||
|
|
063a780c7a | ||
|
|
b4430804c1 | ||
|
|
c56ea5557a | ||
|
|
a625300e3f | ||
|
|
8b563222bd | ||
|
|
572b315f8b | ||
|
|
c5993af2ea | ||
|
|
f7ac63a188 | ||
|
|
c0d555ba4a | ||
|
|
683b024154 | ||
|
|
3db927e060 | ||
|
|
9fa18d0c81 | ||
|
|
6022e4ec7d | ||
|
|
11e06d1e77 | ||
|
|
3ed013966b |
59
.github/workflows/samples-cpp-httplib-server.yaml
vendored
Normal file
59
.github/workflows/samples-cpp-httplib-server.yaml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
name: Samples cpp httplib server
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "samples/server/petstore/cpp-httplib-server/**"
|
||||
- ".github/workflows/samples-cpp-httplib-server.yaml"
|
||||
pull_request:
|
||||
paths:
|
||||
- "samples/server/petstore/cpp-httplib-server/**"
|
||||
- ".github/workflows/samples-cpp-httplib-server.yaml"
|
||||
|
||||
env:
|
||||
GRADLE_VERSION: 6.9
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build cpp httplib server
|
||||
strategy:
|
||||
matrix:
|
||||
sample:
|
||||
- samples/server/petstore/cpp-httplib-server/petstore
|
||||
- samples/server/petstore/cpp-httplib-server/feature-test
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macOS-latest
|
||||
- windows-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies (Linux)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential libssl-dev zlib1g-dev cmake
|
||||
|
||||
- name: Install dependencies (macOS)
|
||||
if: matrix.os == 'macOS-latest'
|
||||
run: |
|
||||
brew install openssl zlib cmake
|
||||
|
||||
- name: Install dependencies (Windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
vcpkg install openssl:x64-windows zlib:x64-windows
|
||||
shell: cmd
|
||||
timeout-minutes: 20
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: |
|
||||
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
||||
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||
else
|
||||
cmake -S . -B build
|
||||
fi
|
||||
cmake --build build --verbose
|
||||
shell: bash
|
||||
12
.github/workflows/samples-groovy.yaml
vendored
12
.github/workflows/samples-groovy.yaml
vendored
@@ -20,6 +20,14 @@ jobs:
|
||||
matrix:
|
||||
sample:
|
||||
- samples/client/petstore/groovy
|
||||
services:
|
||||
petstore-api:
|
||||
image: swaggerapi/petstore
|
||||
ports:
|
||||
- 80:8080
|
||||
env:
|
||||
SWAGGER_HOST: http://petstore.swagger.io
|
||||
SWAGGER_BASE_PATH: /v2
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-java@v5
|
||||
@@ -41,6 +49,6 @@ jobs:
|
||||
gradle-version: ${{ env.GRADLE_VERSION }}
|
||||
build-root-directory: ${{ matrix.sample }}
|
||||
arguments: wrapper
|
||||
- name: Build
|
||||
- name: Build & Test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: ./gradlew build -x test
|
||||
run: ./gradlew build
|
||||
|
||||
3
.github/workflows/samples-jdk17.yaml
vendored
3
.github/workflows/samples-jdk17.yaml
vendored
@@ -14,6 +14,7 @@ on:
|
||||
- samples/client/petstore/java/microprofile-rest-client-outer-enum/**
|
||||
# servers
|
||||
- samples/openapi3/server/petstore/springboot-3/**
|
||||
- samples/server/petstore/springboot-x-implements-skip/**
|
||||
- samples/server/petstore/java-camel/**
|
||||
- samples/server/petstore/java-helidon-server/v3/mp/**
|
||||
- samples/server/petstore/java-helidon-server/v3/se/**
|
||||
@@ -31,6 +32,7 @@ on:
|
||||
- samples/client/petstore/java/microprofile-rest-client-outer-enum/**
|
||||
# servers
|
||||
- samples/openapi3/server/petstore/springboot-3/**
|
||||
- samples/server/petstore/springboot-x-implements-skip/**
|
||||
- samples/server/petstore/java-camel/**
|
||||
- samples/server/petstore/java-helidon-server/v3/mp/**
|
||||
- samples/server/petstore/java-helidon-server/v3/se/**
|
||||
@@ -54,6 +56,7 @@ jobs:
|
||||
- samples/client/petstore/java/microprofile-rest-client-outer-enum
|
||||
# servers
|
||||
- samples/openapi3/server/petstore/springboot-3
|
||||
- samples/server/petstore/springboot-x-implements-skip
|
||||
- samples/server/petstore/java-camel/
|
||||
- samples/server/petstore/java-helidon-server/v3/mp/
|
||||
- samples/server/petstore/java-helidon-server/v3/se
|
||||
|
||||
@@ -20,6 +20,7 @@ jobs:
|
||||
- samples/client/echo_api/kotlin-jvm-spring-3-restclient
|
||||
- samples/client/echo_api/kotlin-model-prefix-type-mappings
|
||||
- samples/client/echo_api/kotlin-jvm-okhttp
|
||||
- samples/client/echo_api/kotlin-jvm-okhttp-multipart-json
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-java@v5
|
||||
|
||||
@@ -3,6 +3,7 @@ name: Samples Kotlin server (jdk17)
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'samples/server/others/kotlin-server/**'
|
||||
- 'samples/server/petstore/kotlin-springboot-3*/**'
|
||||
- 'samples/server/petstore/kotlin-server/**'
|
||||
- 'samples/server/petstore/kotlin-server-modelMutable/**'
|
||||
@@ -13,6 +14,7 @@ on:
|
||||
# - samples/server/petstore/kotlin-spring-default/**
|
||||
pull_request:
|
||||
paths:
|
||||
- 'samples/server/others/kotlin-server/**'
|
||||
- 'samples/server/petstore/kotlin-springboot-3*/**'
|
||||
- 'samples/server/petstore/kotlin-server/**'
|
||||
- 'samples/server/petstore/kotlin-server-modelMutable/**'
|
||||
@@ -34,6 +36,10 @@ jobs:
|
||||
matrix:
|
||||
sample:
|
||||
# server
|
||||
- samples/server/others/kotlin-server/polymorphism-allof-and-discriminator
|
||||
- samples/server/others/kotlin-server/polymorphism-and-discriminator-disabled-jackson-fix
|
||||
- samples/server/others/kotlin-server/polymorphism-and-discriminator
|
||||
- samples/server/others/kotlin-server/polymorphism
|
||||
- samples/server/petstore/kotlin-server-required-and-nullable-properties
|
||||
- samples/server/petstore/kotlin-springboot-3
|
||||
- samples/server/petstore/kotlin-springboot-3-no-response-entity
|
||||
|
||||
@@ -3,10 +3,12 @@ name: Samples Kotlin server (jdk21)
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'samples/server/others/kotlin-server/**'
|
||||
- 'samples/server/petstore/kotlin-server/**'
|
||||
- 'samples/server/petstore/kotlin-server-required-and-nullable-properties/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'samples/server/others/kotlin-server/**'
|
||||
- 'samples/server/petstore/kotlin-server/**'
|
||||
- 'samples/server/petstore/kotlin-server-required-and-nullable-properties/**'
|
||||
|
||||
@@ -21,6 +23,10 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
- samples/server/others/kotlin-server/polymorphism-allof-and-discriminator
|
||||
- samples/server/others/kotlin-server/polymorphism-and-discriminator-disabled-jackson-fix
|
||||
- samples/server/others/kotlin-server/polymorphism-and-discriminator
|
||||
- samples/server/others/kotlin-server/polymorphism
|
||||
- samples/server/petstore/kotlin-server/javalin-6
|
||||
- samples/server/petstore/kotlin-server/ktor
|
||||
- samples/server/petstore/kotlin-server/ktor2
|
||||
|
||||
8
.github/workflows/samples-ocaml.yaml
vendored
8
.github/workflows/samples-ocaml.yaml
vendored
@@ -7,12 +7,16 @@ on:
|
||||
- 'samples/client/petstore/ocaml-fake-petstore/**'
|
||||
- 'samples/client/petstore/ocaml-oneOf-primitive/**'
|
||||
- 'samples/client/petstore/ocaml-additional-properties/**'
|
||||
- 'samples/client/petstore/ocaml-enum-in-composed-schema/**'
|
||||
- 'samples/client/petstore/ocaml-recursion-test/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'samples/client/petstore/ocaml/**'
|
||||
- 'samples/client/petstore/ocaml-fake-petstore/**'
|
||||
- 'samples/client/petstore/ocaml-oneOf-primitive/**'
|
||||
- 'samples/client/petstore/ocaml-additional-properties/**'
|
||||
- 'samples/client/petstore/ocaml-enum-in-composed-schema/**'
|
||||
- 'samples/client/petstore/ocaml-recursion-test/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -26,12 +30,14 @@ jobs:
|
||||
- 'samples/client/petstore/ocaml-fake-petstore/'
|
||||
- 'samples/client/petstore/ocaml-oneOf-primitive/'
|
||||
- 'samples/client/petstore/ocaml-additional-properties/'
|
||||
- 'samples/client/petstore/ocaml-enum-in-composed-schema/'
|
||||
- 'samples/client/petstore/ocaml-recursion-test/'
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Set-up OCaml
|
||||
uses: ocaml/setup-ocaml@v3
|
||||
with:
|
||||
ocaml-compiler: 5
|
||||
ocaml-compiler: 5.3
|
||||
- name: Install
|
||||
run: opam install . --deps-only --with-test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
|
||||
2
.github/workflows/samples-python-server.yaml
vendored
2
.github/workflows/samples-python-server.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.9'
|
||||
- name: Test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: make test-all
|
||||
|
||||
23
.github/workflows/samples-rust-server.yaml
vendored
23
.github/workflows/samples-rust-server.yaml
vendored
@@ -48,24 +48,39 @@ jobs:
|
||||
run: |
|
||||
set -e
|
||||
|
||||
# Iterate through each example and test various features
|
||||
for package in $(find . -maxdepth 1 -mindepth 1 -type d)
|
||||
# Iterate through each package and test various features
|
||||
for package in $(find output -maxdepth 1 -mindepth 1 -type d)
|
||||
do
|
||||
pushd $package
|
||||
# Not all versions have a server example
|
||||
if test -f examples/server/main.rs; then
|
||||
cargo build --example server --features="server"
|
||||
cargo build --example ${package##*/}-server --features="server"
|
||||
fi
|
||||
# Not all versions have a client example
|
||||
if test -f examples/client/main.rs; then
|
||||
cargo build --example ${package##*/}-client --features="client"
|
||||
fi
|
||||
# Test the CLI works if present
|
||||
if test -f bin/cli.rs; then
|
||||
cargo build --bin ${package##*/} --features cli
|
||||
target/debug/${package##*/} --help
|
||||
../../target/debug/${package##*/} --help
|
||||
fi
|
||||
# Test the validate feature if it exists
|
||||
if cargo read-manifest | grep -q '"validate"'; then
|
||||
cargo build --features validate --all-targets
|
||||
fi
|
||||
# Test TLS features if they exist
|
||||
if cargo read-manifest | grep -q '"client-tls"'; then
|
||||
# Client without TLS (HTTP-only)
|
||||
cargo build --no-default-features --features=client --lib
|
||||
# Client with TLS (using native-tls)
|
||||
cargo build --no-default-features --features=client,client-tls --lib
|
||||
# Server without TLS
|
||||
cargo build --no-default-features --features=server --lib
|
||||
fi
|
||||
cargo fmt
|
||||
cargo test
|
||||
cargo clippy
|
||||
cargo doc
|
||||
popd
|
||||
done
|
||||
|
||||
9
.github/workflows/samples-spring-jdk17.yaml
vendored
9
.github/workflows/samples-spring-jdk17.yaml
vendored
@@ -4,7 +4,10 @@ on:
|
||||
push:
|
||||
paths:
|
||||
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
|
||||
- samples/openapi3/client/petstore/spring-cloud-4-with-optional
|
||||
- samples/client/petstore/spring-http-interface-springboot-4
|
||||
- samples/openapi3/server/petstore/springboot-3
|
||||
- samples/openapi3/server/petstore/springboot-4
|
||||
- samples/server/petstore/springboot-api-response-examples
|
||||
- samples/server/petstore/springboot-lombok-data
|
||||
- samples/server/petstore/springboot-lombok-tostring
|
||||
@@ -15,7 +18,10 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
|
||||
- samples/openapi3/client/petstore/spring-cloud-4-with-optional
|
||||
- samples/client/petstore/spring-http-interface-springboot-4
|
||||
- samples/openapi3/server/petstore/springboot-3
|
||||
- samples/openapi3/server/petstore/springboot-4
|
||||
- samples/server/petstore/springboot-api-response-examples
|
||||
- samples/server/petstore/springboot-lombok-data
|
||||
- samples/server/petstore/springboot-lombok-tostring
|
||||
@@ -33,8 +39,11 @@ jobs:
|
||||
sample:
|
||||
# clients
|
||||
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
|
||||
- samples/openapi3/client/petstore/spring-cloud-4-with-optional
|
||||
- samples/client/petstore/spring-http-interface-springboot-4
|
||||
# servers
|
||||
- samples/openapi3/server/petstore/springboot-3
|
||||
- samples/openapi3/server/petstore/springboot-4
|
||||
- samples/server/petstore/springboot-api-response-examples
|
||||
- samples/server/petstore/springboot-lombok-data
|
||||
- samples/server/petstore/springboot-lombok-tostring
|
||||
|
||||
46
.github/workflows/samples-terraform.yaml
vendored
Normal file
46
.github/workflows/samples-terraform.yaml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
name: Samples Terraform
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'samples/client/petstore/terraform/**'
|
||||
- 'samples/client/petstore/terraform-addpet/**'
|
||||
- 'samples/client/petstore/terraform-server/**'
|
||||
- 'samples/client/others/terraform/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'samples/client/petstore/terraform/**'
|
||||
- 'samples/client/petstore/terraform-addpet/**'
|
||||
- 'samples/client/petstore/terraform-server/**'
|
||||
- 'samples/client/others/terraform/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Terraform Provider
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
- samples/client/petstore/terraform/
|
||||
- samples/client/petstore/terraform-addpet/
|
||||
- samples/client/petstore/terraform-server/
|
||||
- samples/client/others/terraform/allof-discriminator/
|
||||
- samples/client/others/terraform/oneof-anyof-required/
|
||||
- samples/client/others/terraform/oneof-discriminator-lookup/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: "stable"
|
||||
- run: go version
|
||||
- name: Install Dependencies
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: |
|
||||
go mod tidy
|
||||
- name: Build provider
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: go build -v ./...
|
||||
- name: Run tests
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: go test ./... -v -timeout 120m
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -229,7 +229,9 @@ samples/client/petstore/kotlin*/src/main/kotlin/test/
|
||||
samples/client/petstore/kotlin*/build/
|
||||
samples/server/others/kotlin-server/jaxrs-spec/build/
|
||||
samples/client/echo_api/kotlin-jvm-spring-3-restclient/build/
|
||||
samples/client/echo_api/kotlin-jvm-spring-3-webclient/build/
|
||||
samples/client/echo_api/kotlin-jvm-okhttp/build/
|
||||
samples/client/echo_api/kotlin-jvm-okhttp-multipart-json/build/
|
||||
|
||||
# haskell
|
||||
.stack-work
|
||||
@@ -302,6 +304,8 @@ samples/client/petstore/ocaml/_build/
|
||||
samples/client/petstore/ocaml-fake-petstore/_build/
|
||||
samples/client/petstore/ocaml-oneOf-primitive/_build/
|
||||
samples/client/petstore/ocaml-additional-properties/_build/
|
||||
samples/client/petstore/ocaml-enum-in-composed-schema/_build/
|
||||
samples/client/petstore/ocaml-recursion-test/_build/
|
||||
|
||||
# jetbrain http client
|
||||
samples/client/jetbrains/adyen/checkout71/http/client/Apis/http-client.private.env.json
|
||||
|
||||
35
README.md
35
README.md
@@ -15,7 +15,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.20.0`):
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.21.0`):
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
|
||||
@@ -75,6 +75,8 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
|
||||
[<img src="https://openapi-generator.tech/img/companies/unified_to.jpg" width="128" height="128">](https://unified.to/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
|
||||
[<img src="https://openapi-generator.tech/img/companies/savetwt.jpg" width="128" height="128">](https://savetwt.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
|
||||
[<img src="https://openapi-generator.tech/img/companies/serpapi.png" width="128" height="128">](https://serpapi.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
|
||||
[<img src="https://openapi-generator.tech/img/companies/socialwick.png" width="128" height="128">](https://socialwick.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
|
||||
[<img src="https://openapi-generator.tech/img/companies/fbpostlikes.png" width="128" height="128">](https://fbpostlikes.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
|
||||
|
||||
#### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS, Checkly for sponsoring the API monitoring and Gradle for sponsoring Develocity
|
||||
|
||||
@@ -90,7 +92,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
|
||||
| | Languages/Frameworks |
|
||||
| -------------------------------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient 4.x, Apache HttpClient 5.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, Spring 6 RestClient, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **N4JS**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient, pekko), **Swift** (2.x, 3.x, 4.x, 5.x, 6.x), **Typescript** (AngularJS, Angular (9.x - 19.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo**, **Zapier** |
|
||||
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Oat++, Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, [Ktor](https://github.com/ktorio/ktor), [Vert.x](https://vertx.io/)), **PHP** ([Flight](https://docs.flightphp.com/), Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), [Cask](https://github.com/com-lihaoyi/cask), Scalatra) |
|
||||
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Httplib, Oat++, Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, [Ktor](https://github.com/ktorio/ktor), [Vert.x](https://vertx.io/)), **PHP** ([Flight](https://docs.flightphp.com/), Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), [Cask](https://github.com/com-lihaoyi/cask), Scalatra) |
|
||||
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
|
||||
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
|
||||
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Postman Collection**, **Protocol Buffer**, **WSDL** |
|
||||
@@ -148,8 +150,8 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
|
||||
| OpenAPI Generator Version | Release Date | Notes |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
|
||||
| 7.20.0 (upcoming minor release) [SNAPSHOT](https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-to-test-with-the-latest-master-of-openapi-generator) | 20.02.2026 | Minor release with breaking changes (with fallback) |
|
||||
| [7.19.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.19.0) (latest stable release) | 20.01.2026 | Minor release with breaking changes (with fallback) |
|
||||
| 7.21.0 (upcoming minor release) [SNAPSHOT](https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-to-test-with-the-latest-master-of-openapi-generator) | 20.03.2026 | Minor release with breaking changes (with fallback) |
|
||||
| [7.20.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.20.0) (latest stable release) | 16.02.2026 | Minor release with breaking changes (with fallback) |
|
||||
| [6.6.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.6.0) | 11.05.2023 | Minor release with breaking changes (with fallback) |
|
||||
| [5.4.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.4.0) | 31.01.2022 | Minor release with breaking changes (with fallback) |
|
||||
| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) |
|
||||
@@ -212,16 +214,16 @@ See the different versions of the [openapi-generator-cli](https://search.maven.o
|
||||
<!-- RELEASE_VERSION -->
|
||||
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 11 runtime at a minimum):
|
||||
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.19.0/openapi-generator-cli-7.19.0.jar`
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.20.0/openapi-generator-cli-7.20.0.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
```sh
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.19.0/openapi-generator-cli-7.19.0.jar -O openapi-generator-cli.jar
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.20.0/openapi-generator-cli-7.20.0.jar -O openapi-generator-cli.jar
|
||||
```
|
||||
|
||||
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
|
||||
```
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.19.0/openapi-generator-cli-7.19.0.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.20.0/openapi-generator-cli-7.20.0.jar
|
||||
```
|
||||
|
||||
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
|
||||
@@ -417,12 +419,12 @@ Once built, `run-in-docker.sh` will act as an executable for openapi-generator-c
|
||||
|
||||
##### Troubleshooting
|
||||
|
||||
If an error like this occurs, just execute the **./mvnw clean install -U** command:
|
||||
If an error like this occurs, just execute the **mvn clean install -U** command:
|
||||
|
||||
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project openapi-generator: A type incompatibility occurred while executing org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test: java.lang.ExceptionInInitializerError cannot be cast to java.io.IOException
|
||||
|
||||
```sh
|
||||
./run-in-docker.sh ./mvnw clean install -U
|
||||
./run-in-docker.sh mvn clean install -U
|
||||
```
|
||||
|
||||
> Failed to execute goal org.fortasoft:gradle-maven-plugin:1.0.8:invoke (default) on project openapi-generator-gradle-plugin-mvn-wrapper: org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.7-bin.zip'
|
||||
@@ -437,7 +439,7 @@ cd openapi-generator
|
||||
vagrant up
|
||||
vagrant ssh
|
||||
cd /vagrant
|
||||
./run-in-docker.sh ./mvnw package
|
||||
./run-in-docker.sh mvn package
|
||||
```
|
||||
|
||||
### [1.7 - NPM](#table-of-contents)
|
||||
@@ -456,7 +458,7 @@ openapi-generator-cli version
|
||||
To use a specific version of "openapi-generator-cli"
|
||||
|
||||
```sh
|
||||
openapi-generator-cli version-manager set 7.19.0
|
||||
openapi-generator-cli version-manager set 7.20.0
|
||||
```
|
||||
|
||||
Or install it as dev-dependency:
|
||||
@@ -480,7 +482,7 @@ pip install openapi-generator-cli
|
||||
|
||||
To install a specific version
|
||||
```
|
||||
pip install openapi-generator-cli==7.19.0
|
||||
pip install openapi-generator-cli==7.20.0
|
||||
```
|
||||
|
||||
You can also install with [jdk4py](https://github.com/activeviam/jdk4py) instead of java binary. (python>=3.10 is required)
|
||||
@@ -506,7 +508,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
|
||||
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g php -o c:\temp\php_api_client`)
|
||||
|
||||
<!-- RELEASE_VERSION -->
|
||||
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.19.0/openapi-generator-cli-7.19.0.jar)
|
||||
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.20.0/openapi-generator-cli-7.20.0.jar)
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`
|
||||
@@ -1024,6 +1026,7 @@ Here is a list of template creators:
|
||||
* Apex: @asnelling
|
||||
* Bash: @bkryza
|
||||
* C: @PowerOfCreation @zhemant [:heart:](https://www.patreon.com/zhemant)
|
||||
* C++ Httplib: @rajvesh
|
||||
* C++ Oat++: @Kraust
|
||||
* C++ REST: @Danielku15
|
||||
* C++ Tiny: @AndersSpringborg @kaareHH @michelealbano @mkakbas
|
||||
@@ -1107,6 +1110,7 @@ Here is a list of template creators:
|
||||
* Swift 5: @4brunu
|
||||
* Swift 6: @4brunu
|
||||
* Swift Combine: @dydus0x14
|
||||
* Terraform: @jasondamour
|
||||
* TypeScript (Angular1): @mhardorf
|
||||
* TypeScript (Angular2): @roni-frantchi
|
||||
* TypeScript (Angular6): @akehir
|
||||
@@ -1129,6 +1133,7 @@ Here is a list of template creators:
|
||||
* C# Azure functions: @Abrhm7786
|
||||
* C# NancyFX: @mstefaniuk
|
||||
* C++ (Qt5 QHttpEngine): @etherealjoy
|
||||
* C++ Httplib: @rajvesh
|
||||
* C++ Oat++: @Kraust
|
||||
* C++ Pistache: @sebymiano
|
||||
* C++ Restbed: @stkrwork
|
||||
@@ -1260,7 +1265,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| JMeter | @kannkyo (2021/01) |
|
||||
| Jetbrains HTTP Client | @jlengrand (2023/01) |
|
||||
| Julia | @tanmaykm (2023/01) |
|
||||
| Kotlin | @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) @stefankoppier (2022/06) @e5l (2024/10) |
|
||||
| Kotlin | @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) @stefankoppier (2022/06) @e5l (2024/10) @dennisameling (2026/02) |
|
||||
| Lua | @daurnimator (2017/08) |
|
||||
| N4JS | @mmews-n4 (2023/03) |
|
||||
| Nim | |
|
||||
@@ -1276,7 +1281,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Rust | @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) @jacob-pro (2022/10) @dsteeley (2025/07) |
|
||||
| Scala | @clasnake (2017/07), @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04) @fish86 (2023/06) |
|
||||
| Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @4brunu (2019/11) @dydus0x14 (2023/06) |
|
||||
| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) @joscha (2024/10) |
|
||||
| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) @joscha (2024/10) @dennisameling (2026/02) |
|
||||
| Xojo | @Topheee (2023/04) |
|
||||
|
||||
|
||||
|
||||
8
bin/configs/cpp-httplib-server-feature-test.yaml
Normal file
8
bin/configs/cpp-httplib-server-feature-test.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
generatorName: cpp-httplib-server
|
||||
outputDir: samples/server/petstore/cpp-httplib-server/feature-test
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/cpp-httplib-server/feature-test.json
|
||||
templateDir: modules/openapi-generator/src/main/resources/cpp-httplib-server
|
||||
additionalProperties:
|
||||
apiNamespace: "api"
|
||||
modelNamespace: "models"
|
||||
projectName: "cpp-httplib-server-feature-test"
|
||||
8
bin/configs/cpp-httplib-server-petstore.yaml
Normal file
8
bin/configs/cpp-httplib-server-petstore.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
generatorName: cpp-httplib-server
|
||||
outputDir: samples/server/petstore/cpp-httplib-server/petstore
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/cpp-httplib-server/petstore.json
|
||||
templateDir: modules/openapi-generator/src/main/resources/cpp-httplib-server
|
||||
additionalProperties:
|
||||
apiNamespace: "api"
|
||||
modelNamespace: "models"
|
||||
projectName: "cpp-httplib-server-petstore"
|
||||
@@ -1,6 +1,7 @@
|
||||
generatorName: groovy
|
||||
outputDir: samples/client/petstore/groovy
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/groovy/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Groovy
|
||||
additionalProperties:
|
||||
enumPropertyNaming: "original"
|
||||
hideGenerationTimestamp: "true"
|
||||
|
||||
@@ -3,13 +3,11 @@ outputDir: samples/server/petstore/java-camel
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/java-camel-server
|
||||
additionalProperties:
|
||||
oas3: "true"
|
||||
hideGenerationTimestamp: true
|
||||
camelRestBindingMode: "auto"
|
||||
performBeanValidation: true
|
||||
#dateLibrary: "java8-localdatetime"
|
||||
camelDataformatProperties: "json.out.disableFeatures=WRITE_DATES_AS_TIMESTAMPS"
|
||||
library: "spring-boot"
|
||||
withXml: true
|
||||
jackson: true
|
||||
camelUseDefaultValidationErrorProcessor: true
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
generatorName: kotlin-server
|
||||
outputDir: samples/server/others/kotlin-server/polymorphism-allof-and-discriminator
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_1/polymorphism-allof-and-discriminator.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-server
|
||||
additionalProperties:
|
||||
artifactId: kotlin-server-polymorphism-allof-and-discriminator
|
||||
library: javalin6
|
||||
@@ -0,0 +1,10 @@
|
||||
generatorName: kotlin-server
|
||||
outputDir: samples/server/others/kotlin-server/polymorphism-and-discriminator-disabled-jackson-fix
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_1/polymorphism-and-discriminator.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-server
|
||||
additionalProperties:
|
||||
artifactId: kotlin-server-polymorphism-and-discriminator-disabled-jackson-fix
|
||||
library: javalin6
|
||||
# This is set to "true" by default, but we also want to test the case where it's set to false.
|
||||
# See KotlinServerCodegen.java for more details about this property.
|
||||
fixJacksonJsonTypeInfoInheritance: false
|
||||
@@ -0,0 +1,8 @@
|
||||
generatorName: kotlin-server
|
||||
outputDir: samples/server/others/kotlin-server/polymorphism-and-discriminator
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_1/polymorphism-and-discriminator.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-server
|
||||
additionalProperties:
|
||||
artifactId: kotlin-server-polymorphism-and-discriminator
|
||||
library: javalin6
|
||||
fixJacksonJsonTypeInfoInheritance: true
|
||||
7
bin/configs/kotlin-server-polymorphism.yaml
Normal file
7
bin/configs/kotlin-server-polymorphism.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
generatorName: kotlin-server
|
||||
outputDir: samples/server/others/kotlin-server/polymorphism
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_1/polymorphism.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-server
|
||||
additionalProperties:
|
||||
artifactId: kotlin-server-polymorphism
|
||||
library: javalin6
|
||||
@@ -13,3 +13,14 @@ additionalProperties:
|
||||
serializableModel: true
|
||||
beanValidations: true
|
||||
includeHttpRequestContext: true
|
||||
schemaImplements:
|
||||
Pet: com.some.pack.WithId
|
||||
Category: [ com.some.pack.CategoryInterface ]
|
||||
Dog: [ com.some.pack.Canine ]
|
||||
schemaImplementsFields:
|
||||
Pet: id
|
||||
Category: [ name, id ]
|
||||
Dog: [ bark, breed ]
|
||||
xKotlinImplementsSkip: [ com.some.pack.WithPhotoUrls ]
|
||||
xKotlinImplementsFieldsSkip:
|
||||
Pet: [ photoUrls ]
|
||||
@@ -13,3 +13,4 @@ additionalProperties:
|
||||
reactive: false
|
||||
useResponseEntity: true
|
||||
useFlowForArrayReturnType: false
|
||||
requestMappingMode: "api_interface"
|
||||
|
||||
6
bin/configs/ocaml-enum-in-composed-schema.yaml
Normal file
6
bin/configs/ocaml-enum-in-composed-schema.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
generatorName: ocaml
|
||||
outputDir: samples/client/petstore/ocaml-enum-in-composed-schema
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/ocaml/enum-in-composed-schema.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/ocaml
|
||||
additionalProperties:
|
||||
packageName: petstore_client
|
||||
6
bin/configs/ocaml-recursion-test.yaml
Normal file
6
bin/configs/ocaml-recursion-test.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
generatorName: ocaml
|
||||
outputDir: samples/client/petstore/ocaml-recursion-test
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/ocaml/direct-recursion.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/ocaml
|
||||
additionalProperties:
|
||||
packageName: recursion_test
|
||||
17
bin/configs/spring-boot-4.yaml
Normal file
17
bin/configs/spring-boot-4.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/openapi3/server/petstore/springboot-4
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
documentationProvider: springdoc
|
||||
artifactId: springboot
|
||||
snapshotVersion: "true"
|
||||
useSpringBoot4: true
|
||||
useJackson3: true
|
||||
useBeanValidation: true
|
||||
withXml: true
|
||||
hideGenerationTimestamp: "true"
|
||||
generateConstructorWithAllArgs: true
|
||||
generateBuilders: true
|
||||
openApiNullable: false
|
||||
15
bin/configs/spring-boot-x-implements-skip.yaml
Normal file
15
bin/configs/spring-boot-x-implements-skip.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-x-implements-skip
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing-x-implements.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
documentationProvider: springfox
|
||||
artifactId: springboot
|
||||
snapshotVersion: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
camelCaseDollarSign: "true"
|
||||
modelNameSuffix: 'Dto'
|
||||
xImplementsSkip: [ com.custompackage.InterfaceToSkip ]
|
||||
schemaImplements:
|
||||
Foo: [ com.custompackage.WithBar, com.custompackage.WithDefaultMethod ]
|
||||
Animal: com.custompackage.WithColor
|
||||
18
bin/configs/spring-cloud-4-with-optional.yaml
Normal file
18
bin/configs/spring-cloud-4-with-optional.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
generatorName: spring
|
||||
library: spring-cloud
|
||||
outputDir: samples/openapi3/client/petstore/spring-cloud-4-with-optional
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
documentationProvider: springdoc
|
||||
artifactId: spring-cloud-oas4
|
||||
useSpringBoot4: "true"
|
||||
useJackson3: true
|
||||
openApiNullable: false
|
||||
dateLibrary: "java8"
|
||||
useOptional: "true"
|
||||
useSwaggerUI: "false"
|
||||
hideGenerationTimestamp: "true"
|
||||
documentationProvider: none
|
||||
#optionalAcceptNullable: "false" # default to true
|
||||
21
bin/configs/spring-http-interface-springboot-4.yaml
Normal file
21
bin/configs/spring-http-interface-springboot-4.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
generatorName: spring
|
||||
library: spring-http-interface
|
||||
outputDir: samples/client/petstore/spring-http-interface-springboot-4
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
artifactId: spring-http-interface
|
||||
snapshotVersion: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
modelNameSuffix: 'Dto'
|
||||
generatedConstructorWithRequiredArgs: "false"
|
||||
# documentation provider should be ignored
|
||||
documentationProvider: "springdoc"
|
||||
# annotation provider should be ignored
|
||||
annotationLibrary: "swagger2"
|
||||
# validation should be ignored
|
||||
useBeanValidation: "true"
|
||||
performBeanValidation: "true"
|
||||
useSpringBoot4: "true"
|
||||
useJackson3: true
|
||||
openApiNullable: false
|
||||
11
bin/configs/terraform-provider-allof-discriminator.yaml
Normal file
11
bin/configs/terraform-provider-allof-discriminator.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
generatorName: terraform-provider
|
||||
outputDir: samples/client/others/terraform/allof-discriminator
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/go/allof_multiple_ref_and_discriminator.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/terraform-provider
|
||||
gitHost: github.com
|
||||
gitUserId: example
|
||||
gitRepoId: terraform-provider-allof
|
||||
additionalProperties:
|
||||
providerName: "allof"
|
||||
providerAddress: "registry.terraform.io/example/allof"
|
||||
hideGenerationTimestamp: "true"
|
||||
11
bin/configs/terraform-provider-oneof-anyof-required.yaml
Normal file
11
bin/configs/terraform-provider-oneof-anyof-required.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
generatorName: terraform-provider
|
||||
outputDir: samples/client/others/terraform/oneof-anyof-required
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/go/spec-with-oneof-anyof-required.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/terraform-provider
|
||||
gitHost: github.com
|
||||
gitUserId: example
|
||||
gitRepoId: terraform-provider-oneof-anyof
|
||||
additionalProperties:
|
||||
providerName: "oneof"
|
||||
providerAddress: "registry.terraform.io/example/oneof-anyof"
|
||||
hideGenerationTimestamp: "true"
|
||||
@@ -0,0 +1,11 @@
|
||||
generatorName: terraform-provider
|
||||
outputDir: samples/client/others/terraform/oneof-discriminator-lookup
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/go/spec-with-oneof-discriminator.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/terraform-provider
|
||||
gitHost: github.com
|
||||
gitUserId: example
|
||||
gitRepoId: terraform-provider-oneof-disc
|
||||
additionalProperties:
|
||||
providerName: "oneof"
|
||||
providerAddress: "registry.terraform.io/example/oneof-disc"
|
||||
hideGenerationTimestamp: "true"
|
||||
11
bin/configs/terraform-provider-petstore-addpet.yaml
Normal file
11
bin/configs/terraform-provider-petstore-addpet.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
generatorName: terraform-provider
|
||||
outputDir: samples/client/petstore/terraform-addpet
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-addpet-only.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/terraform-provider
|
||||
gitHost: github.com
|
||||
gitUserId: example
|
||||
gitRepoId: terraform-provider-petstore-addpet
|
||||
additionalProperties:
|
||||
providerName: "petstore"
|
||||
providerAddress: "registry.terraform.io/example/petstore-addpet"
|
||||
hideGenerationTimestamp: "true"
|
||||
11
bin/configs/terraform-provider-petstore-new.yaml
Normal file
11
bin/configs/terraform-provider-petstore-new.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
generatorName: terraform-provider
|
||||
outputDir: samples/client/petstore/terraform
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/terraform-provider
|
||||
gitHost: github.com
|
||||
gitUserId: example
|
||||
gitRepoId: terraform-provider-petstore
|
||||
additionalProperties:
|
||||
providerName: "petstore"
|
||||
providerAddress: "registry.terraform.io/example/petstore"
|
||||
hideGenerationTimestamp: "true"
|
||||
11
bin/configs/terraform-provider-petstore-server.yaml
Normal file
11
bin/configs/terraform-provider-petstore-server.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
generatorName: terraform-provider
|
||||
outputDir: samples/client/petstore/terraform-server
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/go-server/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/terraform-provider
|
||||
gitHost: github.com
|
||||
gitUserId: example
|
||||
gitRepoId: terraform-provider-petstore-server
|
||||
additionalProperties:
|
||||
providerName: "petstore"
|
||||
providerAddress: "registry.terraform.io/example/petstore-server"
|
||||
hideGenerationTimestamp: "true"
|
||||
@@ -10,7 +10,7 @@
|
||||
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/ClientTest.java"
|
||||
sha256: 325fdd5d7e2c97790c0fb44f712ab7b2ba022d7e1a5b0056f47b07f342682b6d
|
||||
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java"
|
||||
sha256: 67941355a0a27ed9ff9318b1caa103e78b81b9aff61b594b18be5cd2bb9f6591
|
||||
sha256: b1b1d31e0df17f0b68cf2747a4a53879f12acb1bf2860e45385c679c1efe9894
|
||||
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java"
|
||||
sha256: 8b1b8f2a2ad00ccb090873a94a5f73e328b98317d2ec715f53bd7a1accb2a023
|
||||
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/PetTest.java"
|
||||
|
||||
@@ -723,3 +723,10 @@ Into this securityScheme:
|
||||
scheme: bearer
|
||||
type: http
|
||||
```
|
||||
|
||||
- `SORT_MODEL_PROPERTIES`: When set to true, model properties will be sorted alphabetically by name. This ensures deterministic code generation output regardless of property ordering in the source spec.
|
||||
|
||||
Example:
|
||||
```
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/java-okhttp/ --openapi-normalizer SORT_MODEL_PROPERTIES=true
|
||||
```
|
||||
|
||||
@@ -70,6 +70,7 @@ The following generators are available:
|
||||
* [swift-combine](generators/swift-combine.md)
|
||||
* [swift5 (deprecated)](generators/swift5.md)
|
||||
* [swift6](generators/swift6.md)
|
||||
* [terraform-provider (experimental)](generators/terraform-provider.md)
|
||||
* [typescript (experimental)](generators/typescript.md)
|
||||
* [typescript-angular](generators/typescript-angular.md)
|
||||
* [typescript-aurelia](generators/typescript-aurelia.md)
|
||||
@@ -89,6 +90,7 @@ The following generators are available:
|
||||
* [ada-server](generators/ada-server.md)
|
||||
* [aspnet-fastendpoints](generators/aspnet-fastendpoints.md)
|
||||
* [aspnetcore](generators/aspnetcore.md)
|
||||
* [cpp-httplib-server](generators/cpp-httplib-server.md)
|
||||
* [cpp-oatpp-server](generators/cpp-oatpp-server.md)
|
||||
* [cpp-pistache-server](generators/cpp-pistache-server.md)
|
||||
* [cpp-qt-qhttpengine-server](generators/cpp-qt-qhttpengine-server.md)
|
||||
|
||||
@@ -65,6 +65,7 @@ The following generators are available:
|
||||
## SERVER generators
|
||||
* [ada-server](ada-server.md)
|
||||
* [aspnetcore](aspnetcore.md)
|
||||
* [cpp-httplib-server](cpp-httplib-server.md)
|
||||
* [cpp-oatpp-server](cpp-oatpp-server.md)
|
||||
* [cpp-pistache-server](cpp-pistache-server.md)
|
||||
* [cpp-qt5-qhttpengine-server](cpp-qt5-qhttpengine-server.md)
|
||||
|
||||
286
docs/generators/cpp-httplib-server.md
Normal file
286
docs/generators/cpp-httplib-server.md
Normal file
@@ -0,0 +1,286 @@
|
||||
---
|
||||
title: Documentation for the cpp-httplib-server Generator
|
||||
---
|
||||
|
||||
## METADATA
|
||||
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | cpp-httplib-server | pass this to the generate command after -g |
|
||||
| generator stability | STABLE | |
|
||||
| generator type | SERVER | |
|
||||
| generator language | C++ | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates a C++ server using the httplib library. | |
|
||||
|
||||
## 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 |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|addApiImplStubs|Generate API implementation stubs and a sample main.cpp for quick start| |false|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|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|
|
||||
|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|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|variableNameFirstCharacterUppercase|Make first character of variable name uppercase (eg. value -> Value)| |true|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>bool</li>
|
||||
<li>char</li>
|
||||
<li>double</li>
|
||||
<li>float</li>
|
||||
<li>int</li>
|
||||
<li>long</li>
|
||||
<li>size_t</li>
|
||||
<li>std::any</li>
|
||||
<li>std::deque</li>
|
||||
<li>std::list</li>
|
||||
<li>std::map</li>
|
||||
<li>std::optional</li>
|
||||
<li>std::pair</li>
|
||||
<li>std::queue</li>
|
||||
<li>std::set</li>
|
||||
<li>std::stack</li>
|
||||
<li>std::string</li>
|
||||
<li>std::tuple</li>
|
||||
<li>std::unordered_map</li>
|
||||
<li>std::unordered_set</li>
|
||||
<li>std::variant</li>
|
||||
<li>std::vector</li>
|
||||
<li>unsigned char</li>
|
||||
<li>unsigned int</li>
|
||||
<li>unsigned long</li>
|
||||
<li>void</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>NULL</li>
|
||||
<li>alignas</li>
|
||||
<li>alignof</li>
|
||||
<li>and</li>
|
||||
<li>and_eq</li>
|
||||
<li>asm</li>
|
||||
<li>auto</li>
|
||||
<li>bitand</li>
|
||||
<li>bitor</li>
|
||||
<li>bool</li>
|
||||
<li>break</li>
|
||||
<li>case</li>
|
||||
<li>catch</li>
|
||||
<li>char</li>
|
||||
<li>char16_t</li>
|
||||
<li>char32_t</li>
|
||||
<li>class</li>
|
||||
<li>compl</li>
|
||||
<li>concept</li>
|
||||
<li>const</li>
|
||||
<li>const_cast</li>
|
||||
<li>constexpr</li>
|
||||
<li>continue</li>
|
||||
<li>decltype</li>
|
||||
<li>default</li>
|
||||
<li>delete</li>
|
||||
<li>do</li>
|
||||
<li>double</li>
|
||||
<li>dynamic_cast</li>
|
||||
<li>else</li>
|
||||
<li>enum</li>
|
||||
<li>explicit</li>
|
||||
<li>export</li>
|
||||
<li>extern</li>
|
||||
<li>false</li>
|
||||
<li>float</li>
|
||||
<li>for</li>
|
||||
<li>friend</li>
|
||||
<li>goto</li>
|
||||
<li>if</li>
|
||||
<li>inline</li>
|
||||
<li>int</li>
|
||||
<li>linux</li>
|
||||
<li>long</li>
|
||||
<li>mutable</li>
|
||||
<li>namespace</li>
|
||||
<li>new</li>
|
||||
<li>noexcept</li>
|
||||
<li>not</li>
|
||||
<li>not_eq</li>
|
||||
<li>nullptr</li>
|
||||
<li>operator</li>
|
||||
<li>or</li>
|
||||
<li>or_eq</li>
|
||||
<li>private</li>
|
||||
<li>protected</li>
|
||||
<li>public</li>
|
||||
<li>register</li>
|
||||
<li>reinterpret_cast</li>
|
||||
<li>requires</li>
|
||||
<li>return</li>
|
||||
<li>short</li>
|
||||
<li>signed</li>
|
||||
<li>sizeof</li>
|
||||
<li>static</li>
|
||||
<li>static_assert</li>
|
||||
<li>static_cast</li>
|
||||
<li>struct</li>
|
||||
<li>switch</li>
|
||||
<li>template</li>
|
||||
<li>this</li>
|
||||
<li>thread_local</li>
|
||||
<li>throw</li>
|
||||
<li>true</li>
|
||||
<li>try</li>
|
||||
<li>typedef</li>
|
||||
<li>typeid</li>
|
||||
<li>typename</li>
|
||||
<li>union</li>
|
||||
<li>unsigned</li>
|
||||
<li>using</li>
|
||||
<li>virtual</li>
|
||||
<li>void</li>
|
||||
<li>volatile</li>
|
||||
<li>wchar_t</li>
|
||||
<li>while</li>
|
||||
<li>xor</li>
|
||||
<li>xor_eq</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
|
||||
|AWSV4Signature|✗|ToolingExtension
|
||||
|
||||
### Wire Format Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|JSON|✓|OAS2,OAS3
|
||||
|XML|✗|OAS2,OAS3
|
||||
|PROTOBUF|✗|ToolingExtension
|
||||
|Custom|✗|OAS2,OAS3
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -44,6 +44,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
@@ -86,6 +87,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|resourceFolder|resource folder for generated resources| |src/main/resources|
|
||||
|responseWrapper|wrap the responses in given type (Future, Callable, CompletableFuture,ListenableFuture, DeferredResult, RxObservable, RxSingle or fully qualified type)| |null|
|
||||
|returnSuccessCode|Generated server returns 2xx code| |false|
|
||||
|schemaImplements|Ability to supply interfaces per schema that should be implemented (serves similar purpose as vendor extension `x-implements`, but is fully decoupled from the api spec). Example: yaml `schemaImplements: {Pet: com.some.pack.WithId, Category: [com.some.pack.CategoryInterface], Dog: [com.some.pack.Canine, com.some.pack.OtherInterface]}` implements interfaces in schemas `Pet` (interface `com.some.pack.WithId`), `Category` (interface `com.some.pack.CategoryInterface`), `Dog`(interfaces `com.some.pack.Canine`, `com.some.pack.OtherInterface`)| |empty map|
|
||||
|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
|
||||
|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
|
||||
|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
@@ -105,18 +107,21 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
|
||||
|useFeignClientContextId|Whether to generate Feign client with contextId parameter.| |true|
|
||||
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|
||||
|useJackson3|Set it in order to use jackson 3 dependencies (only allowed when `useSpringBoot4` is set and incompatible with `openApiNullable`).| |false|
|
||||
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|
||||
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |true|
|
||||
|useOptional|Use Optional container for optional parameters| |false|
|
||||
|useResponseEntity|Use the `ResponseEntity` type to wrap return values of generated API methods. If disabled, method are annotated using a `@ResponseStatus` annotation, which has the status of the first response declared in the Api definition| |true|
|
||||
|useSealed|Whether to generate sealed model interfaces and classes| |false|
|
||||
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|
||||
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot ≥ 3 (use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|
||||
|useSpringBoot4|Generate code and provide dependencies for use with Spring Boot 4.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|
||||
|useSpringBuiltInValidation|Disable `@Validated` at the class level when using built-in validation.| |false|
|
||||
|useSpringController|Annotate the generated API as a Spring Controller| |false|
|
||||
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|
||||
|useTags|use tags for creating interface and controller classnames| |false|
|
||||
|virtualService|Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki| |false|
|
||||
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|
||||
|xImplementsSkip|Ability to choose interfaces that should NOT be implemented in the models despite their presence in vendor extension `x-implements`. Takes a list of fully qualified interface names. Example: yaml `xImplementsSkip: [com.some.pack.WithPhotoUrls]` skips implementing the interface `com.some.pack.WithPhotoUrls` in any schema| |empty list|
|
||||
|
||||
## SUPPORTED VENDOR EXTENSIONS
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -33,6 +33,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|configKey|Config key in @RegisterRestClient. Default to none.| |null|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|disableDiscriminatorJsonIgnoreProperties|Ignore discriminator field type for Jackson serialization| |false|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|dateFormat|Specify the format pattern of date as a string| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|datetimeFormat|Specify the format pattern of date-time as a string| |null|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -36,6 +36,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|dateFormat|Specify the format pattern of date as a string| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|datetimeFormat|Specify the format pattern of date-time as a string| |null|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -37,6 +37,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|configKeyFromClassName|If true, set tag as key in @RegisterRestClient. Default to false. Only `microprofile` supports this option.| |null|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -33,6 +33,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -35,6 +35,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|controllerOnly|Whether to generate only API interface stubs without the server files.| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -37,6 +37,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|configKeyFromClassName|If true, set tag as key in @RegisterRestClient. Default to false. Only `microprofile` supports this option.| |null|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -33,6 +33,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -34,6 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -34,6 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|featureHSTS|Avoid sending content if client already has same content, by checking ETag or LastModified properties.| |true|
|
||||
|featureMetrics|Enables metrics feature.| |true|
|
||||
|featureResources|Generates routes in a typed way, for both: constructing URLs and reading the parameters.| |true|
|
||||
|fixJacksonJsonTypeInfoInheritance|When true (default), ensures Jackson polymorphism works correctly by: (1) always setting visible=true on @JsonTypeInfo, and (2) adding the discriminator property to child models with appropriate default values. When false, visible is only set to true if all children already define the discriminator property.| |true|
|
||||
|groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools|
|
||||
|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>**ktor2**</dt><dd>ktor (2.x) framework</dd><dt>**jaxrs-spec**</dt><dd>JAX-RS spec only</dd><dt>**javalin5**</dt><dd>Javalin 5</dd><dt>**javalin6**</dt><dd>Javalin 6</dd></dl>|ktor|
|
||||
@@ -262,11 +263,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ---- | --------- | ---------- |
|
||||
|Simple|✓|OAS2,OAS3
|
||||
|Composite|✓|OAS2,OAS3
|
||||
|Polymorphism|✗|OAS2,OAS3
|
||||
|Polymorphism|✓|OAS2,OAS3
|
||||
|Union|✗|OAS3
|
||||
|allOf|✗|OAS2,OAS3
|
||||
|allOf|✓|OAS2,OAS3
|
||||
|anyOf|✗|OAS3
|
||||
|oneOf|✗|OAS3
|
||||
|oneOf|✓|OAS3
|
||||
|not|✗|OAS3
|
||||
|
||||
### Security Feature
|
||||
|
||||
@@ -24,6 +24,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|apiSuffix|suffix for api classes| |Api|
|
||||
|artifactId|Generated artifact id (name of jar).| |openapi-spring|
|
||||
|artifactVersion|Generated artifact's package version.| |1.0.0|
|
||||
|autoXSpringPaginated|Automatically add x-spring-paginated to operations that have 'page', 'size', and 'sort' query parameters. When enabled, operations with all three parameters will have Pageable support automatically applied. Operations with x-spring-paginated explicitly set to false will not be auto-detected.| |false|
|
||||
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|
||||
|beanQualifiers|Whether to add fully-qualifier class names as bean qualifiers in @Component and @RestController annotations. May be used to prevent bean names clash if multiple generated libraries (contexts) added to single project.| |false|
|
||||
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|
||||
@@ -43,6 +44,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|reactive|use coroutines for reactive behavior| |false|
|
||||
|requestMappingMode|Where to generate the class level @RequestMapping annotation.|<dl><dt>**api_interface**</dt><dd>Generate the @RequestMapping annotation on the generated Api Interface.</dd><dt>**controller**</dt><dd>Generate the @RequestMapping annotation on the generated Api Controller Implementation.</dd><dt>**none**</dt><dd>Do not add a class level @RequestMapping annotation.</dd></dl>|controller|
|
||||
|schemaImplements|A map of single interface or a list of interfaces per schema name that should be implemented (serves similar purpose as `x-kotlin-implements`, but is fully decoupled from the api spec). Example: yaml `schemaImplements: {Pet: com.some.pack.WithId, Category: [com.some.pack.CategoryInterface], Dog: [com.some.pack.Canine, com.some.pack.OtherInterface]}` implements interfaces in schemas `Pet` (interface `com.some.pack.WithId`), `Category` (interface `com.some.pack.CategoryInterface`), `Dog`(interfaces `com.some.pack.Canine`, `com.some.pack.OtherInterface`)| |empty map|
|
||||
|schemaImplementsFields|A map of single field or a list of fields per schema name that should be prepended with `override` (serves similar purpose as `x-kotlin-implements-fields`, but is fully decoupled from the api spec). Example: yaml `schemaImplementsFields: {Pet: id, Category: [name, id], Dog: [bark, breed]}` marks fields to be prepended with `override` in schemas `Pet` (field `id`), `Category` (fields `name`, `id`) and `Dog` (fields `bark`, `breed`)| |empty map|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|serverPort|configuration the port in which the sever is to run on| |8080|
|
||||
|serviceImplementation|generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated| |false|
|
||||
@@ -56,9 +59,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|
||||
|useFlowForArrayReturnType|Whether to use Flow for array/collection return types when reactive is enabled. If false, will use List instead.| |true|
|
||||
|useResponseEntity|Whether (when false) to return actual type (e.g. List<Fruit>) and handle non-happy path responses via exceptions flow or (when true) return entire ResponseEntity (e.g. ResponseEntity<List<Fruit>>). If disabled, method are annotated using a @ResponseStatus annotation, which has the status of the first response declared in the Api definition| |true|
|
||||
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|
||||
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot ≥ 3 (use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|
||||
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|
||||
|useTags|Whether to use tags for creating interface and controller class names| |false|
|
||||
|xKotlinImplementsFieldsSkip|A list of fields per schema name that should NOT be created with `override` keyword despite their presence in vendor extension `x-kotlin-implements-fields` for the schema. Example: yaml `xKotlinImplementsFieldsSkip: Pet: [photoUrls]` skips `override` for `photoUrls` in schema `Pet`| |empty map|
|
||||
|xKotlinImplementsSkip|A list of fully qualified interfaces that should NOT be implemented despite their presence in vendor extension `x-kotlin-implements`. Example: yaml `xKotlinImplementsSkip: [com.some.pack.WithPhotoUrls]` skips implementing the interface in any schema| |empty list|
|
||||
|
||||
## SUPPORTED VENDOR EXTENSIONS
|
||||
|
||||
@@ -69,12 +74,14 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|
||||
|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL|
|
||||
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|
||||
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
|
||||
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-size-message|Add this property whenever you need to customize the invalidation error message for the size or length of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-minimum-message|Add this property whenever you need to customize the invalidation error message for the minimum value of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-maximum-message|Add this property whenever you need to customize the invalidation error message for the maximum value of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-kotlin-implements|Ability to specify interfaces that model must implement|MODEL|empty array
|
||||
|x-kotlin-implements-fields|Specify attributes that are implemented by the interface(s) added via `x-kotlin-implements`|MODEL|empty array
|
||||
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
|
||||
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
@@ -11,7 +11,7 @@ title: Documentation for the ocaml Generator
|
||||
| generator type | CLIENT | |
|
||||
| generator language | OCaml | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates an OCaml client library (beta). | |
|
||||
| helpTxt | Generates an OCaml client library. | |
|
||||
|
||||
## 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.
|
||||
|
||||
@@ -22,6 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|aggregateModelsName|Aggregated model filename. If set, all generated models will be combined into this single file.| |null|
|
||||
|customOptionsApi|Custom options for the api files.| |null|
|
||||
|customOptionsModel|Custom options for the model files.| |null|
|
||||
|extractEnumsToSeparateFiles|Extract enums to separate protobuf files and import them in models| |false|
|
||||
|numberedFieldNumberList|Field numbers in order.| |false|
|
||||
|startEnumsWithUnspecified|Introduces "UNSPECIFIED" as the first element of enumerations.| |false|
|
||||
|supportMultipleResponses|Support multiple responses| |true|
|
||||
|
||||
@@ -10,7 +10,7 @@ title: Documentation for the python-fastapi Generator
|
||||
| generator stability | BETA | |
|
||||
| generator type | SERVER | |
|
||||
| generator language | Python | |
|
||||
| generator language version | 3.7 | |
|
||||
| generator language version | 3.10 | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates a Python FastAPI server (beta). Models are defined with the pydantic library | |
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|defaultToEmptyContainer|Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values| |null|
|
||||
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
@@ -79,6 +80,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|resourceFolder|resource folder for generated resources| |src/main/resources|
|
||||
|responseWrapper|wrap the responses in given type (Future, Callable, CompletableFuture,ListenableFuture, DeferredResult, RxObservable, RxSingle or fully qualified type)| |null|
|
||||
|returnSuccessCode|Generated server returns 2xx code| |false|
|
||||
|schemaImplements|Ability to supply interfaces per schema that should be implemented (serves similar purpose as vendor extension `x-implements`, but is fully decoupled from the api spec). Example: yaml `schemaImplements: {Pet: com.some.pack.WithId, Category: [com.some.pack.CategoryInterface], Dog: [com.some.pack.Canine, com.some.pack.OtherInterface]}` implements interfaces in schemas `Pet` (interface `com.some.pack.WithId`), `Category` (interface `com.some.pack.CategoryInterface`), `Dog`(interfaces `com.some.pack.Canine`, `com.some.pack.OtherInterface`)| |empty map|
|
||||
|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
|
||||
|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
|
||||
|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
@@ -98,18 +100,21 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
|
||||
|useFeignClientContextId|Whether to generate Feign client with contextId parameter.| |true|
|
||||
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|
||||
|useJackson3|Set it in order to use jackson 3 dependencies (only allowed when `useSpringBoot4` is set and incompatible with `openApiNullable`).| |false|
|
||||
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|
||||
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |true|
|
||||
|useOptional|Use Optional container for optional parameters| |false|
|
||||
|useResponseEntity|Use the `ResponseEntity` type to wrap return values of generated API methods. If disabled, method are annotated using a `@ResponseStatus` annotation, which has the status of the first response declared in the Api definition| |true|
|
||||
|useSealed|Whether to generate sealed model interfaces and classes| |false|
|
||||
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|
||||
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot ≥ 3 (use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|
||||
|useSpringBoot4|Generate code and provide dependencies for use with Spring Boot 4.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|
||||
|useSpringBuiltInValidation|Disable `@Validated` at the class level when using built-in validation.| |false|
|
||||
|useSpringController|Annotate the generated API as a Spring Controller| |false|
|
||||
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|
||||
|useTags|use tags for creating interface and controller classnames| |false|
|
||||
|virtualService|Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki| |false|
|
||||
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|
||||
|xImplementsSkip|Ability to choose interfaces that should NOT be implemented in the models despite their presence in vendor extension `x-implements`. Takes a list of fully qualified interface names. Example: yaml `xImplementsSkip: [com.some.pack.WithPhotoUrls]` skips implementing the interface `com.some.pack.WithPhotoUrls` in any schema| |empty list|
|
||||
|
||||
## SUPPORTED VENDOR EXTENSIONS
|
||||
|
||||
|
||||
229
docs/generators/terraform-provider.md
Normal file
229
docs/generators/terraform-provider.md
Normal file
@@ -0,0 +1,229 @@
|
||||
---
|
||||
title: Documentation for the terraform-provider Generator
|
||||
---
|
||||
|
||||
## METADATA
|
||||
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | terraform-provider | pass this to the generate command after -g |
|
||||
| generator stability | EXPERIMENTAL | |
|
||||
| generator type | CLIENT | |
|
||||
| generator language | Go | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates a Terraform provider (Go, using HashiCorp Plugin Framework). | |
|
||||
|
||||
## 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 |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|packageName|Go package name (convention: lowercase).| |openapi|
|
||||
|packageVersion|Go package version.| |1.0.0|
|
||||
|providerAddress|Terraform provider registry address| |registry.terraform.io/example/example|
|
||||
|providerName|Terraform provider name (e.g. 'petstore')| |example|
|
||||
|providerVersion|Terraform provider version| |0.1.0|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>bool</li>
|
||||
<li>byte</li>
|
||||
<li>complex128</li>
|
||||
<li>complex64</li>
|
||||
<li>float32</li>
|
||||
<li>float64</li>
|
||||
<li>int</li>
|
||||
<li>int32</li>
|
||||
<li>int64</li>
|
||||
<li>interface{}</li>
|
||||
<li>map[string]interface{}</li>
|
||||
<li>rune</li>
|
||||
<li>string</li>
|
||||
<li>uint</li>
|
||||
<li>uint32</li>
|
||||
<li>uint64</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>bool</li>
|
||||
<li>break</li>
|
||||
<li>byte</li>
|
||||
<li>case</li>
|
||||
<li>chan</li>
|
||||
<li>complex128</li>
|
||||
<li>complex64</li>
|
||||
<li>const</li>
|
||||
<li>continue</li>
|
||||
<li>default</li>
|
||||
<li>defer</li>
|
||||
<li>else</li>
|
||||
<li>error</li>
|
||||
<li>fallthrough</li>
|
||||
<li>float32</li>
|
||||
<li>float64</li>
|
||||
<li>for</li>
|
||||
<li>func</li>
|
||||
<li>go</li>
|
||||
<li>goto</li>
|
||||
<li>if</li>
|
||||
<li>import</li>
|
||||
<li>int</li>
|
||||
<li>int16</li>
|
||||
<li>int32</li>
|
||||
<li>int64</li>
|
||||
<li>int8</li>
|
||||
<li>interface</li>
|
||||
<li>map</li>
|
||||
<li>nil</li>
|
||||
<li>package</li>
|
||||
<li>range</li>
|
||||
<li>return</li>
|
||||
<li>rune</li>
|
||||
<li>select</li>
|
||||
<li>string</li>
|
||||
<li>struct</li>
|
||||
<li>switch</li>
|
||||
<li>type</li>
|
||||
<li>uint</li>
|
||||
<li>uint16</li>
|
||||
<li>uint32</li>
|
||||
<li>uint64</li>
|
||||
<li>uint8</li>
|
||||
<li>uintptr</li>
|
||||
<li>var</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
|
||||
|AWSV4Signature|✗|ToolingExtension
|
||||
|
||||
### Wire Format Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|JSON|✓|OAS2,OAS3
|
||||
|XML|✗|OAS2,OAS3
|
||||
|PROTOBUF|✗|ToolingExtension
|
||||
|Custom|✗|OAS2,OAS3
|
||||
@@ -20,7 +20,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|axiosVersion|Use this property to override the axios version in package.json| |^1.6.1|
|
||||
|axiosVersion|Use this property to override the axios version in package.json| |^1.13.5|
|
||||
|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|
|
||||
|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|
|
||||
|
||||
@@ -42,6 +42,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|typescriptMajorVersion|Specify the major version of TypeScript to use in the client code. Default is 5.| |5|
|
||||
|useErasableSyntax|Use erasable syntax for the generated code. This is a temporary feature and will be removed in the future.| |false|
|
||||
|useInversify|Enable this to generate decorators and service identifiers for the InversifyJS inversion of control container. If you set 'deno' as 'platform', the generator will process this value as 'disable'.| |false|
|
||||
|useObjectParameters|Use aggregate parameter objects as function arguments for api operations instead of passing each parameter as a separate function argument.| |false|
|
||||
|
||||
@@ -162,8 +162,8 @@ This gives access to the following tasks:
|
||||
|
||||
| Task | Description |
|
||||
|---------------------------|---------------------------------------------------------------------------------------------|
|
||||
| <configName>.generate | Generate code via Open API Tools Generator for Open API 2.0 or 3.x specification documents. |
|
||||
| <configName>.validateSpec | Validates the configured spec |
|
||||
| <configName>.generate | Generate code via Open API Tools Generator for Open API 2.0 or 3.x specification documents. |
|
||||
| <configName>.validateSpec | Validates the configured spec |
|
||||
|
||||
and a command
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=7.20.0-SNAPSHOT
|
||||
openApiGeneratorVersion=7.21.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
# BEGIN placeholders
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=7.20.0-SNAPSHOT
|
||||
openApiGeneratorVersion=7.21.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=7.20.0-SNAPSHOT
|
||||
openApiGeneratorVersion=7.21.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -95,7 +95,7 @@ class MillOpenapiModuleTest extends Matchers {
|
||||
eval.apply(MillOpenapiModuleTestRoot.petstoreMicroprofile.compile)
|
||||
}
|
||||
|
||||
result shouldBe a[Right[_, _]]
|
||||
result shouldBe a[Right[?, ?]]
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -104,6 +104,6 @@ class MillOpenapiModuleTest extends Matchers {
|
||||
// execute 'compile` task
|
||||
eval.apply(MillOpenapiModuleTestRoot.petstoreInvalid.compile)
|
||||
}
|
||||
result shouldBe a[Left[_, _]]
|
||||
result shouldBe a[Left[?, ?]]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.20.0-SNAPSHOT</version>
|
||||
<version>7.21.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -112,6 +112,10 @@ public class CliOption {
|
||||
return new CliOption(opt, description, SchemaTypeUtil.STRING_TYPE);
|
||||
}
|
||||
|
||||
public static CliOption newString(String opt, String description, String defaultValue) {
|
||||
return new CliOption(opt, description, SchemaTypeUtil.STRING_TYPE).defaultValue(String.valueOf(defaultValue));
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getOptionHelp() {
|
||||
StringBuilder sb = new StringBuilder(description);
|
||||
|
||||
@@ -456,6 +456,7 @@ public class CodegenConstants {
|
||||
public static final String USE_DEFAULT_VALUES_FOR_REQUIRED_VARS = "useDefaultValuesForRequiredVars";
|
||||
|
||||
public static final String DEFAULT_TO_EMPTY_CONTAINER = "defaultToEmptyContainer";
|
||||
public static final String DEFAULT_TO_EMPTY_CONTAINER_DESC = "Initialize containers (array/set/map) to empty containers instead of null by default. Usage: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#default-values";
|
||||
|
||||
// Vendor extensions
|
||||
public static final String X_INTERNAL = "x-internal";
|
||||
|
||||
@@ -88,6 +88,10 @@ public class CodegenDiscriminator {
|
||||
this.explicitMapping = explicitMapping;
|
||||
}
|
||||
|
||||
public boolean isExplicitMapping() {
|
||||
return explicitMapping;
|
||||
}
|
||||
|
||||
public MappedModel(String mappingName, String modelName) {
|
||||
this(mappingName, modelName, false);
|
||||
}
|
||||
|
||||
@@ -94,8 +94,11 @@ import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(DefaultCodegen.class);
|
||||
|
||||
public static final Pattern SPLIT_ON_SEMICOLON_OR_NEWLINE_REGEX = Pattern.compile("\\s*(;|\\r?\\n)\\s*"); // Splits on semicolon or new line, ignoring surrounding whitespace
|
||||
|
||||
public static FeatureSet DefaultFeatureSet;
|
||||
|
||||
// A cache of sanitized words. The sanitizeName() method is invoked many times with the same
|
||||
@@ -190,15 +193,20 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected Map<String, String> operationIdNameMapping = new HashMap<>();
|
||||
// a map to store the rules in OpenAPI Normalizer
|
||||
protected Map<String, String> openapiNormalizer = new HashMap<>();
|
||||
@Setter protected String modelPackage = "", apiPackage = "";
|
||||
@Setter
|
||||
protected String modelPackage = "", apiPackage = "";
|
||||
protected String fileSuffix;
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@Setter
|
||||
protected String modelNamePrefix = "", modelNameSuffix = "";
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@Setter
|
||||
protected String apiNamePrefix = "", apiNameSuffix = "Api";
|
||||
protected String testPackage = "";
|
||||
@Setter protected String filesMetadataFilename = "FILES";
|
||||
@Setter protected String versionMetadataFilename = "VERSION";
|
||||
@Setter
|
||||
protected String filesMetadataFilename = "FILES";
|
||||
@Setter
|
||||
protected String versionMetadataFilename = "VERSION";
|
||||
/*
|
||||
apiTemplateFiles are for API outputs only (controllers/handlers).
|
||||
API templates may be written multiple times; APIs are grouped by tag and the file is written once per tag group.
|
||||
@@ -210,7 +218,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected Map<String, String> apiDocTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> modelDocTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> reservedWordsMappings = new HashMap<>();
|
||||
@Setter protected String templateDir;
|
||||
@Setter
|
||||
protected String templateDir;
|
||||
protected String embeddedTemplateDir;
|
||||
protected Map<String, Object> additionalProperties = new HashMap<>();
|
||||
protected Map<String, String> serverVariables = new HashMap<>();
|
||||
@@ -225,9 +234,11 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected List<CliOption> cliOptions = new ArrayList<>();
|
||||
protected boolean skipOverwrite;
|
||||
protected boolean removeOperationIdPrefix;
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@Setter
|
||||
protected String removeOperationIdPrefixDelimiter = "_";
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@Setter
|
||||
protected int removeOperationIdPrefixCount = 1;
|
||||
protected boolean skipOperationExample;
|
||||
// sort operations by default
|
||||
@@ -262,13 +273,17 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected boolean supportsMixins;
|
||||
protected Map<String, String> supportedLibraries = new LinkedHashMap<>();
|
||||
protected String library;
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@Setter
|
||||
protected Boolean sortParamsByRequiredFlag = true;
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@Setter
|
||||
protected Boolean sortModelPropertiesByRequiredFlag = false;
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@Setter
|
||||
protected Boolean ensureUniqueParams = true;
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@Setter
|
||||
protected Boolean allowUnicodeIdentifiers = false;
|
||||
protected String gitHost, gitUserId, gitRepoId, releaseNote;
|
||||
protected String httpUserAgent;
|
||||
@@ -279,7 +294,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected Map<String, String> specialCharReplacements = new LinkedHashMap<>();
|
||||
// When a model is an alias for a simple type
|
||||
protected Map<String, String> typeAliases = Collections.emptyMap();
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@Setter
|
||||
protected Boolean prependFormOrBodyParameters = false;
|
||||
// The extension of the generated documentation files (defaults to markdown .md)
|
||||
protected String docExtension;
|
||||
@@ -302,15 +318,18 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected boolean removeEnumValuePrefix = false;
|
||||
|
||||
// Support legacy logic for evaluating discriminators
|
||||
@Setter protected boolean legacyDiscriminatorBehavior = true;
|
||||
@Setter
|
||||
protected boolean legacyDiscriminatorBehavior = true;
|
||||
|
||||
// Specify what to do if the 'additionalProperties' keyword is not present in a schema.
|
||||
// See CodegenConstants.java for more details.
|
||||
@Setter protected boolean disallowAdditionalPropertiesIfNotPresent = true;
|
||||
@Setter
|
||||
protected boolean disallowAdditionalPropertiesIfNotPresent = true;
|
||||
|
||||
// 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.
|
||||
@Setter protected boolean enumUnknownDefaultCase = false;
|
||||
@Setter
|
||||
protected boolean enumUnknownDefaultCase = false;
|
||||
protected String enumUnknownDefaultCaseName = "unknown_default_open_api";
|
||||
|
||||
// make openapi available to all methods
|
||||
@@ -333,11 +352,18 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected boolean addSuffixToDuplicateOperationNicknames = true;
|
||||
|
||||
// Whether to automatically hardcode params that are considered Constants by OpenAPI Spec
|
||||
@Setter protected boolean autosetConstants = false;
|
||||
@Setter
|
||||
protected boolean autosetConstants = false;
|
||||
|
||||
@Setter @Getter boolean arrayDefaultToEmpty, arrayNullableDefaultToEmpty, arrayOptionalNullableDefaultToEmpty, arrayOptionalDefaultToEmpty;
|
||||
@Setter @Getter boolean mapDefaultToEmpty, mapNullableDefaultToEmpty, mapOptionalNullableDefaultToEmpty, mapOptionalDefaultToEmpty;
|
||||
@Setter @Getter protected boolean defaultToEmptyContainer;
|
||||
@Setter
|
||||
@Getter
|
||||
boolean arrayDefaultToEmpty, arrayNullableDefaultToEmpty, arrayOptionalNullableDefaultToEmpty, arrayOptionalDefaultToEmpty;
|
||||
@Setter
|
||||
@Getter
|
||||
boolean mapDefaultToEmpty, mapNullableDefaultToEmpty, mapOptionalNullableDefaultToEmpty, mapOptionalDefaultToEmpty;
|
||||
@Setter
|
||||
@Getter
|
||||
protected boolean defaultToEmptyContainer;
|
||||
|
||||
final List EMPTY_LIST = new ArrayList();
|
||||
|
||||
@@ -572,7 +598,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
? false
|
||||
: model.parentModel.allVars.stream().anyMatch(p ->
|
||||
p.name.equals(property.name) &&
|
||||
(p.dataType.equals(property.dataType) == false || p.datatypeWithEnum.equals(property.datatypeWithEnum) == false));
|
||||
(p.dataType.equals(property.dataType) == false || p.datatypeWithEnum.equals(property.datatypeWithEnum) == false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -716,7 +742,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
for (CodegenProperty cp : model.allVars) {
|
||||
// detect self import
|
||||
if (cp.dataType.equalsIgnoreCase(model.classname) ||
|
||||
(cp.isContainer && cp.items != null && cp.items.dataType.equalsIgnoreCase(model.classname))) {
|
||||
(cp.isContainer && cp.items != null && cp.items.dataType.equalsIgnoreCase(model.classname))) {
|
||||
model.imports.remove(model.classname); // remove self import
|
||||
cp.isSelfReference = true;
|
||||
}
|
||||
@@ -758,7 +784,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
private void setCircularReferencesOnProperties(final String root,
|
||||
final Map<String, List<CodegenProperty>> dependencyMap) {
|
||||
final Map<String, List<CodegenProperty>> dependencyMap) {
|
||||
dependencyMap.getOrDefault(root, new ArrayList<>())
|
||||
.forEach(prop -> {
|
||||
final List<String> unvisited =
|
||||
@@ -771,9 +797,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
private boolean isCircularReference(final String root,
|
||||
final Set<String> visited,
|
||||
final List<String> unvisited,
|
||||
final Map<String, List<CodegenProperty>> dependencyMap) {
|
||||
final Set<String> visited,
|
||||
final List<String> unvisited,
|
||||
final Map<String, List<CodegenProperty>> dependencyMap) {
|
||||
for (int i = 0; i < unvisited.size(); i++) {
|
||||
final String next = unvisited.get(i);
|
||||
if (!visited.contains(next)) {
|
||||
@@ -1162,7 +1188,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return escapeText(input).replace("'", "\\'");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escape characters while allowing new lines
|
||||
*
|
||||
@@ -1206,7 +1231,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
@Override
|
||||
public String escapeUnsafeCharacters(String input) {
|
||||
LOGGER.warn("escapeUnsafeCharacters should be overridden in the code generator with proper logic to escape " +
|
||||
"unsafe characters");
|
||||
"unsafe characters");
|
||||
// doing nothing by default and code generator should implement
|
||||
// the logic to prevent code injection
|
||||
// later we'll make this method abstract to make sure
|
||||
@@ -1223,7 +1248,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
@Override
|
||||
public String escapeQuotationMark(String input) {
|
||||
LOGGER.warn("escapeQuotationMark should be overridden in the code generator with proper logic to escape " +
|
||||
"single/double quote");
|
||||
"single/double quote");
|
||||
return input.replace("\"", "\\\"");
|
||||
}
|
||||
|
||||
@@ -1801,7 +1826,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
CliOption legacyDiscriminatorBehaviorOpt = CliOption.newBoolean(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR_DESC).defaultValue(Boolean.TRUE.toString());
|
||||
Map<String, String> legacyDiscriminatorBehaviorOpts = new HashMap<>();
|
||||
legacyDiscriminatorBehaviorOpts.put("true", "The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.");
|
||||
legacyDiscriminatorBehaviorOpts.put("false", "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.");
|
||||
legacyDiscriminatorBehaviorOpts.put("false",
|
||||
"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.");
|
||||
legacyDiscriminatorBehaviorOpt.setEnum(legacyDiscriminatorBehaviorOpts);
|
||||
cliOptions.add(legacyDiscriminatorBehaviorOpt);
|
||||
|
||||
@@ -2285,7 +2311,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected Schema<?> getSchemaAdditionalProperties(Schema schema) {
|
||||
Schema<?> inner = ModelUtils.getAdditionalProperties(schema);
|
||||
if (inner == null) {
|
||||
@@ -2359,7 +2384,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return ModelUtils.unaliasSchema(this.openAPI, schema, schemaMapping);
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> unaliasExamples(Map<String, Example> examples){
|
||||
private List<Map<String, Object>> unaliasExamples(Map<String, Example> examples) {
|
||||
return ExamplesUtils.unaliasExamples(this.openAPI, examples);
|
||||
}
|
||||
|
||||
@@ -2631,6 +2656,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
private static class NamedSchema {
|
||||
|
||||
private NamedSchema(String name, Schema s, boolean required, boolean schemaIsFromAdditionalProperties) {
|
||||
this.name = name;
|
||||
this.schema = s;
|
||||
@@ -2645,13 +2671,15 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
NamedSchema that = (NamedSchema) o;
|
||||
return Objects.equals(required, that.required) &&
|
||||
Objects.equals(name, that.name) &&
|
||||
Objects.equals(schema, that.schema) &&
|
||||
Objects.equals(schemaIsFromAdditionalProperties, that.schemaIsFromAdditionalProperties);
|
||||
Objects.equals(name, that.name) &&
|
||||
Objects.equals(schema, that.schema) &&
|
||||
Objects.equals(schemaIsFromAdditionalProperties, that.schemaIsFromAdditionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2673,7 +2701,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (composed.getProperties() != null && !composed.getProperties().isEmpty()) {
|
||||
if (composed.getOneOf() != null && !composed.getOneOf().isEmpty()) {
|
||||
LOGGER.warn("'oneOf' is intended to include only the additional optional OAS extension discriminator object. " +
|
||||
"For more details, see https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.9.2.1.3 and the OAS section on 'Composition and Inheritance'.");
|
||||
"For more details, see https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.9.2.1.3 and the OAS section on 'Composition and Inheritance'.");
|
||||
}
|
||||
addVars(m, unaliasPropertySchema(composed.getProperties()), composed.getRequired(), null, null);
|
||||
}
|
||||
@@ -3068,7 +3096,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
m.getVendorExtensions().putAll(schema.getExtensions());
|
||||
}
|
||||
m.isAlias = (typeAliases.containsKey(name)
|
||||
|| isAliasOfSimpleTypes(schema)); // check if the unaliased schema is an alias of simple OAS types
|
||||
|| isAliasOfSimpleTypes(schema)); // check if the unaliased schema is an alias of simple OAS types
|
||||
m.setDiscriminator(createDiscriminator(name, schema));
|
||||
|
||||
if (schema.getDeprecated() != null) {
|
||||
@@ -3439,7 +3467,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
if (discriminatorsPropNames.size() > 1) {
|
||||
once(LOGGER).warn("The oneOf schemas have conflicting discriminator property names. " +
|
||||
"oneOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
|
||||
"oneOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
|
||||
}
|
||||
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) {
|
||||
disc.setPropertyName(foundDisc.getPropertyName());
|
||||
@@ -3468,7 +3496,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
if (discriminatorsPropNames.size() > 1) {
|
||||
once(LOGGER).warn("The anyOf schemas have conflicting discriminator property names. " +
|
||||
"anyOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
|
||||
"anyOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
|
||||
}
|
||||
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getAnyOf().size() && discriminatorsPropNames.size() == 1) {
|
||||
disc.setPropertyName(foundDisc.getPropertyName());
|
||||
@@ -3667,7 +3695,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
boolean matched = false;
|
||||
for (MappedModel uniqueDescendant : uniqueDescendants) {
|
||||
if (uniqueDescendant.getMappingName().equals(otherDescendant.getMappingName())
|
||||
|| (uniqueDescendant.getModelName().equals(otherDescendant.getModelName()))) {
|
||||
|| (uniqueDescendant.getModelName().equals(otherDescendant.getModelName()))) {
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
@@ -3865,9 +3893,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
property.isNullable = property.isNullable ||
|
||||
!(ModelUtils.isComposedSchema(p)) ||
|
||||
p.getAllOf() == null ||
|
||||
p.getAllOf().size() == 0;
|
||||
!(ModelUtils.isComposedSchema(p)) ||
|
||||
p.getAllOf() == null ||
|
||||
p.getAllOf().size() == 0;
|
||||
if (languageSpecificPrimitives.contains(property.dataType)) {
|
||||
property.isPrimitiveType = true;
|
||||
}
|
||||
@@ -3943,7 +3971,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return fromProperty(name, p, required, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO remove this in 7.0.0 as a breaking change
|
||||
* This method was kept when required was added to the fromProperty signature
|
||||
@@ -4124,7 +4151,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (referencedSchema.getNullable() != null) {
|
||||
property.isNullable = referencedSchema.getNullable();
|
||||
} else if (referencedSchema.getExtensions() != null &&
|
||||
referencedSchema.getExtensions().containsKey(X_NULLABLE)) {
|
||||
referencedSchema.getExtensions().containsKey(X_NULLABLE)) {
|
||||
property.isNullable = (Boolean) referencedSchema.getExtensions().get(X_NULLABLE);
|
||||
}
|
||||
|
||||
@@ -4208,9 +4235,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
boolean isAnyTypeWithNothingElseSet = (ModelUtils.isAnyType(p) &&
|
||||
(p.getProperties() == null || p.getProperties().isEmpty()) &&
|
||||
!ModelUtils.isComposedSchema(p) &&
|
||||
p.getAdditionalProperties() == null && p.getNot() == null && p.getEnum() == null);
|
||||
(p.getProperties() == null || p.getProperties().isEmpty()) &&
|
||||
!ModelUtils.isComposedSchema(p) &&
|
||||
p.getAdditionalProperties() == null && p.getNot() == null && p.getEnum() == null);
|
||||
|
||||
if (!ModelUtils.isArraySchema(p) && !ModelUtils.isMapSchema(p) && !ModelUtils.isFreeFormObject(p, openAPI) && !isAnyTypeWithNothingElseSet) {
|
||||
/* schemas that are not Array, not ModelUtils.isMapSchema, not isFreeFormObject, not AnyType with nothing else set
|
||||
@@ -4289,7 +4316,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* update container's default to empty container according rules provided by the user.
|
||||
*
|
||||
* @param cp codegen property
|
||||
* @param p schema
|
||||
* @param p schema
|
||||
*/
|
||||
void updateDefaultToEmptyContainer(CodegenProperty cp, Schema p) {
|
||||
if (cp.isArray) {
|
||||
@@ -4331,7 +4358,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
void parseDefaultToEmptyContainer(String input) {
|
||||
String[] inputs = ((String) input).split("[|]");
|
||||
String containerType;
|
||||
for (String rule: inputs) {
|
||||
for (String rule : inputs) {
|
||||
if (StringUtils.isEmpty(rule)) {
|
||||
LOGGER.error("updateDefaultToEmptyContainer: Skipped empty input in `{}`.", input);
|
||||
continue;
|
||||
@@ -4356,7 +4383,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
LOGGER.error("Skipped invalid container type `{}` in `{}`.", containerType, input);
|
||||
}
|
||||
} else if (rule.endsWith("?")) { // optional
|
||||
containerType = rule.substring(0, rule.length()-1);
|
||||
containerType = rule.substring(0, rule.length() - 1);
|
||||
if ("array".equalsIgnoreCase(containerType)) {
|
||||
arrayOptionalDefaultToEmpty = true;
|
||||
} else if ("map".equalsIgnoreCase(containerType)) {
|
||||
@@ -4466,7 +4493,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected CodegenProperty getMostInnerItems(CodegenProperty property) {
|
||||
CodegenProperty currentProperty = property;
|
||||
while (currentProperty != null && (Boolean.TRUE.equals(currentProperty.isMap)
|
||||
|| Boolean.TRUE.equals(currentProperty.isArray)) && currentProperty.items != null) {
|
||||
|| Boolean.TRUE.equals(currentProperty.isArray)) && currentProperty.items != null) {
|
||||
currentProperty = currentProperty.items;
|
||||
}
|
||||
return currentProperty;
|
||||
@@ -4486,7 +4513,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected void updateDataTypeWithEnumForArray(CodegenProperty property) {
|
||||
CodegenProperty baseItem = property.items;
|
||||
while (baseItem != null && (Boolean.TRUE.equals(baseItem.isMap)
|
||||
|| Boolean.TRUE.equals(baseItem.isArray))) {
|
||||
|| Boolean.TRUE.equals(baseItem.isArray))) {
|
||||
baseItem = baseItem.items;
|
||||
}
|
||||
if (baseItem != null) {
|
||||
@@ -4514,7 +4541,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected void updateDataTypeWithEnumForMap(CodegenProperty property) {
|
||||
CodegenProperty baseItem = property.items;
|
||||
while (baseItem != null && (Boolean.TRUE.equals(baseItem.isMap)
|
||||
|| Boolean.TRUE.equals(baseItem.isArray))) {
|
||||
|| Boolean.TRUE.equals(baseItem.isArray))) {
|
||||
baseItem = baseItem.items;
|
||||
}
|
||||
|
||||
@@ -4575,9 +4602,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param methodResponse the default ApiResponse for the endpoint
|
||||
*/
|
||||
protected void handleMethodResponse(Operation operation,
|
||||
Map<String, Schema> schemas,
|
||||
CodegenOperation op,
|
||||
ApiResponse methodResponse) {
|
||||
Map<String, Schema> schemas,
|
||||
CodegenOperation op,
|
||||
ApiResponse methodResponse) {
|
||||
handleMethodResponse(operation, schemas, op, methodResponse, Collections.emptyMap());
|
||||
}
|
||||
|
||||
@@ -4591,10 +4618,10 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param schemaMappings mappings of external types to be omitted by unaliasing
|
||||
*/
|
||||
protected void handleMethodResponse(Operation operation,
|
||||
Map<String, Schema> schemas,
|
||||
CodegenOperation op,
|
||||
ApiResponse methodResponse,
|
||||
Map<String, String> schemaMappings) {
|
||||
Map<String, Schema> schemas,
|
||||
CodegenOperation op,
|
||||
ApiResponse methodResponse,
|
||||
Map<String, String> schemaMappings) {
|
||||
ApiResponse response = ModelUtils.getReferencedApiResponse(openAPI, methodResponse);
|
||||
Schema responseSchema = unaliasSchema(ModelUtils.getSchemaFromResponse(openAPI, response));
|
||||
|
||||
@@ -4663,9 +4690,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*/
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path,
|
||||
String httpMethod,
|
||||
Operation operation,
|
||||
List<Server> servers) {
|
||||
String httpMethod,
|
||||
Operation operation,
|
||||
List<Server> servers) {
|
||||
LOGGER.debug("fromOperation => operation: {}", operation);
|
||||
if (operation == null)
|
||||
throw new RuntimeException("operation cannot be null in fromOperation");
|
||||
@@ -4733,8 +4760,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
r.setContent(getContent(response.getContent(), imports, mediaTypeSchemaSuffix));
|
||||
|
||||
if (r.baseType != null &&
|
||||
!defaultIncludes.contains(r.baseType) &&
|
||||
!languageSpecificPrimitives.contains(r.baseType)) {
|
||||
!defaultIncludes.contains(r.baseType) &&
|
||||
!languageSpecificPrimitives.contains(r.baseType)) {
|
||||
imports.add(r.baseType);
|
||||
}
|
||||
|
||||
@@ -4756,14 +4783,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// check if any 4xx or 5xx response has an error response object defined
|
||||
if ((Boolean.TRUE.equals(r.is4xx) || Boolean.TRUE.equals(r.is5xx)) &&
|
||||
Boolean.FALSE.equals(r.primitiveType) && Boolean.FALSE.equals(r.simpleType)) {
|
||||
Boolean.FALSE.equals(r.primitiveType) && Boolean.FALSE.equals(r.simpleType)) {
|
||||
op.hasErrorResponseObject = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// check if the operation can both return a 2xx response with a body and without
|
||||
if (op.responses.stream().anyMatch(response -> response.is2xx && response.dataType != null) &&
|
||||
op.responses.stream().anyMatch(response -> response.is2xx && response.dataType == null)) {
|
||||
op.responses.stream().anyMatch(response -> response.is2xx && response.dataType == null)) {
|
||||
op.isResponseOptional = Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -4836,8 +4863,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
contentType = contentType.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
if (contentType != null &&
|
||||
((!(this instanceof RustAxumServerCodegen) && contentType.startsWith("application/x-www-form-urlencoded")) ||
|
||||
contentType.startsWith("multipart"))) {
|
||||
((!(this instanceof RustAxumServerCodegen) && contentType.startsWith("application/x-www-form-urlencoded")) ||
|
||||
contentType.startsWith("multipart"))) {
|
||||
// process form parameters
|
||||
formParams = fromRequestBodyToFormParameters(requestBody, imports);
|
||||
op.isMultipart = contentType.startsWith("multipart");
|
||||
@@ -5027,23 +5054,23 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
r.code = responseCode;
|
||||
switch (r.code.charAt(0)) {
|
||||
|
||||
case '1':
|
||||
r.is1xx = true;
|
||||
break;
|
||||
case '2':
|
||||
r.is2xx = true;
|
||||
break;
|
||||
case '3':
|
||||
r.is3xx = true;
|
||||
break;
|
||||
case '4':
|
||||
r.is4xx = true;
|
||||
break;
|
||||
case '5':
|
||||
r.is5xx = true;
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Invalid response code " + responseCode);
|
||||
case '1':
|
||||
r.is1xx = true;
|
||||
break;
|
||||
case '2':
|
||||
r.is2xx = true;
|
||||
break;
|
||||
case '3':
|
||||
r.is3xx = true;
|
||||
break;
|
||||
case '4':
|
||||
r.is4xx = true;
|
||||
break;
|
||||
case '5':
|
||||
r.is5xx = true;
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Invalid response code " + responseCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5273,7 +5300,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
LOGGER.debug("debugging codegenParameter return: {}", codegenParameter);
|
||||
}
|
||||
|
||||
|
||||
private void updateParameterForMap(CodegenParameter codegenParameter, Schema parameterSchema, Set<String> imports) {
|
||||
CodegenProperty codegenProperty = fromProperty("inner", ModelUtils.getAdditionalProperties(parameterSchema), false);
|
||||
codegenParameter.items = codegenProperty;
|
||||
@@ -5853,7 +5879,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*/
|
||||
protected boolean needToImport(String type) {
|
||||
return StringUtils.isNotBlank(type) && !defaultIncludes.contains(type)
|
||||
&& !languageSpecificPrimitives.contains(type);
|
||||
&& !languageSpecificPrimitives.contains(type);
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-method")
|
||||
@@ -6062,7 +6088,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
protected void addVars(CodegenModel m, Map<String, Schema> properties, List<String> required,
|
||||
Map<String, Schema> allProperties, List<String> allRequired) {
|
||||
Map<String, Schema> allProperties, List<String> allRequired) {
|
||||
|
||||
m.hasRequired = false;
|
||||
m.hasReadOnly = false;
|
||||
@@ -6265,7 +6291,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// allOf with a single item
|
||||
if (schema.getAllOf() != null && schema.getAllOf().size() == 1
|
||||
&& schema.getAllOf().get(0) instanceof Schema) {
|
||||
&& schema.getAllOf().get(0) instanceof Schema) {
|
||||
schema = unaliasSchema((Schema) schema.getAllOf().get(0));
|
||||
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
|
||||
}
|
||||
@@ -7040,7 +7066,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* reads propertyKey from additionalProperties, converts it to a boolean and
|
||||
* writes it back to additionalProperties to be usable as a boolean in
|
||||
@@ -7115,6 +7140,69 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
this.ignoreFilePathOverride = ignoreFileOverride;
|
||||
}
|
||||
|
||||
public List<String> getPropertyAsStringList(String propertyKey) {
|
||||
final Object value = additionalProperties.get(propertyKey);
|
||||
return getObjectAsStringList(value);
|
||||
}
|
||||
|
||||
public static List<String> getObjectAsStringList(Object value) {
|
||||
if (value instanceof List) {
|
||||
List<?> list = (List<?>) value;
|
||||
List<String> stringList = new ArrayList<>();
|
||||
for (Object item : list) {
|
||||
if (item != null) {
|
||||
stringList.add(item.toString());
|
||||
}
|
||||
}
|
||||
return stringList;
|
||||
} else if (value instanceof String) {
|
||||
return Collections.singletonList((String) value);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public Map<String, String> getPropertyAsStringMap(String propertyKey) {
|
||||
final Object value = additionalProperties.get(propertyKey);
|
||||
return getObjectAsStringMap(value);
|
||||
}
|
||||
|
||||
public static Map<String, String> getObjectAsStringMap(Object value) {
|
||||
if (value instanceof Map) {
|
||||
Map<?, ?> rawMap = (Map<?, ?>) value;
|
||||
Map<String, String> stringMap = new HashMap<>();
|
||||
for (Entry<?, ?> entry : rawMap.entrySet()) {
|
||||
stringMap.put(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
|
||||
}
|
||||
return stringMap;
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getPropertyAsStringListMap(String propertyKey) {
|
||||
final Object value = additionalProperties.get(propertyKey);
|
||||
return getObjectAsStringListMap(value);
|
||||
}
|
||||
|
||||
public static Map<String, List<String>> getObjectAsStringListMap(Object value) {
|
||||
if (value instanceof Map) {
|
||||
Map<?, ?> rawMap = (Map<?, ?>) value;
|
||||
Map<String, List<String>> stringMap = new HashMap<>();
|
||||
for (Entry<?, ?> entry : rawMap.entrySet()) {
|
||||
Object entryValue = entry.getValue();
|
||||
if (entryValue instanceof List) {
|
||||
List<String> stringList = ((List<?>) entryValue).stream()
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
stringMap.put(String.valueOf(entry.getKey()), stringList);
|
||||
} else {
|
||||
stringMap.put(String.valueOf(entry.getKey()), Collections.singletonList(String.valueOf(entryValue)));
|
||||
}
|
||||
}
|
||||
return stringMap;
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
public boolean convertPropertyToBoolean(String propertyKey) {
|
||||
final Object booleanValue = additionalProperties.get(propertyKey);
|
||||
boolean result = Boolean.FALSE;
|
||||
@@ -7218,8 +7306,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
for (String consume : consumesInfo) {
|
||||
if (consume != null &&
|
||||
(consume.toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
|
||||
consume.toLowerCase(Locale.ROOT).startsWith("multipart"))) {
|
||||
(consume.toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
|
||||
consume.toLowerCase(Locale.ROOT).startsWith("multipart"))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -7338,7 +7426,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
Schema original = null;
|
||||
// check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level
|
||||
if (ModelUtils.isAllOf(schema) && schema.getAllOf().size() == 1 &&
|
||||
(ModelUtils.getType(schema) == null || "object".equals(ModelUtils.getType(schema)))) {
|
||||
(ModelUtils.getType(schema) == null || "object".equals(ModelUtils.getType(schema)))) {
|
||||
if (schema.getAllOf().get(0) instanceof Schema) {
|
||||
original = schema;
|
||||
schema = (Schema) schema.getAllOf().get(0);
|
||||
@@ -7630,9 +7718,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
codegenModelDescription = codegenModel.description;
|
||||
} else {
|
||||
LOGGER.warn("The following schema has undefined (null) baseType. " +
|
||||
"It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. " +
|
||||
"A correct 'consumes' for form parameters should be " +
|
||||
"'application/x-www-form-urlencoded' or 'multipart/?'");
|
||||
"It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. " +
|
||||
"A correct 'consumes' for form parameters should be " +
|
||||
"'application/x-www-form-urlencoded' or 'multipart/?'");
|
||||
LOGGER.warn("schema: {}", schema);
|
||||
LOGGER.warn("codegenModel is null. Default to UNKNOWN_BASE_TYPE");
|
||||
codegenModelName = "UNKNOWN_BASE_TYPE";
|
||||
@@ -7696,7 +7784,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
innerCp = innerCp.items;
|
||||
}
|
||||
|
||||
|
||||
if (StringUtils.isEmpty(bodyParameterName)) {
|
||||
codegenParameter.baseName = "request_body";
|
||||
} else {
|
||||
@@ -7991,7 +8078,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
Schema original = null;
|
||||
// check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level
|
||||
if (ModelUtils.isAllOf(schema) && schema.getAllOf().size() == 1 &&
|
||||
(ModelUtils.getType(schema) == null || "object".equals(ModelUtils.getType(schema)))) {
|
||||
(ModelUtils.getType(schema) == null || "object".equals(ModelUtils.getType(schema)))) {
|
||||
if (schema.getAllOf().get(0) instanceof Schema) {
|
||||
original = schema;
|
||||
schema = (Schema) schema.getAllOf().get(0);
|
||||
@@ -8379,7 +8466,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
int exitValue = p.exitValue();
|
||||
if (exitValue != 0) {
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(p.getErrorStream(), StandardCharsets.UTF_8);
|
||||
BufferedReader br = new BufferedReader(inputStreamReader)) {
|
||||
BufferedReader br = new BufferedReader(inputStreamReader)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
@@ -8548,6 +8635,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*/
|
||||
@Getter
|
||||
private static class SanitizeNameOptions {
|
||||
|
||||
public SanitizeNameOptions(String name, String removeCharRegEx, List<String> exceptions) {
|
||||
this.name = name;
|
||||
this.removeCharRegEx = removeCharRegEx;
|
||||
@@ -8564,12 +8652,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
SanitizeNameOptions that = (SanitizeNameOptions) o;
|
||||
return Objects.equals(getName(), that.getName()) &&
|
||||
Objects.equals(getRemoveCharRegEx(), that.getRemoveCharRegEx()) &&
|
||||
Objects.equals(getExceptions(), that.getExceptions());
|
||||
Objects.equals(getRemoveCharRegEx(), that.getRemoveCharRegEx()) &&
|
||||
Objects.equals(getExceptions(), that.getExceptions());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -8675,7 +8765,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
i += 1;
|
||||
|
||||
if (dataTypeSet.contains(cp.dataType)
|
||||
|| (isTypeErasedGenerics() && dataTypeSet.contains(cp.baseType))) {
|
||||
|| (isTypeErasedGenerics() && dataTypeSet.contains(cp.baseType))) {
|
||||
// add "x-duplicated-data-type" to indicate if the (base) dataType already occurs before
|
||||
// in other sub-schemas of allOf/anyOf/oneOf
|
||||
cp.vendorExtensions.putIfAbsent("x-duplicated-data-type", true);
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -151,6 +152,9 @@ public class OpenAPINormalizer {
|
||||
boolean updateNumberToNullable;
|
||||
boolean updateBooleanToNullable;
|
||||
|
||||
// when set to true, sort model properties by name to ensure deterministic output
|
||||
final String SORT_MODEL_PROPERTIES = "SORT_MODEL_PROPERTIES";
|
||||
|
||||
// ============= end of rules =============
|
||||
|
||||
/**
|
||||
@@ -209,6 +213,7 @@ public class OpenAPINormalizer {
|
||||
ruleNames.add(SET_PRIMITIVE_TYPES_TO_NULLABLE);
|
||||
ruleNames.add(SIMPLIFY_ONEOF_ANYOF_ENUM);
|
||||
ruleNames.add(REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT);
|
||||
ruleNames.add(SORT_MODEL_PROPERTIES);
|
||||
|
||||
// rules that are default to true
|
||||
rules.put(SIMPLIFY_ONEOF_ANYOF, true);
|
||||
@@ -768,7 +773,7 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
|
||||
if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
|
||||
normalizeProperties(schema.getProperties(), visitedSchemas);
|
||||
normalizeProperties(schema, visitedSchemas);
|
||||
}
|
||||
|
||||
if (schema.getAdditionalProperties() != null) {
|
||||
@@ -777,7 +782,7 @@ public class OpenAPINormalizer {
|
||||
|
||||
return schema;
|
||||
} else if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
|
||||
normalizeProperties(schema.getProperties(), visitedSchemas);
|
||||
normalizeProperties(schema, visitedSchemas);
|
||||
} else if (schema.getAdditionalProperties() instanceof Schema) { // map
|
||||
normalizeMapSchema(schema);
|
||||
normalizeSchema((Schema) schema.getAdditionalProperties(), visitedSchemas);
|
||||
@@ -799,6 +804,13 @@ public class OpenAPINormalizer {
|
||||
* @param schema Schema
|
||||
*/
|
||||
protected void normalizeReferenceSchema(Schema schema) {
|
||||
if (schema.getType() != null || schema.getTypes() != null && !schema.getTypes().isEmpty()) {
|
||||
// clears type(s) given that $ref is set
|
||||
schema.setType(null);
|
||||
schema.setTypes(null);
|
||||
LOGGER.warn("Type(s) cleared (set to null) given $ref is set to {}.", schema.get$ref());
|
||||
}
|
||||
|
||||
if (schema.getTitle() != null || schema.getDescription() != null
|
||||
|| schema.getNullable() != null || schema.getDefault() != null || schema.getDeprecated() != null
|
||||
|| schema.getMaximum() != null || schema.getMinimum() != null
|
||||
@@ -880,10 +892,19 @@ public class OpenAPINormalizer {
|
||||
processSetPrimitiveTypesToNullable(schema);
|
||||
}
|
||||
|
||||
protected void normalizeProperties(Map<String, Schema> properties, Set<Schema> visitedSchemas) {
|
||||
protected void normalizeProperties(Schema schema, Set<Schema> visitedSchemas) {
|
||||
Map<String, Schema> properties = schema.getProperties();
|
||||
if (properties == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sort properties by name if rule is enabled
|
||||
if (getRule(SORT_MODEL_PROPERTIES)) {
|
||||
Map<String, Schema> sortedProperties = new TreeMap<>(properties);
|
||||
schema.setProperties(sortedProperties);
|
||||
properties = sortedProperties;
|
||||
}
|
||||
|
||||
for (Map.Entry<String, Schema> propertiesEntry : properties.entrySet()) {
|
||||
Schema property = propertiesEntry.getValue();
|
||||
|
||||
@@ -1089,7 +1110,7 @@ public class OpenAPINormalizer {
|
||||
protected Schema normalizeComplexComposedSchema(Schema schema, Set<Schema> visitedSchemas) {
|
||||
// loop through properties, if any
|
||||
if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
|
||||
normalizeProperties(schema.getProperties(), visitedSchemas);
|
||||
normalizeProperties(schema, visitedSchemas);
|
||||
}
|
||||
|
||||
processRemoveAnyOfOneOfAndKeepPropertiesOnly(schema);
|
||||
@@ -1769,6 +1790,8 @@ public class OpenAPINormalizer {
|
||||
return null;
|
||||
}
|
||||
|
||||
normalizeExclusiveMinMax31(schema);
|
||||
|
||||
if (schema instanceof JsonSchema &&
|
||||
schema.get$schema() == null &&
|
||||
schema.getTypes() == null && schema.getType() == null) {
|
||||
@@ -1863,6 +1886,51 @@ public class OpenAPINormalizer {
|
||||
return schema;
|
||||
}
|
||||
|
||||
private void normalizeExclusiveMinMax31(Schema<?> schema) {
|
||||
if (schema == null || schema.get$ref() != null) return;
|
||||
|
||||
// OAS 3.1 numeric exclusiveMinimum
|
||||
BigDecimal exclusiveMinValue = schema.getExclusiveMinimumValue();
|
||||
if (exclusiveMinValue != null) {
|
||||
BigDecimal minimum = schema.getMinimum();
|
||||
|
||||
if (minimum == null) {
|
||||
schema.setMinimum(exclusiveMinValue);
|
||||
schema.setExclusiveMinimum(Boolean.TRUE);
|
||||
} else {
|
||||
int cmp = exclusiveMinValue.compareTo(minimum);
|
||||
|
||||
if (cmp > 0) {
|
||||
schema.setMinimum(exclusiveMinValue);
|
||||
schema.setExclusiveMinimum(Boolean.TRUE);
|
||||
} else if (cmp == 0) {
|
||||
schema.setExclusiveMinimum(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OAS 3.1 numeric exclusiveMaximum
|
||||
BigDecimal exclusiveMaxValue = schema.getExclusiveMaximumValue();
|
||||
if (exclusiveMaxValue != null) {
|
||||
BigDecimal maximum = schema.getMaximum();
|
||||
|
||||
if (maximum == null) {
|
||||
schema.setMaximum(exclusiveMaxValue);
|
||||
schema.setExclusiveMaximum(Boolean.TRUE);
|
||||
} else {
|
||||
int cmp = exclusiveMaxValue.compareTo(maximum);
|
||||
|
||||
if (cmp < 0) {
|
||||
schema.setMaximum(exclusiveMaxValue);
|
||||
schema.setExclusiveMaximum(Boolean.TRUE);
|
||||
} else if (cmp == 0) {
|
||||
schema.setExclusiveMaximum(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ===================== end of rules =====================
|
||||
|
||||
protected static class Filter {
|
||||
|
||||
@@ -56,6 +56,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.SourceVersion;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
@@ -63,6 +64,7 @@ import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -90,6 +92,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
public static final String BOOLEAN_GETTER_PREFIX = "booleanGetterPrefix";
|
||||
public static final String IGNORE_ANYOF_IN_ENUM = "ignoreAnyOfInEnum";
|
||||
public static final String ADDITIONAL_MODEL_TYPE_ANNOTATIONS = "additionalModelTypeAnnotations";
|
||||
public static final String X_IMPLEMENTS_SKIP = "xImplementsSkip";
|
||||
public static final String SCHEMA_IMPLEMENTS = "schemaImplements";
|
||||
public static final String ADDITIONAL_ONE_OF_TYPE_ANNOTATIONS = "additionalOneOfTypeAnnotations";
|
||||
public static final String ADDITIONAL_ENUM_TYPE_ANNOTATIONS = "additionalEnumTypeAnnotations";
|
||||
public static final String DISCRIMINATOR_CASE_SENSITIVE = "discriminatorCaseSensitive";
|
||||
@@ -178,6 +182,12 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
@Setter protected boolean parentOverridden = false;
|
||||
@Getter @Setter
|
||||
protected List<String> additionalModelTypeAnnotations = new LinkedList<>();
|
||||
@Getter
|
||||
@Setter
|
||||
protected List<String> xImplementsSkip = new ArrayList<>();
|
||||
@Getter
|
||||
@Setter
|
||||
protected Map<String, List<String>> schemaImplements = new HashMap<>();
|
||||
protected Map<String, Boolean> lombokAnnotations = null;
|
||||
@Getter @Setter
|
||||
protected List<String> additionalOneOfTypeAnnotations = new LinkedList<>();
|
||||
@@ -378,6 +388,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
|
||||
CliOption enumPropertyNamingOpt = new CliOption(CodegenConstants.ENUM_PROPERTY_NAMING, ENUM_PROPERTY_NAMING_DESC);
|
||||
cliOptions.add(enumPropertyNamingOpt.defaultValue(enumPropertyNaming.name()));
|
||||
|
||||
cliOptions.add(CliOption.newString(CodegenConstants.DEFAULT_TO_EMPTY_CONTAINER, CodegenConstants.DEFAULT_TO_EMPTY_CONTAINER_DESC));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -448,6 +460,12 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
convertPropertyToTypeAndWriteBack(ADDITIONAL_ENUM_TYPE_ANNOTATIONS,
|
||||
annotations -> Arrays.asList(annotations.split(";")),
|
||||
this::setAdditionalEnumTypeAnnotations);
|
||||
if (additionalProperties.containsKey(X_IMPLEMENTS_SKIP)) {
|
||||
this.setXImplementsSkip(getPropertyAsStringList(X_IMPLEMENTS_SKIP));
|
||||
}
|
||||
if (additionalProperties.containsKey(SCHEMA_IMPLEMENTS)) {
|
||||
this.setSchemaImplements(getPropertyAsStringListMap(SCHEMA_IMPLEMENTS));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
|
||||
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
@@ -1996,13 +2014,63 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
listIterator.add(newImportMap);
|
||||
}
|
||||
}
|
||||
|
||||
// add x-implements for serializable to all models
|
||||
// make sure the x-implements is always a List and always at least empty
|
||||
for (ModelMap mo : objs.getModels()) {
|
||||
CodegenModel cm = mo.getModel();
|
||||
if (this.serializableModel) {
|
||||
cm.getVendorExtensions().putIfAbsent(X_IMPLEMENTS, new ArrayList<String>());
|
||||
((ArrayList<String>) cm.getVendorExtensions().get(X_IMPLEMENTS)).add("Serializable");
|
||||
if (cm.getVendorExtensions().containsKey(X_IMPLEMENTS)) {
|
||||
List<String> xImplements = getObjectAsStringList(cm.getVendorExtensions().get(X_IMPLEMENTS));
|
||||
cm.getVendorExtensions().replace(X_IMPLEMENTS, xImplements);
|
||||
} else {
|
||||
cm.getVendorExtensions().put(X_IMPLEMENTS, new ArrayList<String>());
|
||||
}
|
||||
}
|
||||
|
||||
// skip interfaces predefined in open api spec in x-implements via additional property xImplementsSkip
|
||||
if (!this.xImplementsSkip.isEmpty()) {
|
||||
for (ModelMap mo : objs.getModels()) {
|
||||
CodegenModel cm = mo.getModel();
|
||||
if (!getObjectAsStringList(cm.getVendorExtensions().get(X_IMPLEMENTS)).isEmpty()) {
|
||||
List<String> xImplementsInModelOriginal = getObjectAsStringList(cm.getVendorExtensions().get(X_IMPLEMENTS));
|
||||
List<String> xImplementsInModelSkipped = xImplementsInModelOriginal
|
||||
.stream()
|
||||
.filter(o -> this.xImplementsSkip.contains(o))
|
||||
.collect(Collectors.toList());
|
||||
if (!xImplementsInModelSkipped.isEmpty()) {
|
||||
LOGGER.info("Following interfaces configured via config option '{}' will be skipped for model {}: {}", X_IMPLEMENTS_SKIP, cm.classname, xImplementsInModelSkipped);
|
||||
}
|
||||
List<String> xImplementsInModelProcessed = xImplementsInModelOriginal.stream()
|
||||
.filter(Predicate.not(xImplementsInModelSkipped::contains))
|
||||
.collect(Collectors.toList());
|
||||
// implement only the non-skipped interfaces
|
||||
cm.getVendorExtensions().replace(X_IMPLEMENTS, xImplementsInModelProcessed);
|
||||
}
|
||||
}
|
||||
}
|
||||
// add interfaces defined outside of open api spec
|
||||
if (!this.schemaImplements.isEmpty()) {
|
||||
for (ModelMap mo : objs.getModels()) {
|
||||
CodegenModel cm = mo.getModel();
|
||||
if (this.schemaImplements.containsKey(cm.getSchemaName())) {
|
||||
LOGGER.info("Adding interface(s) {} configured via config option '{}' to model {}", this.schemaImplements.get(cm.getSchemaName()), SCHEMA_IMPLEMENTS, cm.classname);
|
||||
List<String> xImplementsInModel = getObjectAsStringList(cm.getVendorExtensions().get(X_IMPLEMENTS));
|
||||
List<String> schemaImplements = this.schemaImplements.get(cm.getSchemaName());
|
||||
List<String> combinedSchemaImplements = Stream.concat(xImplementsInModel.stream(), schemaImplements.stream())
|
||||
.collect(Collectors.toList());
|
||||
// Add all the interfaces combined
|
||||
cm.getVendorExtensions().replace(X_IMPLEMENTS, combinedSchemaImplements);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add Serializable to x-implements to all models if configured
|
||||
if (this.serializableModel) {
|
||||
for (ModelMap mo : objs.getModels()) {
|
||||
CodegenModel cm = mo.getModel();
|
||||
List<String> xImplements = new ArrayList<>(getObjectAsStringList(cm.getVendorExtensions().get(X_IMPLEMENTS)));
|
||||
if (!xImplements.contains("Serializable")) {
|
||||
xImplements.add("Serializable");
|
||||
}
|
||||
cm.getVendorExtensions().replace(X_IMPLEMENTS, xImplements);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,10 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
|
||||
public static final String JAVAX_PACKAGE = "javaxPackage";
|
||||
public static final String USE_JAKARTA_EE = "useJakartaEe";
|
||||
public static final String SCHEMA_IMPLEMENTS = "schemaImplements";
|
||||
public static final String SCHEMA_IMPLEMENTS_FIELDS = "schemaImplementsFields";
|
||||
public static final String X_KOTLIN_IMPLEMENTS_SKIP = "xKotlinImplementsSkip";
|
||||
public static final String X_KOTLIN_IMPLEMENTS_FIELDS_SKIP = "xKotlinImplementsFieldsSkip";
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractKotlinCodegen.class);
|
||||
|
||||
@@ -88,6 +92,18 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
private final Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
|
||||
@Getter @Setter
|
||||
protected List<String> additionalModelTypeAnnotations = new LinkedList<>();
|
||||
@Getter
|
||||
@Setter
|
||||
protected Map<String, List<String>> schemaImplements = new HashMap<>();
|
||||
@Getter
|
||||
@Setter
|
||||
protected Map<String, List<String>> schemaImplementsFields = new HashMap<>();
|
||||
@Getter
|
||||
@Setter
|
||||
protected List<String> xKotlinImplementsSkip = new ArrayList<>();
|
||||
@Getter
|
||||
@Setter
|
||||
protected Map<String, List<String>> xKotlinImplementsFieldsSkip = new HashMap<>();
|
||||
|
||||
public AbstractKotlinCodegen() {
|
||||
super();
|
||||
@@ -513,7 +529,19 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
|
||||
if (additionalProperties.containsKey(ADDITIONAL_MODEL_TYPE_ANNOTATIONS)) {
|
||||
String additionalAnnotationsList = additionalProperties.get(ADDITIONAL_MODEL_TYPE_ANNOTATIONS).toString();
|
||||
this.setAdditionalModelTypeAnnotations(Arrays.asList(additionalAnnotationsList.trim().split("\\s*(;|\\r?\\n)\\s*")));
|
||||
this.setAdditionalModelTypeAnnotations(Arrays.asList(SPLIT_ON_SEMICOLON_OR_NEWLINE_REGEX.split(additionalAnnotationsList.trim())));
|
||||
}
|
||||
if (additionalProperties.containsKey(SCHEMA_IMPLEMENTS)) {
|
||||
this.setSchemaImplements(getPropertyAsStringListMap(SCHEMA_IMPLEMENTS));
|
||||
}
|
||||
if (additionalProperties.containsKey(SCHEMA_IMPLEMENTS_FIELDS)) {
|
||||
this.setSchemaImplementsFields(getPropertyAsStringListMap(SCHEMA_IMPLEMENTS_FIELDS));
|
||||
}
|
||||
if (additionalProperties.containsKey(X_KOTLIN_IMPLEMENTS_SKIP)) {
|
||||
this.setXKotlinImplementsSkip(getPropertyAsStringList(X_KOTLIN_IMPLEMENTS_SKIP));
|
||||
}
|
||||
if (additionalProperties.containsKey(X_KOTLIN_IMPLEMENTS_FIELDS_SKIP)) {
|
||||
this.setXKotlinImplementsFieldsSkip(getPropertyAsStringListMap(X_KOTLIN_IMPLEMENTS_FIELDS_SKIP));
|
||||
}
|
||||
|
||||
additionalProperties.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, getSortParamsByRequiredFlag());
|
||||
@@ -839,16 +867,52 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema schema) {
|
||||
CodegenModel m = super.fromModel(name, schema);
|
||||
List<String> implementedInterfacesClasses = (List<String>) m.getVendorExtensions().getOrDefault(VendorExtension.X_KOTLIN_IMPLEMENTS.getName(), List.of());
|
||||
List<String> implementedInterfacesFields = Optional.ofNullable((List<String>) m.getVendorExtensions().get(VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS.getName()))
|
||||
m.getVendorExtensions().putIfAbsent(VendorExtension.X_KOTLIN_IMPLEMENTS.getName(), List.of());
|
||||
List<String> schemaImplementedInterfacesClasses = this.getSchemaImplements().getOrDefault(m.getSchemaName(), List.of());
|
||||
List<String> schemaImplementedInterfacesFields = this.getSchemaImplementsFields().getOrDefault(m.getSchemaName(), List.of());
|
||||
List<String> vendorExtensionImplementedInterfacesClasses = (List<String>) m.getVendorExtensions().get(VendorExtension.X_KOTLIN_IMPLEMENTS.getName());
|
||||
List<String> interfacesToSkip = this.getXKotlinImplementsSkip().stream()
|
||||
.filter(vendorExtensionImplementedInterfacesClasses::contains)
|
||||
.collect(Collectors.toList());
|
||||
if (!interfacesToSkip.isEmpty()) {
|
||||
LOGGER.info("Interface(s) {} in model {} are skipped from being marked as implemented via config option '{}'.",
|
||||
interfacesToSkip, name, X_KOTLIN_IMPLEMENTS_SKIP);
|
||||
}
|
||||
List<String> vendorExtensionImplementedInterfacesClassesFiltered = vendorExtensionImplementedInterfacesClasses.stream()
|
||||
.filter(interfaceName -> !interfacesToSkip.contains(interfaceName))
|
||||
.collect(Collectors.toList());
|
||||
List<String> vendorExtensionImplementedInterfacesFields = Optional.ofNullable((List<String>) m.getVendorExtensions().get(VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS.getName()))
|
||||
.map(xKotlinImplementsFields -> {
|
||||
if (implementedInterfacesClasses.isEmpty() && !xKotlinImplementsFields.isEmpty()) {
|
||||
if (vendorExtensionImplementedInterfacesClassesFiltered.isEmpty() && !xKotlinImplementsFields.isEmpty()) {
|
||||
LOGGER.warn("Annotating {} with {} without {} is not supported. {} will be ignored.",
|
||||
name, VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS.getName(), VendorExtension.X_KOTLIN_IMPLEMENTS.getName(),
|
||||
VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS.getName());
|
||||
}
|
||||
return xKotlinImplementsFields;
|
||||
}).orElse(List.of());
|
||||
List<String> fieldsToSkip = this.getXKotlinImplementsFieldsSkip().getOrDefault(m.getSchemaName(), List.of())
|
||||
.stream()
|
||||
.filter(vendorExtensionImplementedInterfacesFields::contains)
|
||||
.collect(Collectors.toList());
|
||||
if (!fieldsToSkip.isEmpty()) {
|
||||
LOGGER.info("Field(s) {} in model {} are skipped from being marked as inherited via config option '{}'.",
|
||||
fieldsToSkip, name, X_KOTLIN_IMPLEMENTS_FIELDS_SKIP);
|
||||
}
|
||||
List<String> vendorExtensionImplementedInterfacesFieldsFiltered = vendorExtensionImplementedInterfacesFields.stream()
|
||||
.filter(interfaceName -> !fieldsToSkip.contains(interfaceName))
|
||||
.collect(Collectors.toList());
|
||||
List<String> combinedImplementedInterfacesClasses = Stream.concat(vendorExtensionImplementedInterfacesClassesFiltered.stream(), schemaImplementedInterfacesClasses.stream())
|
||||
.distinct()
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
List<String> combinedImplementedInterfacesFields = Stream.concat(vendorExtensionImplementedInterfacesFieldsFiltered.stream(), schemaImplementedInterfacesFields.stream())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (serializableModel && !combinedImplementedInterfacesClasses.contains("java.io.Serializable")) {
|
||||
combinedImplementedInterfacesClasses.add("java.io.Serializable");
|
||||
}
|
||||
m.getVendorExtensions().replace(VendorExtension.X_KOTLIN_IMPLEMENTS.getName(), combinedImplementedInterfacesClasses);
|
||||
LOGGER.info("Model {} implements interface(s): {}", name, combinedImplementedInterfacesClasses);
|
||||
m.optionalVars = m.optionalVars.stream().distinct().collect(Collectors.toList());
|
||||
// Update allVars/requiredVars/optionalVars with isInherited
|
||||
// Each of these lists contains elements that are similar, but they are all cloned
|
||||
@@ -865,7 +929,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
Stream.of(m.requiredVars, m.optionalVars)
|
||||
.flatMap(List::stream)
|
||||
.filter(p -> allVarsMap.containsKey(p.baseName)
|
||||
|| implementedInterfacesFields.contains(p.baseName)
|
||||
|| combinedImplementedInterfacesFields.contains(p.baseName)
|
||||
)
|
||||
.forEach(p -> p.isInherited = true);
|
||||
return m;
|
||||
|
||||
@@ -17,39 +17,65 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.CodegenConstants.ENUM_PROPERTY_NAMING_TYPE;
|
||||
import org.openapitools.codegen.CodegenConstants.MODEL_PROPERTY_NAMING_TYPE;
|
||||
import org.openapitools.codegen.CodegenConstants.PARAM_NAMING_TYPE;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
import org.openapitools.codegen.model.ModelsMap;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import static org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen.ParameterExpander.ParamStyle.form;
|
||||
import static org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen.ParameterExpander.ParamStyle.simple;
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen.ParameterExpander.ParamStyle.form;
|
||||
import static org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen.ParameterExpander.ParamStyle.simple;
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenConstants.ENUM_PROPERTY_NAMING_TYPE;
|
||||
import org.openapitools.codegen.CodegenConstants.MODEL_PROPERTY_NAMING_TYPE;
|
||||
import org.openapitools.codegen.CodegenConstants.PARAM_NAMING_TYPE;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.GeneratorLanguage;
|
||||
import org.openapitools.codegen.meta.features.ClientModificationFeature;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
import org.openapitools.codegen.meta.features.GlobalFeature;
|
||||
import org.openapitools.codegen.meta.features.SchemaSupportFeature;
|
||||
import org.openapitools.codegen.meta.features.SecurityFeature;
|
||||
import org.openapitools.codegen.meta.features.WireFormatFeature;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
import org.openapitools.codegen.model.ModelsMap;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
@@ -1023,6 +1049,85 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to fix the inner enum naming issue for maps/arrays of enums.
|
||||
* <p>
|
||||
* The parent implementation uses toEnumName(baseItem) which produces a generic name
|
||||
* like "InnerEnum" based on the inner item's name. This override first calculates
|
||||
* the correct property.enumName, then uses it in the datatypeWithEnum replacement.
|
||||
* </p>
|
||||
*
|
||||
* @param property Codegen property
|
||||
*/
|
||||
@Override
|
||||
protected void updateDataTypeWithEnumForArray(CodegenProperty property) {
|
||||
CodegenProperty baseItem = property.items;
|
||||
while (baseItem != null && (Boolean.TRUE.equals(baseItem.isMap)
|
||||
|| Boolean.TRUE.equals(baseItem.isArray))) {
|
||||
baseItem = baseItem.items;
|
||||
}
|
||||
|
||||
if (baseItem != null) {
|
||||
// First, set the property's enumName using the property itself (not the inner item)
|
||||
// This ensures the correct enum name (e.g., "OptionsEnum") is used
|
||||
// instead of the generic inner item name (e.g., "InnerEnum")
|
||||
property.enumName = toEnumName(property);
|
||||
|
||||
// Now use property.enumName for datatypeWithEnum
|
||||
property.datatypeWithEnum = property.datatypeWithEnum.replace(baseItem.baseType, property.enumName);
|
||||
|
||||
// set default value for variable with inner enum
|
||||
if (property.defaultValue != null) {
|
||||
property.defaultValue = property.defaultValue.replace(baseItem.baseType, property.enumName);
|
||||
}
|
||||
|
||||
updateCodegenPropertyEnum(property);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to fix the inner enum naming issue for map properties.
|
||||
* <p>
|
||||
* The parent implementation uses {@code toEnumName(baseItem)} which produces "InnerEnum"
|
||||
* for properties whose inner item has a generic name like "inner". We instead
|
||||
* calculate the enumName from the property itself first, then use it in the replacement.
|
||||
* </p>
|
||||
*
|
||||
* @param property Codegen property
|
||||
*/
|
||||
@Override
|
||||
protected void updateDataTypeWithEnumForMap(CodegenProperty property) {
|
||||
CodegenProperty baseItem = property.items;
|
||||
while (baseItem != null && (Boolean.TRUE.equals(baseItem.isMap)
|
||||
|| Boolean.TRUE.equals(baseItem.isArray))) {
|
||||
baseItem = baseItem.items;
|
||||
}
|
||||
|
||||
if (baseItem != null) {
|
||||
// First, set the property's enumName using the property itself (not the inner item)
|
||||
property.enumName = toEnumName(property);
|
||||
|
||||
// Replace only the LAST occurrence of baseType with enumName.
|
||||
// In map types, the value type appears last (after the key type),
|
||||
// so this approach is template-agnostic.
|
||||
String datatypeWithEnum = property.datatypeWithEnum;
|
||||
int lastIndex = datatypeWithEnum.lastIndexOf(baseItem.baseType);
|
||||
if (lastIndex >= 0) {
|
||||
property.datatypeWithEnum = datatypeWithEnum.substring(0, lastIndex)
|
||||
+ property.enumName
|
||||
+ datatypeWithEnum.substring(lastIndex + baseItem.baseType.length());
|
||||
}
|
||||
LOGGER.info("Updated datatypeWithEnum for map property '{}': {}", property.name, property.datatypeWithEnum);
|
||||
|
||||
// set default value for variable with inner enum
|
||||
if (property.defaultValue != null) {
|
||||
property.defaultValue = property.defaultValue.replace(baseItem.baseType, property.enumName);
|
||||
}
|
||||
|
||||
updateCodegenPropertyEnum(property);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelsMap postProcessModels(ModelsMap objs) {
|
||||
// process enum in models
|
||||
@@ -1030,15 +1135,18 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
for (ModelMap mo : models) {
|
||||
CodegenModel cm = mo.getModel();
|
||||
cm.imports = new TreeSet<>(cm.imports);
|
||||
|
||||
// name enum with model name, e.g. StatusEnum => Pet.StatusEnum
|
||||
// This applies to both direct enum properties (isEnum) and properties containing
|
||||
// inner enums (isInnerEnum) like maps or arrays of enums.
|
||||
for (CodegenProperty var : cm.vars) {
|
||||
if (Boolean.TRUE.equals(var.isEnum)) {
|
||||
if (Boolean.TRUE.equals(var.isEnum) || Boolean.TRUE.equals(var.isInnerEnum)) {
|
||||
var.datatypeWithEnum = var.datatypeWithEnum.replace(var.enumName, cm.classname + classEnumSeparator + var.enumName);
|
||||
}
|
||||
}
|
||||
if (cm.parent != null) {
|
||||
for (CodegenProperty var : cm.allVars) {
|
||||
if (Boolean.TRUE.equals(var.isEnum)) {
|
||||
if (Boolean.TRUE.equals(var.isEnum) || Boolean.TRUE.equals(var.isInnerEnum)) {
|
||||
var.datatypeWithEnum = var.datatypeWithEnum
|
||||
.replace(var.enumName, cm.classname + classEnumSeparator + var.enumName);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user