forked from loafle/openapi-generator-original
Compare commits
1 Commits
v7.9.0
...
devhl-labs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da9ef216a0 |
@@ -1 +0,0 @@
|
||||
RUN apt update && apt install -y maven
|
||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -17,5 +17,5 @@
|
||||
These must match the expectations made by your contribution.
|
||||
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example `./bin/generate-samples.sh bin/configs/java*`.
|
||||
IMPORTANT: Do **NOT** purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
|
||||
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master` (upcoming `7.x.0` minor release - breaking changes with fallbacks), `8.0.x` (breaking changes without fallbacks)
|
||||
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master` (upcoming 7.6.0 minor release - breaking changes with fallbacks), `8.0.x` (breaking changes without fallbacks)
|
||||
- [ ] If your PR is targeting a particular programming language, @mention the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) members, so they are more likely to review the pull request.
|
||||
|
||||
4
.github/workflows/linux.yaml
vendored
4
.github/workflows/linux.yaml
vendored
@@ -45,7 +45,7 @@ jobs:
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Setup Maven
|
||||
uses: s4u/setup-maven-action@v1.15.0
|
||||
uses: s4u/setup-maven-action@v1.14.0
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
maven-version: 3.8.8
|
||||
@@ -87,7 +87,7 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Maven
|
||||
uses: s4u/setup-maven-action@v1.15.0
|
||||
uses: s4u/setup-maven-action@v1.14.0
|
||||
with:
|
||||
java-version: 11
|
||||
maven-version: 3.8.8
|
||||
|
||||
2
.github/workflows/openapi-generator.yaml
vendored
2
.github/workflows/openapi-generator.yaml
vendored
@@ -142,8 +142,6 @@ jobs:
|
||||
path: modules/openapi-generator-cli/target
|
||||
- name: Delete samples that are entirely generated
|
||||
run: |
|
||||
rm -rf samples/client/petstore/csharp/generichost/latest/Tags
|
||||
|
||||
rm -rf samples/client/petstore/csharp/generichost/net8/AllOf
|
||||
rm -rf samples/client/petstore/csharp/generichost/net8/AnyOf
|
||||
rm -rf samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare
|
||||
|
||||
3
.github/workflows/samples-dotnet.yaml
vendored
3
.github/workflows/samples-dotnet.yaml
vendored
@@ -3,14 +3,12 @@ name: Samples C# .Net 8 Clients
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- samples/client/petstore/csharp/generichost/latest/**
|
||||
- samples/client/petstore/csharp/generichost/net8/**
|
||||
- samples/client/petstore/csharp/httpclient/net8/**
|
||||
- samples/client/petstore/csharp/restsharp/net8/**
|
||||
- samples/client/petstore/csharp/unityWebRequest/net8/**
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/client/petstore/csharp/generichost/latest/**
|
||||
- samples/client/petstore/csharp/generichost/net8/**
|
||||
- samples/client/petstore/csharp/httpclient/net8/**
|
||||
- samples/client/petstore/csharp/restsharp/net8/**
|
||||
@@ -23,7 +21,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
- samples/client/petstore/csharp/generichost/latest/Tags
|
||||
- samples/client/petstore/csharp/generichost/net8/AllOf
|
||||
- samples/client/petstore/csharp/generichost/net8/AnyOf
|
||||
- samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare
|
||||
|
||||
18
.github/workflows/samples-erlang.yaml
vendored
18
.github/workflows/samples-erlang.yaml
vendored
@@ -3,33 +3,33 @@ name: Samples Erlang
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- samples/server/echo_api/erlang-server/**
|
||||
- samples/server/petstore/erlang-server/**
|
||||
# comment out due to errors
|
||||
# ===> Compiling src/openapi_pet_handler.erl failed
|
||||
# src/openapi_pet_handler.erl:278: function is_authorized/2 already defined
|
||||
#- samples/server/petstore/erlang-server/**
|
||||
- samples/client/petstore/erlang-client/**
|
||||
- samples/client/petstore/erlang-proper/**
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/server/echo_api/erlang-server/**
|
||||
- samples/server/petstore/erlang-server/**
|
||||
#- samples/server/petstore/erlang-server/**
|
||||
- samples/client/petstore/erlang-client/**
|
||||
- samples/client/petstore/erlang-proper/**
|
||||
jobs:
|
||||
build:
|
||||
name: Build Erlang projects
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
- samples/server/echo_api/erlang-server/
|
||||
- samples/server/petstore/erlang-server/
|
||||
#- samples/server/petstore/erlang-server/
|
||||
- samples/client/petstore/erlang-client/
|
||||
- samples/client/petstore/erlang-proper/
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: erlef/setup-beam@v1
|
||||
with:
|
||||
otp-version: '27'
|
||||
rebar3-version: '3.23.0'
|
||||
otp-version: '22.2'
|
||||
rebar3-version: '3.14.3'
|
||||
- run: rebar3 compile
|
||||
working-directory: ${{ matrix.sample }}
|
||||
|
||||
24
.github/workflows/samples-go.yaml
vendored
24
.github/workflows/samples-go.yaml
vendored
@@ -35,27 +35,3 @@ jobs:
|
||||
- name: Run test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: go test -mod=mod -v
|
||||
|
||||
verify:
|
||||
name: Verify generated Go files with Go tests
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
- samples/server/petstore/go-api-server/
|
||||
go-version:
|
||||
- "1.18"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Install Dependencies
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: |
|
||||
go mod tidy
|
||||
- name: Run tests
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: go test ./samples_tests -v
|
||||
2
.github/workflows/samples-postman.yaml
vendored
2
.github/workflows/samples-postman.yaml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
# schema
|
||||
- samples/schema/postman-collection
|
||||
python-version:
|
||||
- "3.12"
|
||||
- "3.11"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
|
||||
@@ -19,7 +19,6 @@ jobs:
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
- "3.11"
|
||||
- "3.12"
|
||||
sample:
|
||||
- samples/openapi3/client/petstore/python-aiohttp
|
||||
- samples/openapi3/client/petstore/python
|
||||
|
||||
@@ -17,11 +17,11 @@ jobs:
|
||||
# clients
|
||||
- samples/client/echo_api/python-pydantic-v1/
|
||||
python-version:
|
||||
- "3.7"
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
- "3.11"
|
||||
- "3.12"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
|
||||
@@ -19,7 +19,6 @@ jobs:
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
- "3.11"
|
||||
- "3.12"
|
||||
sample:
|
||||
- samples/openapi3/client/petstore/python-pydantic-v1-aiohttp
|
||||
- samples/openapi3/client/petstore/python-pydantic-v1
|
||||
|
||||
2
.github/workflows/samples-python-server.yaml
vendored
2
.github/workflows/samples-python-server.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.9'
|
||||
python-version: '3.7'
|
||||
- name: Test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: make test-all
|
||||
|
||||
1
.github/workflows/samples-scala.yaml
vendored
1
.github/workflows/samples-scala.yaml
vendored
@@ -23,7 +23,6 @@ jobs:
|
||||
- 'samples/client/petstore/java/okhttp-gson'
|
||||
- samples/client/petstore/scalaz
|
||||
- samples/client/petstore/scala-pekko
|
||||
- samples/client/petstore/scala-http4s
|
||||
#- samples/client/petstore/scala-sttp # won't pass while the same tests in circleci pass
|
||||
# servers
|
||||
- samples/server/petstore/scala-lagom-server
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Samples Swift 5
|
||||
name: Samples Swift
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -16,18 +16,24 @@ jobs:
|
||||
os: [macos-latest]
|
||||
sample:
|
||||
- samples/client/petstore/swift5/alamofireLibrary
|
||||
- samples/client/petstore/swift5/anycodableLibrary
|
||||
- samples/client/petstore/swift5/asyncAwaitLibrary
|
||||
- samples/client/petstore/swift5/combineLibrary
|
||||
- samples/client/petstore/swift5/default
|
||||
- samples/client/petstore/swift5/deprecated
|
||||
- samples/client/petstore/swift5/frozenEnums
|
||||
- samples/client/petstore/swift5/nonPublicApi
|
||||
- samples/client/petstore/swift5/objcCompatible
|
||||
- samples/client/petstore/swift5/oneOf
|
||||
- samples/client/petstore/swift5/promisekitLibrary
|
||||
- samples/client/petstore/swift5/readonlyProperties
|
||||
- samples/client/petstore/swift5/resultLibrary
|
||||
- samples/client/petstore/swift5/rxswiftLibrary
|
||||
- samples/client/petstore/swift5/urlsessionLibrary
|
||||
- samples/client/petstore/swift5/validation
|
||||
# NOTE: disabled as vaporLibrary doesnt build when adding this CI config
|
||||
#- samples/client/petstore/swift5/vaporLibrary
|
||||
- samples/client/petstore/swift5/x-swift-hashable
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
sample: samples/client/petstore/swift5/alamofireLibrary
|
||||
@@ -1,37 +0,0 @@
|
||||
name: TypeScript Client (Encoding / Decoding Test)
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/client/others/typescript/encode-decode/**
|
||||
- .github/workflows/samples-typescript-encode-decode.yaml
|
||||
jobs:
|
||||
build:
|
||||
name: Test TypeScript Encoding / Decoding
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
# clients
|
||||
- samples/client/others/typescript/encode-decode/test
|
||||
node-version:
|
||||
- 16
|
||||
- 18
|
||||
- 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: |
|
||||
npm run preinstall
|
||||
npm i
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: npm test
|
||||
@@ -1,37 +0,0 @@
|
||||
name: TypeScript Node Client (Encoding / Decoding Test)
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/client/others/typescript-node/encode-decode/**
|
||||
- .github/workflows/samples-typescript-node-encode-decode.yaml
|
||||
jobs:
|
||||
build:
|
||||
name: Test TypeScript Node Encoding / Decoding
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
# clients
|
||||
- samples/client/others/typescript-node/encode-decode/test
|
||||
node-version:
|
||||
- 16
|
||||
- 18
|
||||
- 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: |
|
||||
npm run preinstall
|
||||
npm i
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: npm test
|
||||
2
.github/workflows/windows.yaml
vendored
2
.github/workflows/windows.yaml
vendored
@@ -39,7 +39,7 @@ jobs:
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
- name: Setup Maven
|
||||
uses: s4u/setup-maven-action@v1.15.0
|
||||
uses: s4u/setup-maven-action@v1.14.0
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
maven-version: 3.8.8
|
||||
|
||||
@@ -91,7 +91,6 @@ elif [ "$NODE_INDEX" = "3" ]; then
|
||||
#(cd samples/openapi3/client/petstore/typescript/tests/deno && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/builds/browser && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/tests/browser && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/builds/nullable-enum && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-fetch/builds/default && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-fetch/builds/es6-target && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-fetch/builds/with-npm-version && mvn integration-test)
|
||||
|
||||
49
README.md
49
README.md
@@ -72,7 +72,6 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
|
||||
[<img src="https://openapi-generator.tech/img/companies/itm.png" width="128" height="128">](https://opensource.muenchen.de?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
|
||||
[<img src="https://openapi-generator.tech/img/companies/kong.png" width="128" height="128">](https://konghq.com/products/kong-konnect?utm_medium=referral&utm_source=github&utm_campaign=platform&utm_content=openapi-generator)
|
||||
[<img src="https://openapi-generator.tech/img/companies/route4me.png" width="128" height="128">](https://route4me.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
|
||||
[<img src="https://openapi-generator.tech/img/companies/dm.png" width="128" height="128">](https://www.dotcom-monitor.com/sponsoring-open-source-projects/?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
|
||||
|
||||
@@ -87,7 +86,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 - 18.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo**, **Zapier** |
|
||||
| **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), **Typescript** (AngularJS, Angular (9.x - 18.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo**, **Zapier** |
|
||||
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [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/) |
|
||||
@@ -129,7 +128,7 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
|
||||
| OpenAPI Generator Version | Release Date | Notes |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
|
||||
| 7.9.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.9.0-SNAPSHOT/) | 07.10.2024 | Minor release with breaking changes (with fallback) |
|
||||
| 7.9.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.9.0-SNAPSHOT/) | 23.09.2024 | Minor release with breaking changes (with fallback) |
|
||||
| [7.8.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.8.0) (latest stable release) | 19.08.2024 | 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) |
|
||||
@@ -447,7 +446,41 @@ npm install @openapitools/openapi-generator-cli -D
|
||||
```
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
You can use [locally built JARs](https://github.com/OpenAPITools/openapi-generator-cli?tab=readme-ov-file#use-locally-built-jar) or [`SNAPSHOT` versions](https://github.com/OpenAPITools/openapi-generator-cli?tab=readme-ov-file#use-nightly-snapshot-build) as well.
|
||||
#### Use locally built JAR
|
||||
In order to use a locally built jar of the generator CLI, you can copy the jar from your local build (i.e. if you were to `build` this repository it would be in `~/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar`) into `./node_modules/@openapitools/openapi-generator-cli/versions/` and change the `version` in the `openapitools.json` file to the base name of the jar file.
|
||||
E.g.:
|
||||
```sh
|
||||
cd openapi-generator
|
||||
./mvnw clean package
|
||||
cp ./modules/openapi-generator-cli/target/openapi-generator-cli.jar /your/project/node_modules/@openapitools/openapi-generator-cli/versions/my-local-snapshot.jar
|
||||
```
|
||||
and then:
|
||||
```json
|
||||
{
|
||||
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
||||
"spaces": 2,
|
||||
"generator-cli": {
|
||||
"version": "my-local-snapshot",
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Use nightly `SNAPSHOT` build
|
||||
Change your `openapitools.json` to:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
||||
"spaces": 2,
|
||||
"generator-cli": {
|
||||
"version": "7.9.0-20240829.123431-22",
|
||||
"repository": {
|
||||
"downloadUrl": "https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.9.0-SNAPSHOT/openapi-generator-cli-${versionName}.jar"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
(example is with a snapshot of `7.9.0`, please change the `version` and `downloadUrl` accordingly)
|
||||
|
||||
## [2 - Getting Started](#table-of-contents)
|
||||
|
||||
@@ -1045,12 +1078,10 @@ Here is a list of template creators:
|
||||
* Scala (sttp): @chameleon82
|
||||
* Scala (sttp4): @flsh86
|
||||
* Scala (Pekko): @mickaelmagniez
|
||||
* Scala (http4s): @JennyLeahy
|
||||
* Swift: @tkqubo
|
||||
* Swift 3: @hexelon
|
||||
* Swift 4: @ehyche
|
||||
* Swift 5: @4brunu
|
||||
* Swift 6: @4brunu
|
||||
* Swift Combine: @dydus0x14
|
||||
* TypeScript (Angular1): @mhardorf
|
||||
* TypeScript (Angular2): @roni-frantchi
|
||||
@@ -1076,7 +1107,7 @@ Here is a list of template creators:
|
||||
* C++ (Qt5 QHttpEngine): @etherealjoy
|
||||
* C++ Pistache: @sebymiano
|
||||
* C++ Restbed: @stkrwork
|
||||
* Erlang Server: @galaxie @nelsonvides
|
||||
* Erlang Server: @galaxie
|
||||
* F# (Giraffe) Server: @nmfisher
|
||||
* Go Server: @guohuang
|
||||
* Go Server (refactored in 7.0.0): @lwj5
|
||||
@@ -1187,7 +1218,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Eiffel | @jvelilla (2017/09) |
|
||||
| Elixir | @mrmstn (2018/12) |
|
||||
| Elm | @eriktim (2018/09) |
|
||||
| Erlang | @tsloughter (2017/11) @jfacorro (2018/10) @robertoaloi (2018/10) @nelsonvides (2024/09) |
|
||||
| Erlang | @tsloughter (2017/11) @jfacorro (2018/10) @robertoaloi (2018/10) |
|
||||
| F# | @nmfisher (2019/05) |
|
||||
| Go | @antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) @ph4r5h4d (2021/04) @lwj5 (2023/04) |
|
||||
| GraphQL | @renepardon (2018/12) |
|
||||
@@ -1214,7 +1245,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) |
|
||||
| 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) |
|
||||
| Xojo | @Topheee (2023/04) |
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
generatorName: avro-schema
|
||||
outputDir: samples/openapi3/schema/valid-enums/avro-schema-enum
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/avro-schema/valid-enums.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/avro-schema
|
||||
@@ -2,6 +2,3 @@ generatorName: avro-schema
|
||||
outputDir: samples/openapi3/schema/petstore/avro-schema
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/avro-schema/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/avro-schema
|
||||
additionalProperties:
|
||||
useLogicalTypes: true
|
||||
logicalTypeTimeQuantifier: nanos
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# for csharp generichost
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/generichost/latest/Tags
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/tags.json
|
||||
library: generichost
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
additionalProperties:
|
||||
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
|
||||
modelPropertySorting: alphabetical
|
||||
operationParameterSorting: alphabetical
|
||||
@@ -1,4 +0,0 @@
|
||||
generatorName: erlang-server
|
||||
outputDir: samples/server/echo_api/erlang-server
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/erlang-server
|
||||
@@ -1,11 +0,0 @@
|
||||
generatorName: rust
|
||||
outputDir: samples/client/petstore/rust/reqwest/petstore-async-tokensource
|
||||
library: reqwest
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/rust
|
||||
additionalProperties:
|
||||
supportAsync: true
|
||||
supportTokenSource: true
|
||||
supportMultipleResponses: true
|
||||
packageName: petstore-reqwest-async-tokensource
|
||||
useSingleRequestParameter: true
|
||||
@@ -1,6 +0,0 @@
|
||||
generatorName: scala-http4s
|
||||
outputDir: samples/client/petstore/scala-http4s
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/scala-http4s/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/scala-http4s
|
||||
additionalProperties:
|
||||
artifactId: scala-http4s-client
|
||||
10
bin/configs/swift5-any-codable.yaml
Normal file
10
bin/configs/swift5-any-codable.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
generatorName: swift5
|
||||
outputDir: samples/client/petstore/swift5/anycodableLibrary
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/any_codable.yaml
|
||||
modelNamePrefix: Prefix
|
||||
modelNameSuffix: Suffix
|
||||
additionalProperties:
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
10
bin/configs/swift5-deprecated.yaml
Normal file
10
bin/configs/swift5-deprecated.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
generatorName: swift5
|
||||
outputDir: samples/client/petstore/swift5/deprecated
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-deprecated-fields.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift5
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
@@ -1,12 +1,12 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/combineDeferredLibrary
|
||||
generatorName: swift5
|
||||
outputDir: samples/client/petstore/swift5/frozenEnums
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift5
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
responseAs: Combine
|
||||
useSPMFileStructure: false
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
sortParamsByRequiredFlag: false
|
||||
enumUnknownDefaultCase: true
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
@@ -1,18 +1,13 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/resultLibrary
|
||||
generatorName: swift5
|
||||
outputDir: samples/client/petstore/swift5/nonPublicApi
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift5
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
responseAs: Result
|
||||
useSPMFileStructure: false
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
sortParamsByRequiredFlag: false
|
||||
enumUnknownDefaultCase: true
|
||||
nonPublicApi: true
|
||||
readonlyProperties: true
|
||||
hashableModels: false
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
nameMappings:
|
||||
@@ -1,12 +1,11 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/objcCompatible
|
||||
generatorName: swift5
|
||||
outputDir: samples/client/petstore/swift5/readonlyProperties
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift5
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
responseAs: ObjcBlock
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
objcCompatible: true
|
||||
readonlyProperties: true
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
@@ -7,19 +7,5 @@ additionalProperties:
|
||||
responseAs: Result
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
sortParamsByRequiredFlag: false
|
||||
enumUnknownDefaultCase: true
|
||||
nonPublicApi: true
|
||||
readonlyProperties: true
|
||||
hashableModels: false
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
nameMappings:
|
||||
_type: underscoreType
|
||||
type_: typeWithUnderscore
|
||||
-type: dashType
|
||||
parameterNameMappings:
|
||||
_type: underscoreType
|
||||
type_: typeWithUnderscore
|
||||
-type: dashType
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/asyncAwaitLibrary
|
||||
generatorName: swift5
|
||||
outputDir: samples/client/petstore/swift5/x-swift-hashable
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift5
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
responseAs: AsyncAwait
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
hashableModels: false
|
||||
@@ -1,13 +0,0 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/alamofireLibrary
|
||||
library: alamofire
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
generateAliasAsModel: true
|
||||
useCustomDateWithoutTime: true
|
||||
additionalProperties:
|
||||
responseAs: ObjcBlock
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
@@ -1,13 +0,0 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/apiNonStaticMethod
|
||||
library: alamofire
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
additionalProperties:
|
||||
responseAs: AsyncAwait,Combine,Result,PromiseKit,RxSwift,ObjcBlock
|
||||
apiStaticMethod: false
|
||||
mapFileBinaryToData: true
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
@@ -1,13 +0,0 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/combineLibrary
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
responseAs: Combine
|
||||
combineDeferred: false
|
||||
swiftPackagePath: "Sources/CombineLibrary"
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
@@ -1,12 +0,0 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/default
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
enumNameMappings:
|
||||
delivered: shipped
|
||||
@@ -1,12 +0,0 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/oneOf
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
responseAs: ObjcBlock
|
||||
useSPMFileStructure: false
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
@@ -1,12 +0,0 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/promisekitLibrary
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
useSPMFileStructure: false
|
||||
responseAs: PromiseKit
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
@@ -1,14 +0,0 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/rxswiftLibrary
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
responseAs: RxSwift
|
||||
useSPMFileStructure: false
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
useBacktickEscapes: true
|
||||
generateModelAdditionalProperties: false
|
||||
@@ -1,16 +0,0 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/urlsessionLibrary
|
||||
library: urlsession
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
responseAs: ObjcBlock
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
useSPMFileStructure: true
|
||||
mapFileBinaryToData: true
|
||||
useClasses: true
|
||||
swiftUseApiNamespace: true
|
||||
@@ -1,11 +0,0 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/validation
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/validation.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
useSPMFileStructure: false
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
@@ -1,12 +0,0 @@
|
||||
generatorName: swift6
|
||||
outputDir: samples/client/petstore/swift6/vaporLibrary
|
||||
library: vapor
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift6
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
projectName: PetstoreClient
|
||||
useSPMFileStructure: true
|
||||
useClasses: true
|
||||
useBacktickEscapes: true
|
||||
mapFileBinaryToData: true
|
||||
@@ -1,4 +0,0 @@
|
||||
generatorName: typescript
|
||||
outputDir: samples/client/others/typescript/builds/array-of-lists
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript/array_list.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript
|
||||
@@ -1,4 +0,0 @@
|
||||
generatorName: typescript
|
||||
outputDir: samples/openapi3/client/petstore/typescript/builds/nullable-enum
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript/19027-regression.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript
|
||||
@@ -1,4 +0,0 @@
|
||||
generatorName: typescript
|
||||
outputDir: samples/client/others/typescript/builds/null-types-simple
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_1/null-types-simple.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript
|
||||
@@ -1,4 +0,0 @@
|
||||
generatorName: typescript
|
||||
outputDir: samples/client/others/typescript/builds/enum-single-value
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_1/enum-single-value.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript
|
||||
@@ -1,11 +0,0 @@
|
||||
generatorName: typescript
|
||||
outputDir: samples/client/others/typescript/encode-decode/build
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_1/encode-decode.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript
|
||||
additionalProperties:
|
||||
artifactId: encode-decode-typescript
|
||||
hideGenerationTimestamp: "true"
|
||||
npmVersion: 1.0.0
|
||||
npmName: '@openapitools/typescript-encode-decode'
|
||||
nullSafeAdditionalProps: true
|
||||
platform: node
|
||||
@@ -1,4 +0,0 @@
|
||||
generatorName: typescript-node
|
||||
outputDir: samples/client/petstore/typescript-node/3_0
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript-node/SampleProject.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-node
|
||||
@@ -1,10 +0,0 @@
|
||||
generatorName: typescript-node
|
||||
outputDir: samples/client/others/typescript-node/encode-decode/build
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_1/encode-decode.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-node
|
||||
additionalProperties:
|
||||
artifactId: encode-decode-typescript-node
|
||||
hideGenerationTimestamp: "true"
|
||||
npmVersion: 1.0.0
|
||||
npmName: '@openapitools/typescript-node-encode-decode'
|
||||
nullSafeAdditionalProps: true
|
||||
11
bitrise.yml
11
bitrise.yml
@@ -18,15 +18,6 @@ workflows:
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sudo gem install cocoapods
|
||||
- script@1.2.0:
|
||||
title: Run Swift6 tests
|
||||
inputs:
|
||||
- content: |
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
./samples/client/petstore/swift6/swift6_test_all.sh
|
||||
- script@1.2.0:
|
||||
title: Run Swift5 tests
|
||||
inputs:
|
||||
@@ -48,4 +39,4 @@ workflows:
|
||||
|
||||
meta:
|
||||
bitrise.io:
|
||||
stack: osx-xcode-16.0.x
|
||||
stack: osx-xcode-14.3.x-ventura
|
||||
|
||||
@@ -201,23 +201,6 @@ The steps are shown here for a specific version of the generator, but apply the
|
||||
```
|
||||
* Set breakpoints in code, and then attach your remote debugger from your IDE (see above). The generator will automatically unblock once the remote debugger is attached. You can now step through the code.
|
||||
|
||||
For VSCode you can use the following launch configuration (`launch.json`):
|
||||
```json
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Debug (Attach)",
|
||||
"request": "attach",
|
||||
"hostName": "localhost",
|
||||
"port": 5005
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
to attach the the suspended process above.
|
||||
|
||||
## Logs
|
||||
|
||||
You can try to enable debugging log with `-Dlog.level=debug` option to the `JAVA_OPTS` environment variable to see more information:
|
||||
|
||||
@@ -19,7 +19,6 @@ Also refer to the relevant documentation for [CLI](./usage.md), [Maven Plugin](h
|
||||
The following environment variables are supported by their respective generators:
|
||||
<!-- query with: grep -Rn '_POST_PROCESS_FILE"' modules | grep -Eo '[^"]+_POST_PROCESS_FILE' | sort -u -->
|
||||
|
||||
* `AVRO_POST_PROCESS_FILE`
|
||||
* `CPP_POST_PROCESS_FILE`
|
||||
* `CSHARP_POST_PROCESS_FILE`
|
||||
* `C_POST_PROCESS_FILE`
|
||||
|
||||
@@ -59,14 +59,12 @@ The following generators are available:
|
||||
* [rust](generators/rust.md)
|
||||
* [scala-akka](generators/scala-akka.md)
|
||||
* [scala-gatling](generators/scala-gatling.md)
|
||||
* [scala-http4s](generators/scala-http4s.md)
|
||||
* [scala-pekko](generators/scala-pekko.md)
|
||||
* [scala-sttp](generators/scala-sttp.md)
|
||||
* [scala-sttp4 (beta)](generators/scala-sttp4.md)
|
||||
* [scalaz](generators/scalaz.md)
|
||||
* [swift-combine](generators/swift-combine.md)
|
||||
* [swift5](generators/swift5.md)
|
||||
* [swift6 (experimental)](generators/swift6.md)
|
||||
* [typescript (experimental)](generators/typescript.md)
|
||||
* [typescript-angular](generators/typescript-angular.md)
|
||||
* [typescript-aurelia](generators/typescript-aurelia.md)
|
||||
@@ -91,7 +89,6 @@ The following generators are available:
|
||||
* [cpp-restbed-server-deprecated](generators/cpp-restbed-server-deprecated.md)
|
||||
* [csharp-functions](generators/csharp-functions.md)
|
||||
* [erlang-server](generators/erlang-server.md)
|
||||
* [erlang-server-deprecated (deprecated)](generators/erlang-server-deprecated.md)
|
||||
* [fsharp-functions (beta)](generators/fsharp-functions.md)
|
||||
* [fsharp-giraffe-server (beta)](generators/fsharp-giraffe-server.md)
|
||||
* [go-echo-server (beta)](generators/go-echo-server.md)
|
||||
|
||||
@@ -23,12 +23,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|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|
|
||||
|logicalTypeTimeQuantifier|The quantifier for time-related logical types (`timestamp` and `local-timestamp`).|<dl><dt>**nanos**</dt><dd>nanoseconds</dd><dt>**micros**</dt><dd>microseconds</dd><dt>**millis**</dt><dd>milliseconds</dd></dl>|millis|
|
||||
|packageName|package for generated classes (where supported)| |null|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|useLogicalTypes|Use logical types for fields, when matching OpenAPI types. Currently supported: `date-time`, `date`.| |false|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|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|
|
||||
|makeOperationsVirtual|Make all operations methods virtual. This makes it easy to mock the generated API class for testing purposes.| |true|
|
||||
|modelNamePrefix|Prefix that will be prepended to all model names.| |OAI|
|
||||
|optionalProjectFile|Generate client.pri.| |true|
|
||||
|packageName|C++ package (library) name.| |QtOpenAPIClient|
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
---
|
||||
title: Documentation for the erlang-server-deprecated Generator
|
||||
---
|
||||
|
||||
## METADATA
|
||||
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | erlang-server-deprecated | pass this to the generate command after -g |
|
||||
| generator stability | DEPRECATED | |
|
||||
| generator type | SERVER | |
|
||||
| generator language | Erlang | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates an Erlang server library (deprecated) using OpenAPI Generator (https://openapi-generator.tech). By default, it will also generate service classes, which can be disabled with the `-Dnoservice` environment variable. | |
|
||||
|
||||
## 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 |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|openAPISpecName|Openapi Spec Name.| |openapi|
|
||||
|packageName|Erlang package name (convention: lowercase).| |openapi|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>after</li>
|
||||
<li>and</li>
|
||||
<li>andalso</li>
|
||||
<li>band</li>
|
||||
<li>begin</li>
|
||||
<li>bnot</li>
|
||||
<li>bor</li>
|
||||
<li>bsl</li>
|
||||
<li>bsr</li>
|
||||
<li>bxor</li>
|
||||
<li>case</li>
|
||||
<li>catch</li>
|
||||
<li>cond</li>
|
||||
<li>div</li>
|
||||
<li>end</li>
|
||||
<li>fun</li>
|
||||
<li>if</li>
|
||||
<li>let</li>
|
||||
<li>not</li>
|
||||
<li>of</li>
|
||||
<li>or</li>
|
||||
<li>orelse</li>
|
||||
<li>receive</li>
|
||||
<li>rem</li>
|
||||
<li>try</li>
|
||||
<li>when</li>
|
||||
<li>xor</li>
|
||||
</ul>
|
||||
|
||||
## FEATURE SET
|
||||
|
||||
|
||||
### Client Modification Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasePath|✗|ToolingExtension
|
||||
|Authorizations|✗|ToolingExtension
|
||||
|UserAgent|✗|ToolingExtension
|
||||
|MockServer|✗|ToolingExtension
|
||||
|
||||
### Data Type Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Custom|✗|OAS2,OAS3
|
||||
|Int32|✓|OAS2,OAS3
|
||||
|Int64|✓|OAS2,OAS3
|
||||
|Float|✓|OAS2,OAS3
|
||||
|Double|✓|OAS2,OAS3
|
||||
|Decimal|✓|ToolingExtension
|
||||
|String|✓|OAS2,OAS3
|
||||
|Byte|✓|OAS2,OAS3
|
||||
|Binary|✓|OAS2,OAS3
|
||||
|Boolean|✓|OAS2,OAS3
|
||||
|Date|✓|OAS2,OAS3
|
||||
|DateTime|✓|OAS2,OAS3
|
||||
|Password|✓|OAS2,OAS3
|
||||
|File|✓|OAS2
|
||||
|Uuid|✗|
|
||||
|Array|✓|OAS2,OAS3
|
||||
|Null|✗|OAS3
|
||||
|AnyType|✗|OAS2,OAS3
|
||||
|Object|✓|OAS2,OAS3
|
||||
|Maps|✓|ToolingExtension
|
||||
|CollectionFormat|✓|OAS2
|
||||
|CollectionFormatMulti|✓|OAS2
|
||||
|Enum|✓|OAS2,OAS3
|
||||
|ArrayOfEnum|✓|ToolingExtension
|
||||
|ArrayOfModel|✓|ToolingExtension
|
||||
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|
||||
|ArrayOfCollectionOfModel|✓|ToolingExtension
|
||||
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|
||||
|MapOfEnum|✓|ToolingExtension
|
||||
|MapOfModel|✓|ToolingExtension
|
||||
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|
||||
|MapOfCollectionOfModel|✓|ToolingExtension
|
||||
|MapOfCollectionOfEnum|✓|ToolingExtension
|
||||
|
||||
### Documentation Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Readme|✓|ToolingExtension
|
||||
|Model|✓|ToolingExtension
|
||||
|Api|✓|ToolingExtension
|
||||
|
||||
### Global Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Host|✓|OAS2,OAS3
|
||||
|BasePath|✓|OAS2,OAS3
|
||||
|Info|✓|OAS2,OAS3
|
||||
|Schemes|✗|OAS2,OAS3
|
||||
|PartialSchemes|✓|OAS2,OAS3
|
||||
|Consumes|✓|OAS2
|
||||
|Produces|✓|OAS2
|
||||
|ExternalDocumentation|✓|OAS2,OAS3
|
||||
|Examples|✓|OAS2,OAS3
|
||||
|XMLStructureDefinitions|✗|OAS2,OAS3
|
||||
|MultiServer|✗|OAS3
|
||||
|ParameterizedServer|✗|OAS3
|
||||
|ParameterStyling|✗|OAS3
|
||||
|Callbacks|✗|OAS3
|
||||
|LinkObjects|✗|OAS3
|
||||
|
||||
### Parameter Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Path|✓|OAS2,OAS3
|
||||
|Query|✓|OAS2,OAS3
|
||||
|Header|✓|OAS2,OAS3
|
||||
|Body|✓|OAS2
|
||||
|FormUnencoded|✓|OAS2
|
||||
|FormMultipart|✓|OAS2
|
||||
|Cookie|✗|OAS3
|
||||
|
||||
### Schema Support Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Simple|✓|OAS2,OAS3
|
||||
|Composite|✓|OAS2,OAS3
|
||||
|Polymorphism|✗|OAS2,OAS3
|
||||
|Union|✗|OAS3
|
||||
|allOf|✗|OAS2,OAS3
|
||||
|anyOf|✗|OAS3
|
||||
|oneOf|✗|OAS3
|
||||
|not|✗|OAS3
|
||||
|
||||
### Security Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasicAuth|✗|OAS2,OAS3
|
||||
|ApiKey|✓|OAS2,OAS3
|
||||
|OpenIDConnect|✗|OAS3
|
||||
|BearerToken|✗|OAS3
|
||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||
|OAuth2_Password|✗|OAS2,OAS3
|
||||
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|
||||
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
|
||||
|SignatureAuth|✗|OAS3
|
||||
|AWSV4Signature|✗|ToolingExtension
|
||||
|
||||
### Wire Format Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|JSON|✓|OAS2,OAS3
|
||||
|XML|✗|OAS2,OAS3
|
||||
|PROTOBUF|✗|ToolingExtension
|
||||
|Custom|✗|OAS2,OAS3
|
||||
@@ -59,7 +59,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>fun</li>
|
||||
<li>if</li>
|
||||
<li>let</li>
|
||||
<li>maybe</li>
|
||||
<li>not</li>
|
||||
<li>of</li>
|
||||
<li>or</li>
|
||||
|
||||
@@ -25,7 +25,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|collectionType|Option. Collection type to use|<dl><dt>**array**</dt><dd>kotlin.Array</dd><dt>**list**</dt><dd>kotlin.collections.List</dd></dl>|list|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**threetenbp-localdatetime**</dt><dd>Threetenbp - Backport of JSR310 (jvm only, for legacy app only)</dd><dt>**kotlinx-datetime**</dt><dd>kotlinx-datetime (preferred for multiplatform)</dd><dt>**string**</dt><dd>String</dd><dt>**java8-localdatetime**</dt><dd>Java 8 native JSR310 (jvm only, for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (jvm only, preferred for jdk 1.8+)</dd><dt>**threetenbp**</dt><dd>Threetenbp - Backport of JSR310 (jvm only, preferred for jdk < 1.8)</dd></dl>|java8|
|
||||
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
|
||||
|failOnUnknownProperties|Fail Jackson de-serialization on unknown properties| |false|
|
||||
|generateOneOfAnyOfWrappers|Generate oneOf, anyOf schemas as wrappers.| |false|
|
||||
|generateRoomModels|Generate Android Room database models in addition to API models (JVM Volley library only)| |false|
|
||||
|groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools|
|
||||
|
||||
@@ -29,7 +29,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|supportAsync|If set, generate async function call instead. This option is for 'reqwest' library only| |true|
|
||||
|supportMiddleware|If set, add support for reqwest-middleware. This option is for 'reqwest' library only| |false|
|
||||
|supportMultipleResponses|If set, return type wraps an enum of all possible 2xx schemas. This option is for 'reqwest' library only| |false|
|
||||
|supportTokenSource|If set, add support for google-cloud-token. This option is for 'reqwest' library only and requires the 'supportAsync' option| |false|
|
||||
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |false|
|
||||
|withAWSV4Signature|whether to include AWS v4 signature support| |false|
|
||||
|
||||
|
||||
@@ -1,273 +0,0 @@
|
||||
---
|
||||
title: Documentation for the scala-http4s Generator
|
||||
---
|
||||
|
||||
## METADATA
|
||||
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | scala-http4s | pass this to the generate command after -g |
|
||||
| generator stability | STABLE | |
|
||||
| generator type | CLIENT | |
|
||||
| generator language | Scala | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates a scala-http4s client. | |
|
||||
|
||||
## CONFIG OPTIONS
|
||||
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|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|
|
||||
|modelPackage|package for generated models| |null|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|sourceFolder|source folder for generated code| |null|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|ArrayBuffer|scala.collection.mutable.ArrayBuffer|
|
||||
|Date|java.util.Date|
|
||||
|File|java.io.File|
|
||||
|HashMap|scala.collection.immutable.HashMap|
|
||||
|Instant|java.time.Instant|
|
||||
|Json|io.circe.Json|
|
||||
|LocalDate|java.time.LocalDate|
|
||||
|LocalDateTime|java.time.LocalDateTime|
|
||||
|LocalTime|java.time.LocalTime|
|
||||
|Map|scala.collection.immutable.Map|
|
||||
|OffsetDateTime|java.time.OffsetDateTime|
|
||||
|Seq|scala.collection.immutable.Seq|
|
||||
|Timestamp|java.sql.Timestamp|
|
||||
|URI|java.net.URI|
|
||||
|UUID|java.util.UUID|
|
||||
|ZonedDateTime|java.time.ZonedDateTime|
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|array|Seq|
|
||||
|list|List|
|
||||
|map|Map|
|
||||
|seq|Seq|
|
||||
|set|Set|
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Any</li>
|
||||
<li>AnyRef</li>
|
||||
<li>AnyVal</li>
|
||||
<li>BigDecimal</li>
|
||||
<li>Boolean</li>
|
||||
<li>Double</li>
|
||||
<li>Float</li>
|
||||
<li>Int</li>
|
||||
<li>Integer</li>
|
||||
<li>Long</li>
|
||||
<li>Object</li>
|
||||
<li>String</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>abstract</li>
|
||||
<li>assert</li>
|
||||
<li>break</li>
|
||||
<li>byte</li>
|
||||
<li>case</li>
|
||||
<li>catch</li>
|
||||
<li>char</li>
|
||||
<li>class</li>
|
||||
<li>const</li>
|
||||
<li>continue</li>
|
||||
<li>def</li>
|
||||
<li>default</li>
|
||||
<li>do</li>
|
||||
<li>double</li>
|
||||
<li>else</li>
|
||||
<li>enum</li>
|
||||
<li>extends</li>
|
||||
<li>false</li>
|
||||
<li>final</li>
|
||||
<li>finally</li>
|
||||
<li>float</li>
|
||||
<li>for</li>
|
||||
<li>forsome</li>
|
||||
<li>goto</li>
|
||||
<li>if</li>
|
||||
<li>implements</li>
|
||||
<li>implicit</li>
|
||||
<li>import</li>
|
||||
<li>instanceof</li>
|
||||
<li>int</li>
|
||||
<li>interface</li>
|
||||
<li>lazy</li>
|
||||
<li>long</li>
|
||||
<li>match</li>
|
||||
<li>native</li>
|
||||
<li>new</li>
|
||||
<li>null</li>
|
||||
<li>object</li>
|
||||
<li>override</li>
|
||||
<li>package</li>
|
||||
<li>private</li>
|
||||
<li>protected</li>
|
||||
<li>public</li>
|
||||
<li>return</li>
|
||||
<li>sealed</li>
|
||||
<li>short</li>
|
||||
<li>static</li>
|
||||
<li>strictfp</li>
|
||||
<li>super</li>
|
||||
<li>switch</li>
|
||||
<li>synchronized</li>
|
||||
<li>this</li>
|
||||
<li>throw</li>
|
||||
<li>throws</li>
|
||||
<li>trait</li>
|
||||
<li>transient</li>
|
||||
<li>true</li>
|
||||
<li>try</li>
|
||||
<li>type</li>
|
||||
<li>val</li>
|
||||
<li>var</li>
|
||||
<li>void</li>
|
||||
<li>volatile</li>
|
||||
<li>while</li>
|
||||
<li>with</li>
|
||||
<li>yield</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
|
||||
@@ -27,11 +27,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|hashableModels|Make hashable models (default: true)| |true|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|lenientTypeCast|Accept and cast values for simple types (string->bool, string->int, int->string)| |false|
|
||||
|library|Library template (sub-template) to use|<dl><dt>**urlsession**</dt><dd>[DEFAULT] HTTP client: URLSession</dd><dt>**alamofire**</dt><dd>HTTP client: Alamofire</dd><dt>**vapor**</dt><dd>HTTP client: Vapor</dd></dl>|urlsession|
|
||||
|mapFileBinaryToData|[WARNING] This option will be removed and enabled by default in the future once we've enhanced the code to work with `Data` in all the different situations. Map File and Binary to Data (default: false)| |false|
|
||||
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null|
|
||||
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
|
||||
|oneOfUnknownDefaultCase|Add unknownDefault case to oneOf enum (default: false)| |false|
|
||||
|podAuthors|Authors used for Podspec| |null|
|
||||
|podDescription|Description used for Podspec| |null|
|
||||
|podDocumentationURL|Documentation URL used for Podspec| |null|
|
||||
|
||||
@@ -1,358 +0,0 @@
|
||||
---
|
||||
title: Documentation for the swift6 Generator
|
||||
---
|
||||
|
||||
## METADATA
|
||||
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | swift6 | pass this to the generate command after -g |
|
||||
| generator stability | EXPERIMENTAL | |
|
||||
| generator type | CLIENT | |
|
||||
| generator language | Swift | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates a Swift 6.x 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.
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiNamePrefix|Prefix that will be appended to all API names ('tags'). Default: empty string. e.g. Pet => Pet.| |null|
|
||||
|apiStaticMethod|Make api calls using a static method (default: true)| |true|
|
||||
|combineDeferred|Make combine usages deferred (default: true)| |true|
|
||||
|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|
|
||||
|generateModelAdditionalProperties|Generate model additional properties (default: true)| |true|
|
||||
|hashableModels|Make hashable models (default: true)| |true|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|library|Library template (sub-template) to use|<dl><dt>**urlsession**</dt><dd>[DEFAULT] HTTP client: URLSession</dd><dt>**alamofire**</dt><dd>HTTP client: Alamofire</dd><dt>**vapor**</dt><dd>HTTP client: Vapor</dd></dl>|urlsession|
|
||||
|mapFileBinaryToData|Map File and Binary to Data (default: false)| |false|
|
||||
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null|
|
||||
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
|
||||
|oneOfUnknownDefaultCase|Add unknownDefault case to oneOf enum (default: false)| |false|
|
||||
|podAuthors|Authors used for Podspec| |null|
|
||||
|podDescription|Description used for Podspec| |null|
|
||||
|podDocumentationURL|Documentation URL used for Podspec| |null|
|
||||
|podHomepage|Homepage used for Podspec| |null|
|
||||
|podLicense|License used for Podspec| |null|
|
||||
|podScreenshots|Screenshots used for Podspec| |null|
|
||||
|podSocialMediaURL|Social Media URL used for Podspec| |null|
|
||||
|podSource|Source information used for Podspec| |null|
|
||||
|podSummary|Summary used for Podspec| |null|
|
||||
|podVersion|Version used for Podspec| |null|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|projectName|Project name in Xcode| |null|
|
||||
|readonlyProperties|Make properties readonly (default: false)| |null|
|
||||
|responseAs|Optionally use libraries to manage response. Currently AsyncAwait, Combine, Result, RxSwift, ObjcBlock, PromiseKit are available.| |null|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|swiftPackagePath|Set a custom source path instead of Sources/{{projectName}}.| |null|
|
||||
|swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null|
|
||||
|useBacktickEscapes|Escape reserved words using backticks (default: false)| |false|
|
||||
|useClasses|Use final classes for models instead of structs (default: false)| |false|
|
||||
|useCustomDateWithoutTime|Uses a custom type to decode and encode dates without time information to support OpenAPIs date format (default: false)| |false|
|
||||
|useJsonEncodable|Make models conform to JSONEncodable protocol (default: true)| |true|
|
||||
|useSPMFileStructure|Use SPM file structure and set the source path to Sources/{{projectName}} (default: true).| |null|
|
||||
|validatable|Make validation rules and validator for model properies (default: true)| |true|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Any</li>
|
||||
<li>AnyObject</li>
|
||||
<li>Bool</li>
|
||||
<li>Character</li>
|
||||
<li>Data</li>
|
||||
<li>Date</li>
|
||||
<li>Decimal</li>
|
||||
<li>Double</li>
|
||||
<li>Float</li>
|
||||
<li>Int</li>
|
||||
<li>Int32</li>
|
||||
<li>Int64</li>
|
||||
<li>JSONValue</li>
|
||||
<li>OpenAPIDateWithoutTime</li>
|
||||
<li>String</li>
|
||||
<li>URL</li>
|
||||
<li>UUID</li>
|
||||
<li>Void</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>#available</li>
|
||||
<li>#colorLiteral</li>
|
||||
<li>#column</li>
|
||||
<li>#else</li>
|
||||
<li>#elseif</li>
|
||||
<li>#endif</li>
|
||||
<li>#file</li>
|
||||
<li>#fileLiteral</li>
|
||||
<li>#function</li>
|
||||
<li>#if</li>
|
||||
<li>#imageLiteral</li>
|
||||
<li>#line</li>
|
||||
<li>#selector</li>
|
||||
<li>#sourceLocation</li>
|
||||
<li>Any</li>
|
||||
<li>AnyObject</li>
|
||||
<li>Array</li>
|
||||
<li>Bool</li>
|
||||
<li>COLUMN</li>
|
||||
<li>Character</li>
|
||||
<li>Class</li>
|
||||
<li>ClosedRange</li>
|
||||
<li>Codable</li>
|
||||
<li>CountableClosedRange</li>
|
||||
<li>CountableRange</li>
|
||||
<li>Data</li>
|
||||
<li>Decodable</li>
|
||||
<li>Dictionary</li>
|
||||
<li>Double</li>
|
||||
<li>Encodable</li>
|
||||
<li>Error</li>
|
||||
<li>ErrorResponse</li>
|
||||
<li>FILE</li>
|
||||
<li>FUNCTION</li>
|
||||
<li>Float</li>
|
||||
<li>Float32</li>
|
||||
<li>Float64</li>
|
||||
<li>Float80</li>
|
||||
<li>Int</li>
|
||||
<li>Int16</li>
|
||||
<li>Int32</li>
|
||||
<li>Int64</li>
|
||||
<li>Int8</li>
|
||||
<li>LINE</li>
|
||||
<li>OptionSet</li>
|
||||
<li>Optional</li>
|
||||
<li>Protocol</li>
|
||||
<li>Range</li>
|
||||
<li>Response</li>
|
||||
<li>Self</li>
|
||||
<li>Set</li>
|
||||
<li>StaticString</li>
|
||||
<li>String</li>
|
||||
<li>Type</li>
|
||||
<li>UInt</li>
|
||||
<li>UInt16</li>
|
||||
<li>UInt32</li>
|
||||
<li>UInt64</li>
|
||||
<li>UInt8</li>
|
||||
<li>URL</li>
|
||||
<li>Unicode</li>
|
||||
<li>Void</li>
|
||||
<li>_</li>
|
||||
<li>as</li>
|
||||
<li>associatedtype</li>
|
||||
<li>associativity</li>
|
||||
<li>break</li>
|
||||
<li>case</li>
|
||||
<li>catch</li>
|
||||
<li>class</li>
|
||||
<li>continue</li>
|
||||
<li>convenience</li>
|
||||
<li>default</li>
|
||||
<li>defer</li>
|
||||
<li>deinit</li>
|
||||
<li>didSet</li>
|
||||
<li>do</li>
|
||||
<li>dynamic</li>
|
||||
<li>dynamicType</li>
|
||||
<li>else</li>
|
||||
<li>enum</li>
|
||||
<li>extension</li>
|
||||
<li>fallthrough</li>
|
||||
<li>false</li>
|
||||
<li>fileprivate</li>
|
||||
<li>final</li>
|
||||
<li>for</li>
|
||||
<li>func</li>
|
||||
<li>get</li>
|
||||
<li>guard</li>
|
||||
<li>if</li>
|
||||
<li>import</li>
|
||||
<li>in</li>
|
||||
<li>indirect</li>
|
||||
<li>infix</li>
|
||||
<li>init</li>
|
||||
<li>inout</li>
|
||||
<li>internal</li>
|
||||
<li>is</li>
|
||||
<li>lazy</li>
|
||||
<li>left</li>
|
||||
<li>let</li>
|
||||
<li>mutating</li>
|
||||
<li>nil</li>
|
||||
<li>none</li>
|
||||
<li>nonmutating</li>
|
||||
<li>open</li>
|
||||
<li>operator</li>
|
||||
<li>optional</li>
|
||||
<li>override</li>
|
||||
<li>postfix</li>
|
||||
<li>precedence</li>
|
||||
<li>prefix</li>
|
||||
<li>private</li>
|
||||
<li>protocol</li>
|
||||
<li>public</li>
|
||||
<li>repeat</li>
|
||||
<li>required</li>
|
||||
<li>rethrows</li>
|
||||
<li>return</li>
|
||||
<li>right</li>
|
||||
<li>self</li>
|
||||
<li>set</li>
|
||||
<li>static</li>
|
||||
<li>struct</li>
|
||||
<li>subscript</li>
|
||||
<li>super</li>
|
||||
<li>switch</li>
|
||||
<li>throw</li>
|
||||
<li>throws</li>
|
||||
<li>true</li>
|
||||
<li>try</li>
|
||||
<li>typealias</li>
|
||||
<li>unowned</li>
|
||||
<li>var</li>
|
||||
<li>weak</li>
|
||||
<li>where</li>
|
||||
<li>while</li>
|
||||
<li>willSet</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
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.9.0</version>
|
||||
<version>7.9.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.9.0</version>
|
||||
<version>7.9.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=7.9.0
|
||||
openApiGeneratorVersion=7.9.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
# BEGIN placeholders
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.9.0</version>
|
||||
<version>7.9.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=7.9.0
|
||||
openApiGeneratorVersion=7.9.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
@@ -80,15 +80,6 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
|
||||
@Input
|
||||
val generatorName = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* This is the configuration for reference paths where schemas for openapi generation are stored
|
||||
* The directory which contains the additional schema files
|
||||
*/
|
||||
@Optional
|
||||
@InputDirectory
|
||||
@PathSensitive(PathSensitivity.ABSOLUTE)
|
||||
val schemaLocation = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* The output target directory into which code will be generated.
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.9.0</version>
|
||||
<version>7.9.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.9.0</version>
|
||||
<version>7.9.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.9.0</version>
|
||||
<version>7.9.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.9.0</version>
|
||||
<version>7.9.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.9.0</version>
|
||||
<version>7.9.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.9.0</version>
|
||||
<version>7.9.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.9.0</version>
|
||||
<version>7.9.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.9.0</version>
|
||||
<version>7.9.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.9.0</version>
|
||||
<version>7.9.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -256,10 +256,6 @@ public interface CodegenConfig {
|
||||
|
||||
void setSkipOperationExample(boolean skipOperationExample);
|
||||
|
||||
boolean isSkipSortingOperations();
|
||||
|
||||
void setSkipSortingOperations(boolean skipSortingOperations);
|
||||
|
||||
public boolean isHideGenerationTimestamp();
|
||||
|
||||
public void setHideGenerationTimestamp(boolean hideGenerationTimestamp);
|
||||
|
||||
@@ -30,7 +30,7 @@ public class CodegenOperation {
|
||||
hasVersionHeaders = false, hasVersionQueryParams = false,
|
||||
isResponseBinary = false, isResponseFile = false, isResponseOptional = false, hasReference = false, defaultReturnType = false,
|
||||
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
|
||||
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false, hasOnlyDefaultResponse = false, hasConstantParams = false,
|
||||
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false, hasConstantParams = false,
|
||||
hasErrorResponseObject, // if 4xx, 5xx responses have at least one error object defined
|
||||
hasSingleParam = false; // if the operation has only one parameter;
|
||||
public CodegenProperty returnProperty;
|
||||
@@ -215,13 +215,6 @@ public class CodegenOperation {
|
||||
return responses.stream().anyMatch(response -> response.isDefault);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the responses contain only 1 entry and it's default
|
||||
*
|
||||
* @return true if responses contain only 1 entry and it's a default response, false otherwise
|
||||
*/
|
||||
public boolean getHasOnlyDefaultResponse() { return responses.size() == 1 && getHasDefaultResponse(); }
|
||||
|
||||
public boolean getAllResponsesAreErrors() {
|
||||
return responses.stream().allMatch(response -> response.is4xx || response.is5xx);
|
||||
}
|
||||
@@ -358,7 +351,6 @@ public class CodegenOperation {
|
||||
sb.append(", isResponseOptional=").append(isResponseOptional);
|
||||
sb.append(", hasReference=").append(hasReference);
|
||||
sb.append(", hasDefaultResponse=").append(hasDefaultResponse);
|
||||
sb.append(", hasOnlyDefaultResponse=").append(hasOnlyDefaultResponse);
|
||||
sb.append(", hasErrorResponseObject=").append(hasErrorResponseObject);
|
||||
sb.append(", hasSingleParam=").append(hasSingleParam);
|
||||
sb.append(", isRestfulIndex=").append(isRestfulIndex);
|
||||
@@ -440,7 +432,6 @@ public class CodegenOperation {
|
||||
isResponseOptional == that.isResponseOptional &&
|
||||
hasReference == that.hasReference &&
|
||||
hasDefaultResponse == that.hasDefaultResponse &&
|
||||
hasOnlyDefaultResponse == that.hasOnlyDefaultResponse &&
|
||||
hasErrorResponseObject == that.hasErrorResponseObject &&
|
||||
hasSingleParam == that.hasSingleParam &&
|
||||
isRestfulIndex == that.isRestfulIndex &&
|
||||
@@ -505,7 +496,7 @@ public class CodegenOperation {
|
||||
return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams,
|
||||
hasRequiredParams, returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
|
||||
isArray, isMultipart, isVoid, isResponseBinary, isResponseFile, isResponseOptional, hasReference,
|
||||
hasDefaultResponse, hasOnlyDefaultResponse, isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
|
||||
hasDefaultResponse, isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
|
||||
isRestful, isDeprecated, isCallbackRequest, uniqueItems, path, operationId, returnType, httpMethod,
|
||||
returnBaseType, returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse,
|
||||
discriminator, consumes, produces, prioritizedContentTypes, servers, bodyParam, allParams, bodyParams,
|
||||
|
||||
@@ -71,10 +71,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
@@ -228,8 +224,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
@Getter @Setter
|
||||
protected int removeOperationIdPrefixCount = 1;
|
||||
protected boolean skipOperationExample;
|
||||
// sort operations by default
|
||||
protected boolean skipSortingOperations = false;
|
||||
|
||||
protected final static Pattern XML_MIME_PATTERN = Pattern.compile("(?i)application\\/(.*)[+]?xml(;.*)?");
|
||||
protected final static Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)application\\/json(;.*)?");
|
||||
@@ -1456,7 +1450,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the file name of the Api
|
||||
* Return the file name of the Api Test
|
||||
*
|
||||
* @param name the file name of the Api
|
||||
* @return the file name of the Api
|
||||
@@ -2428,7 +2422,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return schema.getFormat();
|
||||
}
|
||||
return "string";
|
||||
} else if (ModelUtils.isFreeFormObject(schema, openAPI)) {
|
||||
} else if (ModelUtils.isFreeFormObject(schema)) {
|
||||
// Note: the value of a free-form object cannot be an arbitrary type. Per OAS specification,
|
||||
// it must be a map of string to values.
|
||||
return "object";
|
||||
@@ -2653,11 +2647,11 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
m.xmlName = ((Schema) innerSchema).getXml().getName();
|
||||
}
|
||||
if (modelDiscriminators > 1) {
|
||||
LOGGER.debug("Allof composed schema is inheriting >1 discriminator. Only use one discriminator: {}", composed);
|
||||
LOGGER.error("Allof composed schema is inheriting >1 discriminator. Only use one discriminator: {}", composed);
|
||||
}
|
||||
|
||||
if (modelImplCnt++ > 1) {
|
||||
LOGGER.debug("More than one inline schema specified in allOf:. Only the first one is recognized. All others are ignored.");
|
||||
LOGGER.warn("More than one inline schema specified in allOf:. Only the first one is recognized. All others are ignored.");
|
||||
break; // only one schema with discriminator allowed in allOf
|
||||
}
|
||||
}
|
||||
@@ -2837,7 +2831,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (ModelUtils.isMapSchema(schema)) {
|
||||
// an object or anyType composed schema that has additionalProperties set
|
||||
addAdditionPropertiesToCodeGenModel(m, schema);
|
||||
} else if (ModelUtils.isFreeFormObject(schema, openAPI)) {
|
||||
} else if (ModelUtils.isFreeFormObject(schema)) {
|
||||
// non-composed object type with no properties + additionalProperties
|
||||
// additionalProperties must be null, ObjectSchema, or empty Schema
|
||||
addAdditionPropertiesToCodeGenModel(m, schema);
|
||||
@@ -3043,7 +3037,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
m.isNullable = Boolean.TRUE;
|
||||
}
|
||||
|
||||
m.setTypeProperties(schema, openAPI);
|
||||
m.setTypeProperties(schema);
|
||||
m.setFormat(schema.getFormat());
|
||||
m.setComposedSchemas(getComposedSchemas(schema));
|
||||
if (ModelUtils.isArraySchema(schema)) {
|
||||
@@ -3702,7 +3696,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
protected void updatePropertyForObject(CodegenProperty property, Schema p) {
|
||||
if (ModelUtils.isFreeFormObject(p, openAPI)) {
|
||||
if (ModelUtils.isFreeFormObject(p)) {
|
||||
// non-composed object type with no properties + additionalProperties
|
||||
// additionalProperties must be null, ObjectSchema, or empty Schema
|
||||
property.isFreeFormObject = true;
|
||||
@@ -3953,12 +3947,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
List<Object> _enum = p.getEnum();
|
||||
property._enum = new ArrayList<>();
|
||||
for (Object i : _enum) {
|
||||
// raw null values in enums are unions for nullable
|
||||
// atttributes, not actual enum values, so we remove them here
|
||||
if (i == null) {
|
||||
property.isNullable = true;
|
||||
continue;
|
||||
}
|
||||
property._enum.add(String.valueOf(i));
|
||||
}
|
||||
property.isEnum = true;
|
||||
@@ -4032,7 +4020,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
property.datatypeWithEnum = property.dataType;
|
||||
}
|
||||
|
||||
property.setTypeProperties(p, openAPI);
|
||||
property.setTypeProperties(p);
|
||||
property.setComposedSchemas(getComposedSchemas(p));
|
||||
if (ModelUtils.isIntegerSchema(p)) { // integer type
|
||||
updatePropertyForInteger(property, p);
|
||||
@@ -4078,7 +4066,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
!ModelUtils.isComposedSchema(p) &&
|
||||
p.getAdditionalProperties() == null && p.getNot() == null && p.getEnum() == null);
|
||||
|
||||
if (!ModelUtils.isArraySchema(p) && !ModelUtils.isMapSchema(p) && !ModelUtils.isFreeFormObject(p, openAPI) && !isAnyTypeWithNothingElseSet) {
|
||||
if (!ModelUtils.isArraySchema(p) && !ModelUtils.isMapSchema(p) && !ModelUtils.isFreeFormObject(p) && !isAnyTypeWithNothingElseSet) {
|
||||
/* schemas that are not Array, not ModelUtils.isMapSchema, not isFreeFormObject, not AnyType with nothing else set
|
||||
* so primitive schemas int, str, number, referenced schemas, AnyType schemas with properties, enums, or composition
|
||||
*/
|
||||
@@ -4875,7 +4863,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
r.setTypeProperties(responseSchema, openAPI);
|
||||
r.setTypeProperties(responseSchema);
|
||||
r.setComposedSchemas(getComposedSchemas(responseSchema));
|
||||
if (ModelUtils.isArraySchema(responseSchema)) {
|
||||
r.simpleType = false;
|
||||
@@ -4935,7 +4923,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
r.isDouble = Boolean.TRUE;
|
||||
}
|
||||
} else if (ModelUtils.isTypeObjectSchema(responseSchema)) {
|
||||
if (ModelUtils.isFreeFormObject(responseSchema, openAPI)) {
|
||||
if (ModelUtils.isFreeFormObject(responseSchema)) {
|
||||
r.isFreeFormObject = true;
|
||||
} else {
|
||||
r.isModel = true;
|
||||
@@ -5199,7 +5187,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
ModelUtils.syncValidationProperties(parameterSchema, codegenParameter);
|
||||
codegenParameter.setTypeProperties(parameterSchema, openAPI);
|
||||
codegenParameter.setTypeProperties(parameterSchema);
|
||||
codegenParameter.setComposedSchemas(getComposedSchemas(parameterSchema));
|
||||
|
||||
if (Boolean.TRUE.equals(parameterSchema.getNullable())) { // use nullable defined in the spec
|
||||
@@ -5249,7 +5237,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (ModelUtils.isMapSchema(parameterSchema)) { // for map parameter
|
||||
updateParameterForMap(codegenParameter, parameterSchema, imports);
|
||||
}
|
||||
if (ModelUtils.isFreeFormObject(parameterSchema, openAPI)) {
|
||||
if (ModelUtils.isFreeFormObject(parameterSchema)) {
|
||||
codegenParameter.isFreeFormObject = true;
|
||||
}
|
||||
addVarsRequiredVarsAdditionalProps(parameterSchema, codegenParameter);
|
||||
@@ -5678,8 +5666,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<String, Integer> seenOperationIds = new HashMap<String, Integer>();
|
||||
|
||||
/**
|
||||
* Add operation to group
|
||||
*
|
||||
@@ -5700,18 +5686,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
// check for operationId uniqueness
|
||||
String uniqueName = co.operationId;
|
||||
int counter = seenOperationIds.getOrDefault(uniqueName, 0);
|
||||
while(seenOperationIds.containsKey(uniqueName)) {
|
||||
uniqueName = co.operationId + "_" + counter;
|
||||
counter++;
|
||||
}
|
||||
int counter = 0;
|
||||
for (CodegenOperation op : opList) {
|
||||
if (uniqueName.equals(op.operationId)) {
|
||||
uniqueName = co.operationId + "_" + counter;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
seenOperationIds.put(co.operationId, counter);
|
||||
if (!co.operationId.equals(uniqueName)) {
|
||||
LOGGER.warn("generated unique operationId `{}`", uniqueName);
|
||||
}
|
||||
@@ -6087,68 +6068,30 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a value that is unique, suffixed with _index to make it unique
|
||||
* Ensures generated files are unique when compared case-insensitive
|
||||
* Not all operating systems support case-sensitive paths
|
||||
*/
|
||||
private String uniqueCaseInsensitiveString(String value, Map<String, String> seenValues) {
|
||||
if (seenValues.keySet().contains(value)) {
|
||||
return seenValues.get(value);
|
||||
}
|
||||
|
||||
Optional<Entry<String,String>> foundEntry = seenValues.entrySet().stream().filter(v -> v.getValue().toLowerCase(Locale.ROOT).equals(value.toLowerCase(Locale.ROOT))).findAny();
|
||||
if (foundEntry.isPresent()) {
|
||||
int counter = 0;
|
||||
String uniqueValue = value + "_" + counter;
|
||||
|
||||
while (seenValues.values().stream().map(v -> v.toLowerCase(Locale.ROOT)).collect(Collectors.toList()).contains(uniqueValue.toLowerCase(Locale.ROOT))) {
|
||||
counter++;
|
||||
uniqueValue = value + "_" + counter;
|
||||
}
|
||||
|
||||
seenValues.put(value, uniqueValue);
|
||||
return uniqueValue;
|
||||
}
|
||||
|
||||
seenValues.put(value, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
private final Map<String, String> seenApiFilenames = new HashMap<String, String>();
|
||||
|
||||
@Override
|
||||
public String apiFilename(String templateName, String tag) {
|
||||
String uniqueTag = uniqueCaseInsensitiveString(tag, seenApiFilenames);
|
||||
String suffix = apiTemplateFiles().get(templateName);
|
||||
return apiFileFolder() + File.separator + toApiFilename(uniqueTag) + suffix;
|
||||
return apiFileFolder() + File.separator + toApiFilename(tag) + suffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFilename(String templateName, String tag, String outputDir) {
|
||||
String uniqueTag = uniqueCaseInsensitiveString(tag, seenApiFilenames);
|
||||
String suffix = apiTemplateFiles().get(templateName);
|
||||
return outputDir + File.separator + toApiFilename(uniqueTag) + suffix;
|
||||
return outputDir + File.separator + toApiFilename(tag) + suffix;
|
||||
}
|
||||
|
||||
private final Map<String, String> seenModelFilenames = new HashMap<String, String>();
|
||||
|
||||
@Override
|
||||
public String modelFilename(String templateName, String modelName) {
|
||||
String uniqueModelName = uniqueCaseInsensitiveString(modelName, seenModelFilenames);
|
||||
String suffix = modelTemplateFiles().get(templateName);
|
||||
return modelFileFolder() + File.separator + toModelFilename(uniqueModelName) + suffix;
|
||||
return modelFileFolder() + File.separator + toModelFilename(modelName) + suffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelFilename(String templateName, String modelName, String outputDir) {
|
||||
String uniqueModelName = uniqueCaseInsensitiveString(modelName, seenModelFilenames);
|
||||
String suffix = modelTemplateFiles().get(templateName);
|
||||
return outputDir + File.separator + toModelFilename(uniqueModelName) + suffix;
|
||||
return outputDir + File.separator + toModelFilename(modelName) + suffix;
|
||||
}
|
||||
|
||||
private final Map<String, String> seenApiDocFilenames = new HashMap<String, String>();
|
||||
|
||||
/**
|
||||
* Return the full path and API documentation file
|
||||
*
|
||||
@@ -6158,14 +6101,11 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*/
|
||||
@Override
|
||||
public String apiDocFilename(String templateName, String tag) {
|
||||
String uniqueTag = uniqueCaseInsensitiveString(tag, seenApiDocFilenames);
|
||||
String docExtension = getDocExtension();
|
||||
String suffix = docExtension != null ? docExtension : apiDocTemplateFiles().get(templateName);
|
||||
return apiDocFileFolder() + File.separator + toApiDocFilename(uniqueTag) + suffix;
|
||||
return apiDocFileFolder() + File.separator + toApiDocFilename(tag) + suffix;
|
||||
}
|
||||
|
||||
private final Map<String, String> seenApiTestFilenames = new HashMap<String, String>();
|
||||
|
||||
/**
|
||||
* Return the full path and API test file
|
||||
*
|
||||
@@ -6175,9 +6115,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*/
|
||||
@Override
|
||||
public String apiTestFilename(String templateName, String tag) {
|
||||
String uniqueTag = uniqueCaseInsensitiveString(tag, seenApiTestFilenames);
|
||||
String suffix = apiTestTemplateFiles().get(templateName);
|
||||
return apiTestFileFolder() + File.separator + toApiTestFilename(uniqueTag) + suffix;
|
||||
return apiTestFileFolder() + File.separator + toApiTestFilename(tag) + suffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -6215,16 +6154,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
this.skipOperationExample = skipOperationExample;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSkipSortingOperations() {
|
||||
return this.skipSortingOperations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSkipSortingOperations(boolean skipSortingOperations) {
|
||||
this.skipSortingOperations = skipSortingOperations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHideGenerationTimestamp() {
|
||||
return hideGenerationTimestamp;
|
||||
@@ -6699,11 +6628,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
: 0;
|
||||
|
||||
for (Object value : values) {
|
||||
if (value == null) {
|
||||
// raw null values in enums are unions for nullable
|
||||
// attributes, not actual enum values, so we remove them here
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> enumVar = new HashMap<>();
|
||||
String enumName = truncateIdx == 0
|
||||
? String.valueOf(value)
|
||||
@@ -7179,7 +7103,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
Schema ps = unaliasSchema(propertySchema);
|
||||
ModelUtils.syncValidationProperties(ps, codegenParameter);
|
||||
codegenParameter.setTypeProperties(ps, openAPI);
|
||||
codegenParameter.setTypeProperties(ps);
|
||||
codegenParameter.setComposedSchemas(getComposedSchemas(ps));
|
||||
if (ps.getPattern() != null) {
|
||||
codegenParameter.pattern = toRegularExpression(ps.getPattern());
|
||||
@@ -7270,7 +7194,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
codegenParameter.isPrimitiveType = false;
|
||||
codegenParameter.items = codegenProperty.items;
|
||||
codegenParameter.mostInnerItems = codegenProperty.mostInnerItems;
|
||||
} else if (ModelUtils.isFreeFormObject(ps, openAPI)) {
|
||||
} else if (ModelUtils.isFreeFormObject(ps)) {
|
||||
codegenParameter.isFreeFormObject = true;
|
||||
}
|
||||
} else if (ModelUtils.isNullType(ps)) {
|
||||
@@ -7446,7 +7370,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
useModel = false;
|
||||
} else {
|
||||
if (ModelUtils.isFreeFormObject(schema, openAPI)) {
|
||||
if (ModelUtils.isFreeFormObject(schema)) {
|
||||
useModel = ModelUtils.shouldGenerateFreeFormObjectModel(name, this);
|
||||
} else if (ModelUtils.isMapSchema(schema)) {
|
||||
useModel = ModelUtils.shouldGenerateMapModel(schema);
|
||||
@@ -7525,7 +7449,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (ModelUtils.isMapSchema(schema)) {
|
||||
// Schema with additionalproperties: true (including composed schemas with additionalproperties: true)
|
||||
updateRequestBodyForMap(codegenParameter, schema, name, imports, bodyParameterName);
|
||||
} else if (ModelUtils.isFreeFormObject(schema, openAPI)) {
|
||||
} else if (ModelUtils.isFreeFormObject(schema)) {
|
||||
// non-composed object type with no properties + additionalProperties
|
||||
// additionalProperties must be null, ObjectSchema, or empty Schema
|
||||
codegenParameter.isFreeFormObject = true;
|
||||
@@ -7788,7 +7712,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
|
||||
|
||||
ModelUtils.syncValidationProperties(unaliasedSchema, codegenParameter);
|
||||
codegenParameter.setTypeProperties(unaliasedSchema, openAPI);
|
||||
codegenParameter.setTypeProperties(unaliasedSchema);
|
||||
codegenParameter.setComposedSchemas(getComposedSchemas(unaliasedSchema));
|
||||
// TODO in the future switch al the below schema usages to unaliasedSchema
|
||||
// because it keeps models as refs and will not get their referenced schemas
|
||||
@@ -8141,43 +8065,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
LOGGER.debug("Post processing file {} ({})", file, fileType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes an external command for file post processing.
|
||||
*
|
||||
* @param commandArr an array of commands and arguments. They will be concatenated with space and tokenized again.
|
||||
* @return Whether the execution passed (true) or failed (false)
|
||||
*/
|
||||
protected boolean executePostProcessor(String[] commandArr) {
|
||||
final String command = String.join(" ", commandArr);
|
||||
try {
|
||||
// we don't use the array variant here, because the command passed in by the user is often not only a single binary
|
||||
// but a combination of binary + parameters, e.g. `/etc/bin prettier -w`, which would then not be found, as the
|
||||
// first array item would be expected to be the binary only. The exec method is tokenizing the command for us.
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
int exitValue = p.exitValue();
|
||||
if (exitValue != 0) {
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(p.getErrorStream(), StandardCharsets.UTF_8);
|
||||
BufferedReader br = new BufferedReader(inputStreamReader)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}, Error output: {}", command, exitValue, sb);
|
||||
}
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
return true;
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Boolean value indicating the state of the option for post-processing file using environment variables.
|
||||
*
|
||||
|
||||
@@ -22,7 +22,6 @@ import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.PathItem;
|
||||
import io.swagger.v3.oas.models.Paths;
|
||||
import io.swagger.v3.oas.models.SpecVersion;
|
||||
import io.swagger.v3.oas.models.info.Contact;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.info.License;
|
||||
@@ -32,7 +31,7 @@ import io.swagger.v3.oas.models.security.*;
|
||||
import io.swagger.v3.oas.models.tags.Tag;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.io.IOCase;
|
||||
import org.apache.commons.io.comparator.PathFileComparator;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.api.TemplateDefinition;
|
||||
@@ -122,7 +121,6 @@ public class DefaultGenerator implements Generator {
|
||||
this.opts = opts;
|
||||
this.openAPI = opts.getOpenAPI();
|
||||
this.config = opts.getConfig();
|
||||
|
||||
List<TemplateDefinition> userFiles = opts.getUserDefinedTemplates();
|
||||
if (userFiles != null) {
|
||||
this.userDefinedTemplates = Collections.unmodifiableList(userFiles);
|
||||
@@ -344,12 +342,6 @@ public class DefaultGenerator implements Generator {
|
||||
config.additionalProperties().put("unescapedAppDescription", info.getDescription());
|
||||
}
|
||||
|
||||
if (this.openAPI.getSpecVersion().equals(SpecVersion.V31) && !StringUtils.isEmpty(info.getSummary())) {
|
||||
config.additionalProperties().put("appSummary", config.escapeText(info.getSummary()));
|
||||
config.additionalProperties().put("appSummaryWithNewLines", config.escapeTextWhileAllowingNewLines(info.getSummary()));
|
||||
config.additionalProperties().put("unescapedAppSummary", info.getSummary());
|
||||
}
|
||||
|
||||
if (info.getContact() != null) {
|
||||
Contact contact = info.getContact();
|
||||
if (contact.getEmail() != null) {
|
||||
@@ -499,7 +491,7 @@ public class DefaultGenerator implements Generator {
|
||||
if (schema.getExtensions() != null && Boolean.TRUE.equals(schema.getExtensions().get("x-internal"))) {
|
||||
LOGGER.info("Model {} not generated since x-internal is set to true", name);
|
||||
continue;
|
||||
} else if (ModelUtils.isFreeFormObject(schema, openAPI)) { // check to see if it's a free-form object
|
||||
} else if (ModelUtils.isFreeFormObject(schema)) { // check to see if it's a free-form object
|
||||
if (!ModelUtils.shouldGenerateFreeFormObjectModel(name, config)) {
|
||||
LOGGER.info("Model {} not generated since it's a free-form object", name);
|
||||
continue;
|
||||
@@ -688,10 +680,7 @@ public class DefaultGenerator implements Generator {
|
||||
for (String tag : paths.keySet()) {
|
||||
try {
|
||||
List<CodegenOperation> ops = paths.get(tag);
|
||||
if(!this.config.isSkipSortingOperations()) {
|
||||
// sort operations by operationId
|
||||
ops.sort((one, another) -> ObjectUtils.compare(one.operationId, another.operationId));
|
||||
}
|
||||
ops.sort((one, another) -> ObjectUtils.compare(one.operationId, another.operationId));
|
||||
OperationsMap operation = processOperations(config, tag, ops, allModels);
|
||||
URL url = URLPathUtils.getServerURL(openAPI, config.serverVariableOverrides());
|
||||
operation.put("basePath", basePath);
|
||||
@@ -1441,8 +1430,6 @@ public class DefaultGenerator implements Generator {
|
||||
return processTemplateToFile(templateData, templateName, outputFilename, shouldGenerate, skippedByOption, this.config.getOutputDir());
|
||||
}
|
||||
|
||||
private final Set<String> seenFiles = new HashSet<>();
|
||||
|
||||
private File processTemplateToFile(Map<String, Object> templateData, String templateName, String outputFilename, boolean shouldGenerate, String skippedByOption, String intendedOutputDir) throws IOException {
|
||||
String adjustedOutputFilename = outputFilename.replaceAll("//", "/").replace('/', File.separatorChar);
|
||||
File target = new File(adjustedOutputFilename);
|
||||
@@ -1453,11 +1440,6 @@ public class DefaultGenerator implements Generator {
|
||||
if (!absoluteTarget.startsWith(outDir)) {
|
||||
throw new RuntimeException(String.format(Locale.ROOT, "Target files must be generated within the output directory; absoluteTarget=%s outDir=%s", absoluteTarget, outDir));
|
||||
}
|
||||
|
||||
if (seenFiles.stream().filter(f -> f.toLowerCase(Locale.ROOT).equals(absoluteTarget.toString().toLowerCase(Locale.ROOT))).findAny().isPresent()) {
|
||||
LOGGER.warn("Duplicate file path detected. Not all operating systems can handle case sensitive file paths. path={}", absoluteTarget.toString());
|
||||
}
|
||||
seenFiles.add(absoluteTarget.toString());
|
||||
return this.templateProcessor.write(templateData, templateName, target);
|
||||
} else {
|
||||
this.templateProcessor.skip(target.toPath(), String.format(Locale.ROOT, "Skipped by %s options supplied by user.", skippedByOption));
|
||||
@@ -1995,8 +1977,7 @@ public class DefaultGenerator implements Generator {
|
||||
// NOTE: Don't use File.separator here as we write linux-style paths to FILES, and File.separator will
|
||||
// result in incorrect match on Windows machines.
|
||||
String relativeMeta = METADATA_DIR + "/VERSION";
|
||||
|
||||
final List<String> relativePaths = new ArrayList<>(filesToSort.size());
|
||||
filesToSort.sort(PathFileComparator.PATH_COMPARATOR);
|
||||
filesToSort.forEach(f -> {
|
||||
// some Java implementations don't honor .relativize documentation fully.
|
||||
// When outDir is /a/b and the input is /a/b/c/d, the result should be c/d.
|
||||
@@ -2009,15 +1990,10 @@ public class DefaultGenerator implements Generator {
|
||||
relativePath = relativePath.replace(File.separator, "/");
|
||||
}
|
||||
if (!relativePath.equals(relativeMeta)) {
|
||||
relativePaths.add(relativePath);
|
||||
sb.append(relativePath).append(System.lineSeparator());
|
||||
}
|
||||
});
|
||||
|
||||
Collections.sort(relativePaths, (a, b) -> IOCase.SENSITIVE.checkCompareTo(a,b));
|
||||
relativePaths.forEach(relativePath -> {
|
||||
sb.append(relativePath).append(System.lineSeparator());
|
||||
});
|
||||
|
||||
String targetFile = config.outputFolder() + File.separator + METADATA_DIR + File.separator + config.getFilesMetadataFilename();
|
||||
|
||||
File filesFile = this.templateProcessor.writeToFile(targetFile, sb.toString().getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.openapitools.codegen.meta.FeatureSet;
|
||||
import org.openapitools.codegen.meta.features.SchemaSupportFeature;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
|
||||
public interface IJsonSchemaValidationProperties {
|
||||
@@ -284,7 +283,7 @@ public interface IJsonSchemaValidationProperties {
|
||||
*
|
||||
* @param p the schema which contains the type info
|
||||
*/
|
||||
default void setTypeProperties(Schema p, OpenAPI openAPI) {
|
||||
default void setTypeProperties(Schema p) {
|
||||
if (ModelUtils.isModelWithPropertiesOnly(p)) {
|
||||
setIsModel(true);
|
||||
} else if (ModelUtils.isArraySchema(p)) {
|
||||
@@ -337,7 +336,7 @@ public interface IJsonSchemaValidationProperties {
|
||||
setIsNull(true);
|
||||
} else if (ModelUtils.isAnyType(p)) {
|
||||
setIsAnyType(true);
|
||||
} else if (ModelUtils.isFreeFormObject(p, openAPI)) {
|
||||
} else if (ModelUtils.isFreeFormObject(p)) {
|
||||
setIsFreeFormObject(true);
|
||||
// TODO: remove below later after updating generators to properly use isFreeFormObject
|
||||
setIsMap(true);
|
||||
|
||||
@@ -20,7 +20,6 @@ package org.openapitools.codegen;
|
||||
import io.swagger.v3.oas.models.*;
|
||||
import io.swagger.v3.oas.models.callbacks.Callback;
|
||||
import io.swagger.v3.oas.models.headers.Header;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
@@ -284,24 +283,10 @@ public class OpenAPINormalizer {
|
||||
this.openAPI.getComponents().setSchemas(new HashMap<String, Schema>());
|
||||
}
|
||||
|
||||
normalizeInfo();
|
||||
normalizePaths();
|
||||
normalizeComponentsSchemas();
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-populate info if it's not defined.
|
||||
*/
|
||||
private void normalizeInfo() {
|
||||
if (this.openAPI.getInfo() == null) {
|
||||
Info info = new Info();
|
||||
info.setTitle("OpenAPI");
|
||||
info.setVersion("0.0.1");
|
||||
info.setDescription("OpenAPI");
|
||||
this.openAPI.setInfo(info);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes inline models in Paths
|
||||
*/
|
||||
@@ -516,7 +501,7 @@ public class OpenAPINormalizer {
|
||||
return schema;
|
||||
}
|
||||
|
||||
if (visitedSchemas.contains(schema)) {
|
||||
if ((visitedSchemas.contains(schema))) {
|
||||
return schema; // skip due to circular reference
|
||||
} else {
|
||||
visitedSchemas.add(schema);
|
||||
@@ -535,6 +520,7 @@ public class OpenAPINormalizer {
|
||||
return normalizeAnyOf(schema, visitedSchemas);
|
||||
} else if (ModelUtils.isAllOfWithProperties(schema)) { // allOf with properties
|
||||
schema = normalizeAllOfWithProperties(schema, visitedSchemas);
|
||||
normalizeSchema(schema, visitedSchemas);
|
||||
} else if (ModelUtils.isAllOf(schema)) { // allOf
|
||||
return normalizeAllOf(schema, visitedSchemas);
|
||||
} else if (ModelUtils.isComposedSchema(schema)) { // composed schema
|
||||
@@ -642,38 +628,24 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
|
||||
private Schema normalizeOneOf(Schema schema, Set<Schema> visitedSchemas) {
|
||||
// simplify first as the schema may no longer be a oneOf after processing the rule below
|
||||
schema = processSimplifyOneOf(schema);
|
||||
|
||||
// if it's still a oneOf, loop through the sub-schemas
|
||||
if (schema.getOneOf() != null) {
|
||||
for (int i = 0; i < schema.getOneOf().size(); i++) {
|
||||
// normalize oneOf sub schemas one by one
|
||||
Object item = schema.getOneOf().get(i);
|
||||
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
if (!(item instanceof Schema)) {
|
||||
throw new RuntimeException("Error! oneOf schema is not of the type Schema: " + item);
|
||||
}
|
||||
|
||||
// update sub-schema with the updated schema
|
||||
schema.getOneOf().set(i, normalizeSchema((Schema) item, visitedSchemas));
|
||||
for (Object item : schema.getOneOf()) {
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// normalize it as it's no longer an oneOf
|
||||
schema = normalizeSchema(schema, visitedSchemas);
|
||||
if (!(item instanceof Schema)) {
|
||||
throw new RuntimeException("Error! oneOf schema is not of the type Schema: " + item);
|
||||
}
|
||||
// normalize oenOf sub schemas one by one
|
||||
normalizeSchema((Schema) item, visitedSchemas);
|
||||
}
|
||||
// process rules here
|
||||
schema = processSimplifyOneOf(schema);
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
private Schema normalizeAnyOf(Schema schema, Set<Schema> visitedSchemas) {
|
||||
for (int i = 0; i < schema.getAnyOf().size(); i++) {
|
||||
// normalize anyOf sub schemas one by one
|
||||
Object item = schema.getAnyOf().get(i);
|
||||
|
||||
for (Object item : schema.getAnyOf()) {
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -681,16 +653,15 @@ public class OpenAPINormalizer {
|
||||
if (!(item instanceof Schema)) {
|
||||
throw new RuntimeException("Error! anyOf schema is not of the type Schema: " + item);
|
||||
}
|
||||
|
||||
// update sub-schema with the updated schema
|
||||
schema.getAnyOf().set(i, normalizeSchema((Schema) item, visitedSchemas));
|
||||
// normalize anyOf sub schemas one by one
|
||||
normalizeSchema((Schema) item, visitedSchemas);
|
||||
}
|
||||
|
||||
// process rules here
|
||||
schema = processSimplifyAnyOf(schema);
|
||||
|
||||
// last rule to process as the schema may become String schema (not "anyOf") after the completion
|
||||
return normalizeSchema(processSimplifyAnyOfStringAndEnumString(schema), visitedSchemas);
|
||||
return processSimplifyAnyOfStringAndEnumString(schema);
|
||||
}
|
||||
|
||||
private Schema normalizeComplexComposedSchema(Schema schema, Set<Schema> visitedSchemas) {
|
||||
@@ -701,7 +672,7 @@ public class OpenAPINormalizer {
|
||||
|
||||
processRemoveAnyOfOneOfAndKeepPropertiesOnly(schema);
|
||||
|
||||
return normalizeSchema(schema, visitedSchemas);
|
||||
return schema;
|
||||
}
|
||||
|
||||
// ===================== a list of rules =====================
|
||||
@@ -900,40 +871,21 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the schema is of type 'null' or schema itself is pointing to null
|
||||
* Check if the schema is of type 'null'
|
||||
* <p>
|
||||
* Return true if the schema's type is 'null' or not specified
|
||||
*
|
||||
* @param schema Schema
|
||||
* @param openAPI OpenAPI
|
||||
*
|
||||
* @return true if schema is null type
|
||||
*/
|
||||
public boolean isNullTypeSchema(OpenAPI openAPI, Schema schema) {
|
||||
public boolean isNullTypeSchema(Schema schema) {
|
||||
if (schema == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// dereference the schema
|
||||
schema = ModelUtils.getReferencedSchema(openAPI, schema);
|
||||
|
||||
// allOf/anyOf/oneOf
|
||||
if (ModelUtils.hasAllOf(schema) || ModelUtils.hasOneOf(schema) || ModelUtils.hasAnyOf(schema)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// schema with properties
|
||||
if (schema.getProperties() != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// convert referenced enum of null only to `nullable:true`
|
||||
if (schema.getEnum() != null && schema.getEnum().size() == 1) {
|
||||
if ("null".equals(String.valueOf(schema.getEnum().get(0)))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (schema.getTypes() != null && !schema.getTypes().isEmpty()) {
|
||||
// 3.1 spec
|
||||
if (schema.getTypes().size() == 1) { // 1 type only
|
||||
@@ -959,6 +911,14 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
}
|
||||
|
||||
// convert referenced enum of null only to `nullable:true`
|
||||
Schema referencedSchema = ModelUtils.getReferencedSchema(openAPI, schema);
|
||||
if (referencedSchema.getEnum() != null && referencedSchema.getEnum().size() == 1) {
|
||||
if ("null".equals(String.valueOf(referencedSchema.getEnum().get(0)))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1004,7 +964,7 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
}
|
||||
|
||||
if (oneOfSchemas.removeIf(oneOf -> isNullTypeSchema(openAPI, oneOf))) {
|
||||
if (oneOfSchemas.removeIf(oneOf -> isNullTypeSchema(oneOf))) {
|
||||
schema.setNullable(true);
|
||||
|
||||
// if only one element left, simplify to just the element (schema)
|
||||
@@ -1015,11 +975,6 @@ public class OpenAPINormalizer {
|
||||
return (Schema) oneOfSchemas.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (ModelUtils.isIntegerSchema(schema) || ModelUtils.isNumberSchema(schema) || ModelUtils.isStringSchema(schema)) {
|
||||
// TODO convert oneOf const to enum
|
||||
schema.setOneOf(null);
|
||||
}
|
||||
}
|
||||
|
||||
return schema;
|
||||
@@ -1140,7 +1095,7 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
}
|
||||
|
||||
if (anyOfSchemas.removeIf(anyOf -> isNullTypeSchema(openAPI, anyOf))) {
|
||||
if (anyOfSchemas.removeIf(anyOf -> isNullTypeSchema(anyOf))) {
|
||||
schema.setNullable(true);
|
||||
}
|
||||
|
||||
@@ -1281,12 +1236,6 @@ public class OpenAPINormalizer {
|
||||
schema.getTypes().remove("null");
|
||||
}
|
||||
|
||||
// process const
|
||||
if (schema.getConst() != null) {
|
||||
schema.setEnum(Arrays.asList(schema.getConst()));
|
||||
schema.setConst(null);
|
||||
}
|
||||
|
||||
// only one item (type) left
|
||||
if (schema.getTypes().size() == 1) {
|
||||
String type = String.valueOf(schema.getTypes().iterator().next());
|
||||
@@ -1304,7 +1253,6 @@ public class OpenAPINormalizer {
|
||||
as.setMaxItems(schema.getMaxItems());
|
||||
as.setExtensions(schema.getExtensions());
|
||||
as.setXml(schema.getXml());
|
||||
as.setNullable(schema.getNullable());
|
||||
as.setUniqueItems(schema.getUniqueItems());
|
||||
if (schema.getItems() != null) {
|
||||
// `items` is also a json schema
|
||||
@@ -1316,9 +1264,6 @@ public class OpenAPINormalizer {
|
||||
Schema updatedItems = normalizeSchema(schema.getItems(), visitedSchemas);
|
||||
as.setItems(updatedItems);
|
||||
}
|
||||
} else {
|
||||
// when items is not defined, default to any type
|
||||
as.setItems(new Schema());
|
||||
}
|
||||
|
||||
return as;
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
@@ -1064,8 +1065,20 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
if (StringUtils.isEmpty(commandPrefix)) {
|
||||
commandPrefix = "gnatpp";
|
||||
}
|
||||
String[] commandArr = new String[]{commandPrefix, "--no-compact", "--quiet", file.toString()};
|
||||
this.executePostProcessor(commandArr);
|
||||
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(new String[]{commandPrefix, "--no-compact", "--quiet", file.toString()});
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({} {}). Exit code: {}", commandPrefix, file, exitValue);
|
||||
} else {
|
||||
LOGGER.debug("Successfully executed: {} {}", commandPrefix, file);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({} {}). Exception: {}", commandPrefix, file, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -242,8 +242,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
if (StringUtils.isEmpty(System.getenv("CSHARP_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Environment variable CSHARP_POST_PROCESS_FILE not defined so the C# code may not be properly formatted by uncrustify (0.66 or later) or other code formatter. To define it, try `export CSHARP_POST_PROCESS_FILE=\"/usr/local/bin/uncrustify --no-backup\" && export UNCRUSTIFY_CONFIG=/path/to/uncrustify-rules.cfg` (Linux/Mac). Note: replace /path/to with the location of uncrustify-rules.cfg");
|
||||
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'CSHARP_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
|
||||
// License info
|
||||
@@ -452,8 +450,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
.put("uniqueLines", new UniqueLambda("\n", false))
|
||||
.put("unique", new UniqueLambda("\n", true))
|
||||
.put("camel_case", new CamelCaseLambda())
|
||||
.put("escape_reserved_word", new EscapeKeywordLambda(this::escapeKeyword))
|
||||
.put("alphabet_or_underscore", new ReplaceAllLambda("[^A-Za-z]", "_"));
|
||||
.put("escape_reserved_word", new EscapeKeywordLambda(this::escapeKeyword));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1881,7 +1878,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -1893,7 +1889,20 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
|
||||
// only process files with .cs extension
|
||||
if ("cs".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {csharpPostProcessFile, file.toString()});
|
||||
String command = csharpPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -314,8 +315,6 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
if (StringUtils.isEmpty(System.getenv("CPP_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Environment variable CPP_POST_PROCESS_FILE not defined so the C++ code may not be properly formatted. To define it, try 'export CPP_POST_PROCESS_FILE=\"/usr/local/bin/clang-format -i\"' (Linux/Mac)");
|
||||
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'CPP_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(RESERVED_WORD_PREFIX_OPTION)) {
|
||||
@@ -338,7 +337,6 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -348,7 +346,21 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
}
|
||||
// only process files with cpp extension
|
||||
if ("cpp".equals(FilenameUtils.getExtension(file.toString())) || "h".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {cppPostProcessFile, file.toString()});
|
||||
String command = cppPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
int exitValue = p.exitValue();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
@@ -228,8 +229,6 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
if (StringUtils.isEmpty(System.getenv("DART_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Environment variable DART_POST_PROCESS_FILE not defined so the Dart code may not be properly formatted. To define it, try `export DART_POST_PROCESS_FILE=\"/usr/local/bin/dartfmt -w\"` (Linux/Mac)");
|
||||
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'DART_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(PUB_NAME)) {
|
||||
@@ -806,7 +805,20 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
// process all files with dart extension
|
||||
if ("dart".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
// currently supported is "dartfmt -w" and "dart format"
|
||||
this.executePostProcessor(new String[] {dartPostProcessFile, file.toString()});
|
||||
String command = dartPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
@@ -1038,7 +1039,6 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -1050,7 +1050,20 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// only process files with .fs extension
|
||||
if ("fs".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {fsharpPostProcessFile, file.toString()});
|
||||
String command = fsharpPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
@@ -172,8 +173,6 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
if (StringUtils.isEmpty(System.getenv("GO_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Environment variable GO_POST_PROCESS_FILE not defined so Go code may not be properly formatted. To define it, try `export GO_POST_PROCESS_FILE=\"/usr/local/bin/gofmt -w\"` (Linux/Mac)");
|
||||
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'GO_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -983,7 +982,6 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -1009,7 +1007,20 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
if ("go".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
// e.g. "gofmt -w yourcode.go"
|
||||
// e.g. "go fmt path/to/your/package"
|
||||
this.executePostProcessor(new String[] {goPostProcessFile, file.toString()});
|
||||
String command = goPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
@@ -408,8 +409,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
if (StringUtils.isEmpty(System.getenv("JAVA_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE=\"/usr/local/bin/clang-format -i\"' (Linux/Mac)");
|
||||
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'JAVA_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
|
||||
convertPropertyToBooleanAndWriteBack(BeanValidationFeatures.USE_BEANVALIDATION, this::setUseBeanValidation);
|
||||
@@ -2227,7 +2226,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -2239,7 +2237,21 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
|
||||
// only process files with java extension
|
||||
if ("java".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {javaPostProcessFile, file.toString()});
|
||||
String command = javaPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
int exitValue = p.exitValue();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -431,8 +432,6 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
if (StringUtils.isEmpty(System.getenv("KOTLIN_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Environment variable KOTLIN_POST_PROCESS_FILE not defined so the Kotlin code may not be properly formatted. To define it, try 'export KOTLIN_POST_PROCESS_FILE=\"/usr/local/bin/ktlint -F\"' (Linux/Mac)");
|
||||
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'KOTLIN_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(MODEL_MUTABLE)) {
|
||||
@@ -965,7 +964,6 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -977,7 +975,21 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// only process files with kt extension
|
||||
if ("kt".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {kotlinPostProcessFile, file.toString()});
|
||||
String command = kotlinPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
int exitValue = p.exitValue();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1105,7 +1117,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
addAdditionPropertiesToCodeGenModel(m, schema);
|
||||
} else {
|
||||
m.setIsMap(false);
|
||||
if (ModelUtils.isFreeFormObject(schema, openAPI)) {
|
||||
if (ModelUtils.isFreeFormObject(schema)) {
|
||||
// non-composed object type with no properties + additionalProperties
|
||||
// additionalProperties must be null, ObjectSchema, or empty Schema
|
||||
addAdditionPropertiesToCodeGenModel(m, schema);
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.StringSchema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
@@ -33,6 +32,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -168,8 +168,6 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
if (StringUtils.isEmpty(System.getenv("PHP_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Environment variable PHP_POST_PROCESS_FILE not defined so the PHP code may not be properly formatted. To define it, try 'export PHP_POST_PROCESS_FILE=\"/usr/local/bin/prettier --write\"' (Linux/Mac)");
|
||||
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'PHP_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(PACKAGE_NAME)) {
|
||||
@@ -386,11 +384,6 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
return super.getTypeDeclaration(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getParameterDataType(Parameter parameter, Schema schema) {
|
||||
return getTypeDeclaration(schema);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSchemaType(Schema p) {
|
||||
String openAPIType = super.getSchemaType(p);
|
||||
@@ -691,28 +684,6 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
p.example = example;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateEnumVarsWithExtensions(List<Map<String, Object>> enumVars, Map<String, Object> vendorExtensions, String dataType) {
|
||||
if (vendorExtensions != null) {
|
||||
if (vendorExtensions.containsKey("x-enum-varnames")) {
|
||||
List<String> values = (List<String>) vendorExtensions.get("x-enum-varnames");
|
||||
int size = Math.min(enumVars.size(), values.size());
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
enumVars.get(i).put("name", toEnumVarName(values.get(i), dataType));
|
||||
}
|
||||
}
|
||||
|
||||
if (vendorExtensions.containsKey("x-enum-descriptions")) {
|
||||
List<String> values = (List<String>) vendorExtensions.get("x-enum-descriptions");
|
||||
int size = Math.min(enumVars.size(), values.size());
|
||||
for (int i = 0; i < size; i++) {
|
||||
enumVars.get(i).put("enumDescription", values.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("int".equals(datatype) || "float".equals(datatype)) {
|
||||
@@ -733,11 +704,11 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
return enumNameMapping.get(name);
|
||||
}
|
||||
|
||||
if (name.isEmpty()) {
|
||||
if (name.length() == 0) {
|
||||
return "EMPTY";
|
||||
}
|
||||
|
||||
if (name.trim().isEmpty()) {
|
||||
if (name.trim().length() == 0) {
|
||||
return "SPACE_" + name.length();
|
||||
}
|
||||
|
||||
@@ -748,12 +719,11 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
// number
|
||||
if ("int".equals(datatype) || "float".equals(datatype)) {
|
||||
if (name.matches("\\d.*")) { // starts with number
|
||||
name = "NUMBER_" + name;
|
||||
}
|
||||
name = name.replaceAll("-", "MINUS_");
|
||||
name = name.replaceAll("\\+", "PLUS_");
|
||||
name = name.replaceAll("\\.", "_DOT_");
|
||||
String varName = name;
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
varName = varName.replaceAll("\\+", "PLUS_");
|
||||
varName = varName.replaceAll("\\.", "_DOT_");
|
||||
return varName;
|
||||
}
|
||||
|
||||
// string
|
||||
@@ -857,7 +827,6 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -867,7 +836,21 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
}
|
||||
// only process files with php extension
|
||||
if ("php".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {phpPostProcessFile, file.toString()});
|
||||
String command = phpPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
int exitValue = p.exitValue();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import static org.openapitools.codegen.utils.StringUtils.escape;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -177,8 +178,6 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
||||
if (StringUtils.isEmpty(System.getenv("PYTHON_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE=\"/usr/local/bin/yapf -i\"' (Linux/Mac)");
|
||||
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'PYTHON_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,7 +351,6 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -363,7 +361,20 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// only process files with py extension
|
||||
if ("py".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {pythonPostProcessFile, file.toString()});
|
||||
String command = pythonPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -141,8 +142,6 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
|
||||
if (StringUtils.isEmpty(System.getenv("PYTHON_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE=\"/usr/local/bin/yapf -i\"' (Linux/Mac)");
|
||||
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'PYTHON_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +296,6 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -308,7 +306,20 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
|
||||
|
||||
// only process files with py extension
|
||||
if ("py".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {pythonPostProcessFile, file.toString()});
|
||||
String command = pythonPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,11 @@ import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Arrays;
|
||||
@@ -100,8 +104,6 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
|
||||
|
||||
if (StringUtils.isEmpty(System.getenv("RUBY_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Hint: Environment variable 'RUBY_POST_PROCESS_FILE' (optional) not defined. E.g. to format the source code, please try 'export RUBY_POST_PROCESS_FILE=\"/usr/local/bin/rubocop -a\"' (Linux/Mac)");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'RUBY_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +253,6 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -261,7 +262,28 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
// only process files with rb extension
|
||||
if ("rb".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {rubyPostProcessFile, file.toString()});
|
||||
String command = rubyPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(p.getErrorStream(), StandardCharsets.UTF_8);
|
||||
BufferedReader br = new BufferedReader(inputStreamReader)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}, Error output: {}", command, exitValue, sb);
|
||||
}
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: `{}`", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -193,8 +193,6 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
if (StringUtils.isEmpty(System.getenv("SCALA_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Environment variable SCALA_POST_PROCESS_FILE not defined so the Scala code may not be properly formatted. To define it, try 'export SCALA_POST_PROCESS_FILE=/usr/local/bin/scalafmt' (Linux/Mac)");
|
||||
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'SCALA_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
|
||||
this.appName = Optional.ofNullable(openAPI).map(o -> o.getInfo()).filter(i -> i != null).map(i -> i.getTitle()).filter(t -> t != null).orElse(this.appName);
|
||||
@@ -549,7 +547,6 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -561,7 +558,20 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
|
||||
// only process files with scala extension
|
||||
if ("scala".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {scalaPostProcessFile, file.toString()});
|
||||
String command = scalaPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1092,7 +1092,20 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
}
|
||||
// only process files with ts extension
|
||||
if ("ts".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {tsPostProcessFile, file.toString()});
|
||||
String command = tsPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
@@ -27,45 +25,15 @@ import org.openapitools.codegen.model.ModelsMap;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class AvroSchemaCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AvroSchemaCodegen.class);
|
||||
private static final String AVRO = "avro-schema";
|
||||
|
||||
/**
|
||||
* See https://avro.apache.org/docs/++version++/specification/#logical-types
|
||||
*/
|
||||
public static final String USE_LOGICAL_TYPES = "useLogicalTypes";
|
||||
public static final String USE_LOGICAL_TYPES_DESC = "Use logical types for fields, when matching OpenAPI types. Currently supported: `date-time`, `date`.";
|
||||
/**
|
||||
* See https://avro.apache.org/docs/++version++/specification/#timestamps
|
||||
*/
|
||||
public static final String LOGICAL_TYPES_TIME_QUANTIFIER = "logicalTypeTimeQuantifier";
|
||||
public static final String LOGICAL_TYPES_TIME_QUANTIFIER_DESC = "The quantifier for time-related logical types (`timestamp` and `local-timestamp`).";
|
||||
|
||||
protected String packageName = "model";
|
||||
|
||||
@Getter @Setter
|
||||
protected boolean useLogicalTypes = false; // this defaults to false for backwards compatibility
|
||||
|
||||
@Getter @Setter
|
||||
protected String logicalTypeTimeQuantifier = "millis";
|
||||
|
||||
public AvroSchemaCodegen() {
|
||||
super();
|
||||
|
||||
@@ -120,28 +88,11 @@ public class AvroSchemaCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("BigDecimal", "string");
|
||||
|
||||
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, CodegenConstants.PACKAGE_NAME_DESC));
|
||||
cliOptions.add(CliOption.newBoolean(USE_LOGICAL_TYPES, USE_LOGICAL_TYPES_DESC).defaultValue(Boolean.FALSE.toString()));
|
||||
|
||||
CliOption logicalTimeQuantifier = new CliOption(LOGICAL_TYPES_TIME_QUANTIFIER, LOGICAL_TYPES_TIME_QUANTIFIER_DESC).defaultValue(this.getLogicalTypeTimeQuantifier());
|
||||
Map<String, String> timeQuantifierOptions = new HashMap<>();
|
||||
timeQuantifierOptions.put("nanos", "nanoseconds");
|
||||
timeQuantifierOptions.put("micros", "microseconds");
|
||||
timeQuantifierOptions.put("millis", "milliseconds");
|
||||
logicalTimeQuantifier.setEnum(timeQuantifierOptions);
|
||||
cliOptions.add(logicalTimeQuantifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
if (StringUtils.isEmpty(System.getenv("AVRO_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Environment variable AVRO_POST_PROCESS_FILE not defined so the Avro schemas may not be properly formatted. To define it, try `export AVRO_POST_PROCESS_FILE=\"/usr/local/bin/prettier -w\"` (Linux/Mac)");
|
||||
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'AVRO_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {
|
||||
packageName = (String) additionalProperties.get(CodegenConstants.PACKAGE_NAME);
|
||||
|
||||
@@ -150,16 +101,6 @@ public class AvroSchemaCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
additionalProperties.put("packageName", packageName);
|
||||
|
||||
if (!convertPropertyToBooleanAndWriteBack(USE_LOGICAL_TYPES, this::setUseLogicalTypes)) {
|
||||
// This sets the default if the option was not specified.
|
||||
additionalProperties.put(USE_LOGICAL_TYPES, useLogicalTypes);
|
||||
}
|
||||
|
||||
if (convertPropertyToStringAndWriteBack(LOGICAL_TYPES_TIME_QUANTIFIER, this::setLogicalTypeTimeQuantifier) == null) {
|
||||
// This sets the default if the option was not specified.
|
||||
additionalProperties.put(LOGICAL_TYPES_TIME_QUANTIFIER, logicalTypeTimeQuantifier);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,22 +128,6 @@ public class AvroSchemaCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return postProcessModelsEnum(objs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
String avroPostProcessFile = System.getenv("AVRO_POST_PROCESS_FILE");
|
||||
if (StringUtils.isEmpty(avroPostProcessFile)) {
|
||||
return; // skip if AVRO_POST_PROCESS_FILE env variable is not defined
|
||||
}
|
||||
// only process files with avsc extension
|
||||
if ("avsc".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {avroPostProcessFile, file.toString()});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setNonArrayMapProperty(CodegenProperty property, String type) {
|
||||
super.setNonArrayMapProperty(property, type);
|
||||
@@ -223,47 +148,4 @@ public class AvroSchemaCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Map<String, Object>> buildEnumVars(List<Object> values, String dataType) {
|
||||
List<Object> sanitizedValues = values.stream()
|
||||
.filter(x -> x != null)
|
||||
.map(Object::toString)
|
||||
.map(this::sanitizeEnumValue)
|
||||
.collect(Collectors.toList());
|
||||
removeEnumValueCollisions(sanitizedValues);
|
||||
return super.buildEnumVars(sanitizedValues, dataType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Valid enums in Avro need to adhere to [A-Za-z_][A-Za-z0-9_]*
|
||||
* See https://avro.apache.org/docs/1.12.0/specification/#enums
|
||||
*/
|
||||
private String sanitizeEnumValue(String value) {
|
||||
// Replace any non-alphanumeric characters with an underscore
|
||||
String sanitizedValue = value.replaceAll("[^A-Za-z0-9_]", "_");
|
||||
// If the enum starts with a number, prefix it with an underscore
|
||||
sanitizedValue = sanitizedValue.replaceAll("^([0-9])", "_$1");
|
||||
return sanitizedValue;
|
||||
}
|
||||
|
||||
private void removeEnumValueCollisions(List<Object> values) {
|
||||
Collections.reverse(values);
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
final String value = values.get(i).toString();
|
||||
long count = values.stream().filter(v1 -> v1.equals(value)).count();
|
||||
if (count > 1) {
|
||||
String uniqueEnumValue = getUniqueEnumValue(value.toString(), values);
|
||||
LOGGER.debug("Changing duplicate enumeration value from " + value + " to " + uniqueEnumValue);
|
||||
values.set(i, uniqueEnumValue);
|
||||
}
|
||||
}
|
||||
Collections.reverse(values);
|
||||
}
|
||||
|
||||
private String getUniqueEnumValue(String value, List<Object> values) {
|
||||
long count = values.stream().filter(v -> v.equals(value)).count();
|
||||
return count > 1
|
||||
? getUniqueEnumValue(value + count, values)
|
||||
: value;
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
@@ -319,8 +320,6 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
|
||||
|
||||
if (StringUtils.isEmpty(System.getenv("C_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Environment variable C_POST_PROCESS_FILE not defined so the C code may not be properly formatted by uncrustify (0.66 or later) or other code formatter. To define it, try `export C_POST_PROCESS_FILE=\"/usr/local/bin/uncrustify --no-backup\" && export UNCRUSTIFY_CONFIG=/path/to/uncrustify-rules.cfg` (Linux/Mac). Note: replace /path/to with the location of uncrustify-rules.cfg");
|
||||
} else if (!this.isEnablePostProcessFile()) {
|
||||
LOGGER.info("Warning: Environment variable 'C_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(USE_JSON_UNFORMATTED)) {
|
||||
@@ -899,7 +898,6 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
super.postProcessFile(file, fileType);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
@@ -924,7 +922,20 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
|
||||
// only process files with .c or .h extension
|
||||
if ("c".equals(FilenameUtils.getExtension(file.toString())) ||
|
||||
"h".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
this.executePostProcessor(new String[] {cPostProcessFile, file.toString()});
|
||||
String command = cPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
protected Set<String> getNullableTypes() {
|
||||
return GENERICHOST.equals(getLibrary())
|
||||
? super.getNullableTypes()
|
||||
: new HashSet<>(Arrays.asList("decimal", "bool", "int", "uint", "long", "ulong", "float", "double", "DateTime", "DateOnly", "DateTimeOffset", "Guid"));
|
||||
: new HashSet<>(Arrays.asList("decimal", "bool", "int", "uint", "long", "ulong", "float", "double", "DateTime", "DateTimeOffset", "Guid"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1702,7 +1702,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
addAdditionPropertiesToCodeGenModel(m, schema);
|
||||
} else {
|
||||
m.setIsMap(false);
|
||||
if (ModelUtils.isFreeFormObject(schema, openAPI)) {
|
||||
if (ModelUtils.isFreeFormObject(schema)) {
|
||||
// non-composed object type with no properties + additionalProperties
|
||||
// additionalProperties must be null, ObjectSchema, or empty Schema
|
||||
addAdditionPropertiesToCodeGenModel(m, schema);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user