forked from loafle/openapi-generator-original
Compare commits
111 Commits
devhl-labs
...
nested-one
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
225d590b53 | ||
|
|
a4b5b85067 | ||
|
|
07f1d2d51c | ||
|
|
099f138dd5 | ||
|
|
b5d4fa9d27 | ||
|
|
1f2d6b8848 | ||
|
|
92b96635bd | ||
|
|
3aa7ec6a39 | ||
|
|
f4e53db8cf | ||
|
|
5c9999b7cf | ||
|
|
8b2de37414 | ||
|
|
d400d7fb15 | ||
|
|
b527f3b816 | ||
|
|
cab9872d6d | ||
|
|
18ef6ff96a | ||
|
|
94733b8bdf | ||
|
|
e09196261a | ||
|
|
c9958e12b8 | ||
|
|
b215f67b2e | ||
|
|
9290c1a75e | ||
|
|
94d6faffe3 | ||
|
|
c50a775e0c | ||
|
|
93df0ff444 | ||
|
|
1bd3ce7ce2 | ||
|
|
0891b6056f | ||
|
|
cb20e742ea | ||
|
|
c5d67ee042 | ||
|
|
e9f55c0dd9 | ||
|
|
7968349991 | ||
|
|
612dc4dbcb | ||
|
|
09ff22230d | ||
|
|
2101ea6cf7 | ||
|
|
958609931b | ||
|
|
3746a2069f | ||
|
|
cea5022b5d | ||
|
|
2bc963f00c | ||
|
|
0816008f1e | ||
|
|
9be92fabd1 | ||
|
|
6095d2df75 | ||
|
|
0e0cddacac | ||
|
|
ae0ed022d5 | ||
|
|
11d9d4346e | ||
|
|
12e76ec14f | ||
|
|
62f52ad520 | ||
|
|
d7e75ebe5d | ||
|
|
71c2abf81c | ||
|
|
8b0b4b5d04 | ||
|
|
1814a04c20 | ||
|
|
b6e51b7a77 | ||
|
|
7c57024e69 | ||
|
|
d7edbad8d6 | ||
|
|
85a7d69b5f | ||
|
|
f455ac166c | ||
|
|
e00d8d564a | ||
|
|
110460b71a | ||
|
|
72c02e4bc1 | ||
|
|
d7a2e4a293 | ||
|
|
b6abace9dc | ||
|
|
9a0aee90bd | ||
|
|
e702506e4d | ||
|
|
68b944e6e6 | ||
|
|
1b60ee1799 | ||
|
|
4664f6c46c | ||
|
|
687bace3f3 | ||
|
|
011982ab9c | ||
|
|
98333492cf | ||
|
|
4c8e230e50 | ||
|
|
7ca0b92944 | ||
|
|
e13a4e143b | ||
|
|
0f1919ee53 | ||
|
|
26eb1dc805 | ||
|
|
515abf8c68 | ||
|
|
927bfa481f | ||
|
|
031115356d | ||
|
|
bbc42696ab | ||
|
|
cda3517891 | ||
|
|
d90bdcbec7 | ||
|
|
ca19fa0ef3 | ||
|
|
31c3a40b4c | ||
|
|
a3c0de935f | ||
|
|
c2bad96ce1 | ||
|
|
d8f777d707 | ||
|
|
6b0644115b | ||
|
|
14669d226b | ||
|
|
4f1708c3fb | ||
|
|
6b80410bf3 | ||
|
|
55e2eb1d6a | ||
|
|
68b41eeeea | ||
|
|
6072646899 | ||
|
|
626cd8c0cd | ||
|
|
a94ad37738 | ||
|
|
f6be077efb | ||
|
|
27af3a063b | ||
|
|
31a89e35cb | ||
|
|
8f2676c5c2 | ||
|
|
6541038e13 | ||
|
|
6ddc8b3f38 | ||
|
|
32499a19fc | ||
|
|
8d9816e193 | ||
|
|
e8c739e771 | ||
|
|
a28772b08f | ||
|
|
cffe2d0259 | ||
|
|
eca9ec775b | ||
|
|
fa1cbb9322 | ||
|
|
37e8cfadc7 | ||
|
|
fd45b74128 | ||
|
|
b3527348f3 | ||
|
|
4bc16ea6bb | ||
|
|
28493dfa95 | ||
|
|
8540c82d30 | ||
|
|
b538c2adf8 |
5
.github/PULL_REQUEST_TEMPLATE.md
vendored
5
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -16,5 +16,10 @@
|
||||
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*`.
|
||||
For Windows users, please run the script in [Git BASH](https://gitforwindows.org/).
|
||||
- [ ] In case you are adding a new generator, run the following additional script :
|
||||
```
|
||||
./bin/utils/ensure-up-to-date.sh
|
||||
```
|
||||
Commit all changed files.
|
||||
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master` (6.3.0) (minor release - breaking changes with fallbacks), `7.0.x` (breaking changes without fallbacks)
|
||||
- [ ] 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.
|
||||
|
||||
34
.github/workflows/samples-cpp-qt-client.yaml
vendored
Normal file
34
.github/workflows/samples-cpp-qt-client.yaml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Samples cpp qt client
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'samples/client/petstore/cpp-qt/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'samples/client/petstore/cpp-qt/**'
|
||||
|
||||
env:
|
||||
GRADLE_VERSION: 6.9
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build cpp qt client
|
||||
strategy:
|
||||
matrix:
|
||||
qt-version:
|
||||
- '5.15.2'
|
||||
- '6.4.2'
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macOS-latest
|
||||
- windows-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
version: ${{ matrix.qt-version }}
|
||||
- name: Build
|
||||
working-directory: "samples/client/petstore/cpp-qt"
|
||||
run: ./build-and-test.bash
|
||||
2
.github/workflows/samples-dart.yaml
vendored
2
.github/workflows/samples-dart.yaml
vendored
@@ -40,7 +40,7 @@ jobs:
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('samples/**/pubspec.yaml') }}
|
||||
- uses: dart-lang/setup-dart@v1
|
||||
with:
|
||||
sdk: 2.14.0
|
||||
sdk: 2.15.0
|
||||
- name: Run tests
|
||||
uses: ./.github/actions/run-samples
|
||||
with:
|
||||
|
||||
35
.github/workflows/samples-erlang.yaml
vendored
Normal file
35
.github/workflows/samples-erlang.yaml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Samples Erlang
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
# 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/petstore/erlang-server/**
|
||||
- samples/client/petstore/erlang-client/**
|
||||
- samples/client/petstore/erlang-proper/**
|
||||
jobs:
|
||||
build:
|
||||
name: Build Erlang projects
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
#- samples/server/petstore/erlang-server/
|
||||
- samples/client/petstore/erlang-client/
|
||||
- samples/client/petstore/erlang-proper/
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: erlef/setup-beam@v1
|
||||
with:
|
||||
otp-version: '22.2'
|
||||
rebar3-version: '3.14.3'
|
||||
- run: rebar3 compile
|
||||
working-directory: ${{ matrix.sample }}
|
||||
8
.github/workflows/samples-jdk17.yaml
vendored
8
.github/workflows/samples-jdk17.yaml
vendored
@@ -6,6 +6,8 @@ on:
|
||||
- samples/openapi3/client/petstore/spring-cloud-3/**
|
||||
- samples/client/petstore/java-helidon-client/mp/**
|
||||
- samples/client/petstore/java-helidon-client/se/**
|
||||
- samples/client/petstore/spring-http-interface-reactive/**
|
||||
- samples/client/petstore/spring-http-interface/**
|
||||
# servers
|
||||
- samples/openapi3/server/petstore/springboot-3/**
|
||||
- samples/server/petstore/java-helidon-server/mp/**
|
||||
@@ -16,6 +18,8 @@ on:
|
||||
- samples/openapi3/client/petstore/spring-cloud-3/**
|
||||
- samples/client/petstore/java-helidon-client/mp/**
|
||||
- samples/client/petstore/java-helidon-client/se/**
|
||||
- samples/client/petstore/spring-http-interface-reactive/**
|
||||
- samples/client/petstore/spring-http-interface/**
|
||||
# servers
|
||||
- samples/openapi3/server/petstore/springboot-3/**
|
||||
- samples/server/petstore/java-helidon-server/mp/**
|
||||
@@ -32,10 +36,14 @@ jobs:
|
||||
- samples/openapi3/client/petstore/spring-cloud-3
|
||||
- samples/client/petstore/java-helidon-client/mp
|
||||
- samples/client/petstore/java-helidon-client/se
|
||||
- samples/client/petstore/spring-http-interface-reactive
|
||||
- samples/client/petstore/spring-http-interface
|
||||
# servers
|
||||
- samples/openapi3/server/petstore/springboot-3
|
||||
- samples/server/petstore/java-helidon-server/mp
|
||||
- samples/server/petstore/java-helidon-server/se
|
||||
- samples/client/petstore/spring-http-interface-reactive
|
||||
- samples/client/petstore/spring-http-interface
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-java@v3
|
||||
|
||||
46
.github/workflows/samples-kotlin-server-jdk17.yaml
vendored
Normal file
46
.github/workflows/samples-kotlin-server-jdk17.yaml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
name: Samples Kotlin server
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'samples/server/petstore/kotlin-springboot-3*/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'samples/server/petstore/kotlin-springboot-3*/**'
|
||||
|
||||
env:
|
||||
GRADLE_VERSION: 7.4
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Kotlin server
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
# server
|
||||
- samples/server/petstore/kotlin-springboot-3
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-repository
|
||||
with:
|
||||
path: |
|
||||
~/.gradle
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Install Gradle wrapper
|
||||
uses: eskatos/gradle-command-action@v2
|
||||
with:
|
||||
gradle-version: ${{ env.GRADLE_VERSION }}
|
||||
build-root-directory: ${{ matrix.sample }}
|
||||
arguments: wrapper
|
||||
- name: Build
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: ./gradlew build -x test
|
||||
38
.github/workflows/samples-python-nextgen-client-echo-api.yaml
vendored
Normal file
38
.github/workflows/samples-python-nextgen-client-echo-api.yaml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Python Client (Echo API)
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- samples/client/echo_api/python-nextgen/**
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/client/echo_api/python-nextgen/**
|
||||
jobs:
|
||||
build:
|
||||
name: Test Python client
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
# clients
|
||||
- samples/client/echo_api/python-nextgen
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.7'
|
||||
- name: Setup node.js
|
||||
uses: actions/setup-node@v3
|
||||
- name: Run echo server
|
||||
run: |
|
||||
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
|
||||
(cd http-echo-server && npm install && npm start &)
|
||||
- name: Install
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: |
|
||||
pip install -r requirements.txt
|
||||
pip install -r test-requirements.txt
|
||||
- name: Test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: python -m pytest
|
||||
18
.travis.yml
18
.travis.yml
@@ -215,15 +215,15 @@ after_success:
|
||||
echo "Pushed to $DOCKER_CODEGEN_CLI_IMAGE_NAME";
|
||||
fi;
|
||||
fi;
|
||||
## publish latest website, variables below are secure environment variables which are unavailable to PRs from forks.
|
||||
- if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
cd website;
|
||||
git config --global user.name "${GH_NAME}";
|
||||
git config --global user.email "${GH_EMAIL}";
|
||||
echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc;
|
||||
yarn install;
|
||||
GIT_USER="${GH_NAME}" yarn run publish-gh-pages;
|
||||
fi;
|
||||
# publish latest website, variables below are secure environment variables which are unavailable to PRs from forks.
|
||||
#- if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
# cd website;
|
||||
# git config --global user.name "${GH_NAME}";
|
||||
# git config --global user.email "${GH_EMAIL}";
|
||||
# echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc;
|
||||
# yarn install;
|
||||
# GIT_USER="${GH_NAME}" yarn run publish-gh-pages;
|
||||
# fi;
|
||||
|
||||
env:
|
||||
- DOCKER_GENERATOR_IMAGE_NAME=openapitools/openapi-generator-online DOCKER_CODEGEN_CLI_IMAGE_NAME=openapitools/openapi-generator-cli NODE_ENV=test CC=gcc-5 CXX=g++-5
|
||||
|
||||
@@ -35,11 +35,11 @@ elif [ "$NODE_INDEX" = "2" ]; then
|
||||
#sudo apt-get -y build-dep libcurl4-gnutls-dev
|
||||
#sudo apt-get -y install libcurl4-gnutls-dev
|
||||
|
||||
# Install golang version 1.14
|
||||
# Install golang version 1.18
|
||||
go version
|
||||
sudo mkdir /usr/local/go1.14
|
||||
wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14
|
||||
export PATH="/usr/local/go1.14/go/bin:$PATH"
|
||||
sudo mkdir /usr/local/go1.18
|
||||
wget -c https://dl.google.com/go/go1.18.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.18
|
||||
export PATH="/usr/local/go1.18/go/bin:$PATH"
|
||||
go version
|
||||
|
||||
# run integration tests
|
||||
|
||||
@@ -60,6 +60,7 @@ Code change should conform to the programming style guide of the respective lang
|
||||
- Haskell: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
|
||||
- Java: https://google.github.io/styleguide/javaguide.html
|
||||
- JavaScript: https://github.com/airbnb/javascript/
|
||||
- Julia: https://docs.julialang.org/en/v1/manual/style-guide/
|
||||
- Kotlin: https://kotlinlang.org/docs/reference/coding-conventions.html
|
||||
- ObjC: https://github.com/NYTimes/objective-c-style-guide
|
||||
- Perl: http://perldoc.perl.org/perlstyle.html
|
||||
|
||||
124
README.md
124
README.md
@@ -15,12 +15,11 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`6.3.0`):
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`6.4.0`):
|
||||
[](https://travis-ci.com/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
[](https://github.com/OpenAPITools/openapi-generator/actions?query=workflow%3A%22Check+Supported+Java+Versions%22)
|
||||
|
||||
[7.0.x](https://github.com/OpenAPITools/openapi-generator/tree/7.0.x) (`7.0.x`):
|
||||
[](https://travis-ci.com/OpenAPITools/openapi-generator)
|
||||
@@ -77,13 +76,13 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
|
||||
## Overview
|
||||
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification) (both 2.0 and 3.0 are supported). Currently, the following languages/frameworks are supported:
|
||||
|
||||
| | 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, Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client, Helidon), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 13.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) |
|
||||
| **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/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](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/), Scalatra) |
|
||||
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
|
||||
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
|
||||
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer**, **WSDL** |
|
||||
| | 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, Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 13.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) |
|
||||
| **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, Vertx), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](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/), Scalatra) |
|
||||
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
|
||||
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
|
||||
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer**, **WSDL** |
|
||||
|
||||
## Table of contents
|
||||
|
||||
@@ -122,8 +121,8 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
| OpenAPI Generator Version | Release Date | Notes |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
|
||||
| 7.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.0.0-SNAPSHOT/) | Feb/Mar 2023 | Major release with breaking changes (no fallback) |
|
||||
| 6.3.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/6.3.0-SNAPSHOT/) | 05.12.2022 | Minor release with breaking changes (with fallback) |
|
||||
| [6.2.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.2.1) (latest stable release) | 01.11.2022 | Patch release (enhancements, bug fixes, etc) |
|
||||
| 6.4.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/6.4.0-SNAPSHOT/) | 05.12.2022 | Minor release with breaking changes (with fallback) |
|
||||
| [6.3.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.3.0) (latest stable release) | 01.02.2023 | Minor release with breaking changes (with fallback) |
|
||||
| [5.4.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.4.0) | 31.01.2022 | Minor release with breaking changes (with fallback) |
|
||||
| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) |
|
||||
|
||||
@@ -131,6 +130,8 @@ OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
|
||||
|
||||
For old releases, please refer to the [**Release**](https://github.com/OpenAPITools/openapi-generator/releases) page.
|
||||
|
||||
For decomissioned generators/libraries/frameworks, please refer to [the "Decommission" label](https://github.com/OpenAPITools/openapi-generator/issues?q=label%3ADecommission+is%3Amerged+) in the pull request page.
|
||||
|
||||
## [1.2 - Artifacts on Maven Central](#table-of-contents)
|
||||
|
||||
You can find our released artifacts on maven central:
|
||||
@@ -181,16 +182,16 @@ See the different versions of the [openapi-generator-cli](https://search.maven.o
|
||||
<!-- RELEASE_VERSION -->
|
||||
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
|
||||
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.1/openapi-generator-cli-6.2.1.jar`
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
```sh
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.1/openapi-generator-cli-6.2.1.jar -O openapi-generator-cli.jar
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar -O openapi-generator-cli.jar
|
||||
```
|
||||
|
||||
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
|
||||
```
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.1/openapi-generator-cli-6.2.1.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar
|
||||
```
|
||||
|
||||
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
|
||||
@@ -415,7 +416,7 @@ openapi-generator-cli version
|
||||
To use a specific version of "openapi-generator-cli"
|
||||
|
||||
```sh
|
||||
openapi-generator-cli version-manager set 6.2.1
|
||||
openapi-generator-cli version-manager set 6.3.0
|
||||
```
|
||||
|
||||
Or install it as dev-dependency:
|
||||
@@ -439,7 +440,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
|
||||
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g php -o c:\temp\php_api_client`)
|
||||
|
||||
<!-- RELEASE_VERSION -->
|
||||
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.1/openapi-generator-cli-6.2.1.jar)
|
||||
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar)
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`
|
||||
@@ -885,6 +886,8 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- 2022-10-26 - [Quarkus Insights #106: Quarkiverse Extension Spotlight: OpenApi Generator](https://www.youtube.com/watch?v=_s_if69t2iQ) by [Quarkusio](https://www.youtube.com/c/Quarkusio)
|
||||
- 2022-11-28 - [The REST API implementation flow](https://tmsvr.com/openapi-code-generation-for-rest-apis/) by [Imre Tömösvári](https://tmsvr.com/author/imre/)
|
||||
- 2022-12-13 - [API-First with Spring WebFlux and OpenAPI Generator](https://boottechnologies-ci.medium.com/api-first-with-spring-webflux-and-openapi-generator-38b7804c4ed4) by [Eric Anicet](https://boottechnologies-ci.medium.com/)
|
||||
- 2023-01-06 - [Major Improvements with Helidon and OpenAPI](https://medium.com/helidon/major-improvements-with-helidon-and-openapi-f76a0951508e) by [Tim Quinn](https://medium.com/@tquinno600)
|
||||
- 2023-02-02 - [Replacing Postman with the Jetbrains HTTP Client](https://lengrand.fr/replacing-postman-in-seconds-with-the-jetbrains-http-client/) by [julien Lengrand-Lambert](https://github.com/jlengrand)
|
||||
|
||||
## [6 - About Us](#table-of-contents)
|
||||
|
||||
@@ -954,13 +957,15 @@ Here is a list of template creators:
|
||||
* Java (Google APIs Client Library): @charlescapps
|
||||
* Java (Rest-assured): @viclovsky
|
||||
* Java (Java 11 Native HTTP client): @bbdouglas
|
||||
* Java (Apache HttpClient): @harrywhite4
|
||||
* Java (Apache HttpClient 5.x): @harrywhite4 @andrevegas
|
||||
* Java (Helidon): @spericas @tjquinno @tvallin
|
||||
* Javascript/NodeJS: @jfiala
|
||||
* JavaScript (Apollo DataSource): @erithmetic
|
||||
* JavaScript (Closure-annotated Angular) @achew22
|
||||
* JavaScript (Flow types) @jaypea
|
||||
* Jetbrains HTTP Client : @jlengrand
|
||||
* JMeter: @davidkiss
|
||||
* Julia: @tanmaykm
|
||||
* Kotlin: @jimschubert [:heart:](https://www.patreon.com/jimschubert)
|
||||
* Kotlin (MultiPlatform): @andrewemery
|
||||
* Kotlin (Volley): @alisters
|
||||
@@ -1028,6 +1033,7 @@ Here is a list of template creators:
|
||||
* JAX-RS CXF: @hiveship
|
||||
* JAX-RS CXF (CDI): @nickcmaynard
|
||||
* JAX-RS RestEasy (JBoss EAP): @jfiala
|
||||
* Julia: @tanmaykm
|
||||
* Kotlin: @jimschubert [:heart:](https://www.patreon.com/jimschubert)
|
||||
* Kotlin (Spring Boot): @dr4ke616
|
||||
* Kotlin (Vertx): @Wooyme
|
||||
@@ -1095,47 +1101,49 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
|
||||
#### Members of Technical Committee
|
||||
|
||||
| Languages/Generators | Member (join date) |
|
||||
| :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| ActionScript | |
|
||||
| Ada | @stcarrez (2018/02) @michelealbano (2018/02) |
|
||||
| Android | @jaz-ah (2017/09) |
|
||||
| Apex | |
|
||||
| Bash | @frol (2017/07) @bkryza (2017/08) @kenjones-cisco (2017/09) |
|
||||
| C | @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) |
|
||||
| C++ | @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @martindelille (2018/03) @muttleyxd (2019/08) |
|
||||
| C# | @mandrean (2017/08) @frankyjuang (2019/09) @shibayan (2020/02) @Blackclaws (2021/03) @lucamazzanti (2021/05) |
|
||||
| Clojure | |
|
||||
| Crystal | @cyangle (2021/01) |
|
||||
| Dart | @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08) |
|
||||
| Eiffel | @jvelilla (2017/09) |
|
||||
| Elixir | @mrmstn (2018/12) |
|
||||
| Elm | @eriktim (2018/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) |
|
||||
| GraphQL | @renepardon (2018/12) |
|
||||
| Groovy | |
|
||||
| Haskell | |
|
||||
| Java | @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) |
|
||||
| Java Spring | @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) |
|
||||
| JMeter | @kannkyo (2021/01) |
|
||||
| Kotlin | @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) |
|
||||
| Lua | @daurnimator (2017/08) |
|
||||
| Nim | |
|
||||
| NodeJS/Javascript | @CodeNinjai (2017/07) @frol (2017/07) @cliffano (2017/07) |
|
||||
| ObjC | |
|
||||
| OCaml | @cgensoul (2019/08) |
|
||||
| Perl | @wing328 (2017/07) [:heart:](https://www.patreon.com/wing328) @yue9944882 (2019/06) |
|
||||
| PHP | @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), [@ybelenko](https://github.com/ybelenko) (2018/07), @renepardon (2018/12) |
|
||||
| PowerShell | @wing328 (2020/05) |
|
||||
| Python | @spacether (2019/11) [:heart:][spacether sponsorship] |
|
||||
| R | @Ramanth (2019/07) @saigiridhar21 (2019/07) |
|
||||
| Ruby | @cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) |
|
||||
| Rust | @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) @jacob-pro (2022/10) |
|
||||
| Scala | @clasnake (2017/07), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04) |
|
||||
| Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @4brunu (2019/11) |
|
||||
| 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) |
|
||||
| Languages/Generators | Member (join date) |
|
||||
|:----------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| ActionScript | |
|
||||
| Ada | @stcarrez (2018/02) @michelealbano (2018/02) |
|
||||
| Android | @jaz-ah (2017/09) |
|
||||
| Apex | |
|
||||
| Bash | @frol (2017/07) @bkryza (2017/08) @kenjones-cisco (2017/09) |
|
||||
| C | @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) |
|
||||
| C++ | @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @martindelille (2018/03) @muttleyxd (2019/08) |
|
||||
| C# | @mandrean (2017/08) @frankyjuang (2019/09) @shibayan (2020/02) @Blackclaws (2021/03) @lucamazzanti (2021/05) |
|
||||
| Clojure | |
|
||||
| Crystal | @cyangle (2021/01) |
|
||||
| Dart | @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08) |
|
||||
| Eiffel | @jvelilla (2017/09) |
|
||||
| Elixir | @mrmstn (2018/12) |
|
||||
| Elm | @eriktim (2018/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) |
|
||||
| GraphQL | @renepardon (2018/12) |
|
||||
| Groovy | |
|
||||
| Haskell | |
|
||||
| Java | @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) |
|
||||
| Java Spring | @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) |
|
||||
| JMeter | @kannkyo (2021/01) |
|
||||
| Jetbrains HTTP Client | @jlengrand (2023/01) |
|
||||
| Julia | @tanmaykm (2023/01) |
|
||||
| Kotlin | @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) |
|
||||
| Lua | @daurnimator (2017/08) |
|
||||
| Nim | |
|
||||
| NodeJS/Javascript | @CodeNinjai (2017/07) @frol (2017/07) @cliffano (2017/07) |
|
||||
| ObjC | |
|
||||
| OCaml | @cgensoul (2019/08) |
|
||||
| Perl | @wing328 (2017/07) [:heart:](https://www.patreon.com/wing328) @yue9944882 (2019/06) |
|
||||
| PHP | @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), [@ybelenko](https://github.com/ybelenko) (2018/07), @renepardon (2018/12) |
|
||||
| PowerShell | @wing328 (2020/05) |
|
||||
| Python | @spacether (2019/11) [:heart:][spacether sponsorship] @krjakbrjak (2023/02) |
|
||||
| R | @Ramanth (2019/07) @saigiridhar21 (2019/07) |
|
||||
| Ruby | @cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) |
|
||||
| Rust | @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) @jacob-pro (2022/10) |
|
||||
| Scala | @clasnake (2017/07), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04) |
|
||||
| Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @4brunu (2019/11) |
|
||||
| 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) |
|
||||
|
||||
|
||||
Past Members of Technical Committee:
|
||||
|
||||
@@ -3,5 +3,6 @@ outputDir: samples/client/petstore/cpp-qt
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/cpp-qt/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/cpp-qt-client
|
||||
additionalProperties:
|
||||
packageName: CppQtPetstoreClient
|
||||
cppNamespace: test_namespace
|
||||
modelNamePrefix: PFX
|
||||
|
||||
@@ -15,3 +15,4 @@ additionalProperties:
|
||||
camelUseDefaultValidationErrorProcessor: true
|
||||
camelRestClientRequestValidation: true
|
||||
camelSecurityDefinitions: true
|
||||
implicitHeaders: true
|
||||
|
||||
@@ -7,3 +7,4 @@ additionalProperties:
|
||||
artifactId: petstore-resttemplate
|
||||
hideGenerationTimestamp: "true"
|
||||
java8: true
|
||||
containerDefaultToNull: true
|
||||
|
||||
@@ -6,3 +6,4 @@ templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: petstore-webclient
|
||||
hideGenerationTimestamp: "true"
|
||||
containerDefaultToNull: "true"
|
||||
|
||||
11
bin/configs/jaxrs-spec-jakarta.yaml
Normal file
11
bin/configs/jaxrs-spec-jakarta.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
generatorName: jaxrs-spec
|
||||
outputDir: samples/server/petstore/jaxrs-spec-jakarta
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/spec
|
||||
additionalProperties:
|
||||
artifactId: jaxrs-spec-petstore-server-jakarta
|
||||
serializableModel: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
implicitHeadersRegex: (api_key|enum_header_string)
|
||||
generateBuilders: "true"
|
||||
useJakartaEe: "true"
|
||||
6
bin/configs/jetbrains-http-client-petstore-new.yaml
Normal file
6
bin/configs/jetbrains-http-client-petstore-new.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
generatorName: jetbrains-http-client
|
||||
outputDir: samples/client/petstore/jetbrains/http/client
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/jetbrains-http-client
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
7
bin/configs/julia-client-petstore-new.yaml
Normal file
7
bin/configs/julia-client-petstore-new.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
generatorName: julia-client
|
||||
outputDir: samples/client/petstore/julia
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/julia-client
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
packageName: PetStoreClient
|
||||
7
bin/configs/julia-server-petstore-new.yaml
Normal file
7
bin/configs/julia-server-petstore-new.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
generatorName: julia-server
|
||||
outputDir: samples/server/petstore/julia
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/julia-server
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
packageName: PetStoreServer
|
||||
13
bin/configs/kotlin-spring-boot-3.yaml
Normal file
13
bin/configs/kotlin-spring-boot-3.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
generatorName: kotlin-spring
|
||||
outputDir: samples/server/petstore/kotlin-springboot-3
|
||||
library: spring-boot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
|
||||
additionalProperties:
|
||||
documentationProvider: none
|
||||
annotationLibrary: none
|
||||
useSwaggerUI: "false"
|
||||
serviceImplementation: "true"
|
||||
serializableModel: "true"
|
||||
beanValidations: "true"
|
||||
useSpringBoot3: "true"
|
||||
@@ -5,3 +5,4 @@ templateDir: modules/openapi-generator/src/main/resources/python-nextgen
|
||||
library: asyncio
|
||||
additionalProperties:
|
||||
packageName: petstore_api
|
||||
floatStrictType: false
|
||||
|
||||
7
bin/configs/python-nextgen-echo-api.yaml
Normal file
7
bin/configs/python-nextgen-echo-api.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
generatorName: python-nextgen
|
||||
outputDir: samples/client/echo_api/python-nextgen
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/python-nextgen
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
allowStringInDateTimeParameters: true
|
||||
11
bin/configs/spring-http-interface-reactive.yaml
Normal file
11
bin/configs/spring-http-interface-reactive.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
generatorName: spring
|
||||
library: spring-http-interface
|
||||
outputDir: samples/client/petstore/spring-http-interface-reactive
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
artifactId: spring-http-interface-reactive
|
||||
snapshotVersion: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
reactive: "true"
|
||||
|
||||
10
bin/configs/spring-http-interface.yaml
Normal file
10
bin/configs/spring-http-interface.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
generatorName: spring
|
||||
library: spring-http-interface
|
||||
outputDir: samples/client/petstore/spring-http-interface
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
artifactId: spring-http-interface
|
||||
snapshotVersion: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
modelNameSuffix: 'Dto'
|
||||
@@ -64,6 +64,7 @@ Code change should conform to the programming style guide of the respective lang
|
||||
- Haskell: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
|
||||
- Java: https://google.github.io/styleguide/javaguide.html
|
||||
- JavaScript: https://github.com/airbnb/javascript/
|
||||
- Julia: https://docs.julialang.org/en/v1/manual/style-guide/
|
||||
- Kotlin: https://kotlinlang.org/docs/reference/coding-conventions.html
|
||||
- ObjC: https://github.com/NYTimes/objective-c-style-guide
|
||||
- Perl: http://perldoc.perl.org/perlstyle.html
|
||||
|
||||
@@ -477,3 +477,31 @@ Example:
|
||||
```
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/simplifyAnyOfStringAndEnumString_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING=true
|
||||
```
|
||||
|
||||
- `SIMPLIFY_BOOLEAN_ENUM`: when set to `true`, convert boolean enum to just enum.
|
||||
|
||||
Example:
|
||||
```
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/simplifyBooleanEnum_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer SIMPLIFY_BOOLEAN_ENUM=true
|
||||
```
|
||||
|
||||
- `SIMPLIFY_ONEOF_ANYOF`: when set to `true`, simplify oneOf/anyOf by 1) removing null (sub-schema) and setting nullable to true instead, and 2) simplifying oneOf/anyOf with a single sub-schema to just the sub-schema itself.
|
||||
|
||||
Example:
|
||||
```
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/simplifyOneOfAnyOf_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer SIMPLIFY_ONEOF_ANYOF=true
|
||||
```
|
||||
|
||||
- `KEEP_ONLY_FIRST_TAG_IN_OPERATION`: when set to `true`, only keep the first tag in operation if there are more than one tag defined.
|
||||
|
||||
Example:
|
||||
```
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer KEEP_ONLY_FIRST_TAG_IN_OPERATION=true
|
||||
```
|
||||
|
||||
- `SET_TAGS_FOR_ALL_OPERATIONS`: when set to a string value, tags in all operatinos will reset to the string value provided.
|
||||
|
||||
Example:
|
||||
```
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=true
|
||||
```
|
||||
|
||||
@@ -39,7 +39,9 @@ The following generators are available:
|
||||
* [javascript-closure-angular](generators/javascript-closure-angular.md)
|
||||
* [javascript-flowtyped](generators/javascript-flowtyped.md)
|
||||
* [jaxrs-cxf-client](generators/jaxrs-cxf-client.md)
|
||||
* [jetbrains-http-client (experimental)](generators/jetbrains-http-client.md)
|
||||
* [jmeter](generators/jmeter.md)
|
||||
* [julia-client (beta)](generators/julia-client.md)
|
||||
* [k6 (beta)](generators/k6.md)
|
||||
* [kotlin](generators/kotlin.md)
|
||||
* [lua (beta)](generators/lua.md)
|
||||
@@ -110,6 +112,7 @@ The following generators are available:
|
||||
* [jaxrs-resteasy](generators/jaxrs-resteasy.md)
|
||||
* [jaxrs-resteasy-eap](generators/jaxrs-resteasy-eap.md)
|
||||
* [jaxrs-spec](generators/jaxrs-spec.md)
|
||||
* [julia-server (beta)](generators/julia-server.md)
|
||||
* [kotlin-server](generators/kotlin-server.md)
|
||||
* [kotlin-spring](generators/kotlin-spring.md)
|
||||
* [kotlin-vertx (beta)](generators/kotlin-vertx.md)
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|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|
|
||||
|modelNamePrefix|Prefix that will be prepended to all model names.| |OAI|
|
||||
|optionalProjectFile|Generate client.pri.| |true|
|
||||
|packageName|C++ package (library) name.| |QtOpenAPIClient|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|
||||
@@ -11,7 +11,7 @@ title: Documentation for the dart-dio Generator
|
||||
| generator type | CLIENT | |
|
||||
| generator language | Dart | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates a Dart Dio client library with null-safety. | |
|
||||
| helpTxt | Generates a Dart Dio 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.
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
---
|
||||
title: Config Options for go-experimental
|
||||
sidebar_label: go-experimental
|
||||
---
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.</dd></dl>|true|
|
||||
|enumClassPrefix|Prefix enum with class name| |false|
|
||||
|generateInterfaces|Generate interfaces for api classes| |false|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|isGoSubmodule|whether the generated Go module is a submodule| |false|
|
||||
|packageName|Go package name (convention: lowercase).| |openapi|
|
||||
|packageVersion|Go package version.| |1.0.0|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|structPrefix|whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts| |false|
|
||||
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |false|
|
||||
|skipReadonlyPropertiesInInt|Skip default values to the readOnly properties in the model init function./ /false/
|
||||
|withAWSV4Signature|whether to include AWS v4 signature support| |false|
|
||||
|withGoCodegenComment|whether to include Go codegen comment to disable Go Lint and collapse by default in GitHub PRs and diffs| |false|
|
||||
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>bool</li>
|
||||
<li>byte</li>
|
||||
<li>complex128</li>
|
||||
<li>complex64</li>
|
||||
<li>float32</li>
|
||||
<li>float64</li>
|
||||
<li>int</li>
|
||||
<li>int32</li>
|
||||
<li>int64</li>
|
||||
<li>interface{}</li>
|
||||
<li>map[string]interface{}</li>
|
||||
<li>rune</li>
|
||||
<li>string</li>
|
||||
<li>uint</li>
|
||||
<li>uint32</li>
|
||||
<li>uint64</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>bool</li>
|
||||
<li>break</li>
|
||||
<li>byte</li>
|
||||
<li>case</li>
|
||||
<li>chan</li>
|
||||
<li>complex128</li>
|
||||
<li>complex64</li>
|
||||
<li>const</li>
|
||||
<li>continue</li>
|
||||
<li>default</li>
|
||||
<li>defer</li>
|
||||
<li>else</li>
|
||||
<li>error</li>
|
||||
<li>fallthrough</li>
|
||||
<li>float32</li>
|
||||
<li>float64</li>
|
||||
<li>for</li>
|
||||
<li>func</li>
|
||||
<li>go</li>
|
||||
<li>goto</li>
|
||||
<li>if</li>
|
||||
<li>import</li>
|
||||
<li>int</li>
|
||||
<li>int16</li>
|
||||
<li>int32</li>
|
||||
<li>int64</li>
|
||||
<li>int8</li>
|
||||
<li>interface</li>
|
||||
<li>map</li>
|
||||
<li>nil</li>
|
||||
<li>package</li>
|
||||
<li>range</li>
|
||||
<li>return</li>
|
||||
<li>rune</li>
|
||||
<li>select</li>
|
||||
<li>string</li>
|
||||
<li>struct</li>
|
||||
<li>switch</li>
|
||||
<li>type</li>
|
||||
<li>uint</li>
|
||||
<li>uint16</li>
|
||||
<li>uint32</li>
|
||||
<li>uint64</li>
|
||||
<li>uint8</li>
|
||||
<li>uintptr</li>
|
||||
<li>var</li>
|
||||
</ul>
|
||||
|
||||
## FEATURE SET
|
||||
|
||||
|
||||
### Client Modification Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasePath|✓|ToolingExtension
|
||||
|Authorizations|✗|ToolingExtension
|
||||
|UserAgent|✓|ToolingExtension
|
||||
|MockServer|✗|ToolingExtension
|
||||
|
||||
### Data Type Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Custom|✗|OAS2,OAS3
|
||||
|Int32|✓|OAS2,OAS3
|
||||
|Int64|✓|OAS2,OAS3
|
||||
|Float|✓|OAS2,OAS3
|
||||
|Double|✓|OAS2,OAS3
|
||||
|Decimal|✓|ToolingExtension
|
||||
|String|✓|OAS2,OAS3
|
||||
|Byte|✓|OAS2,OAS3
|
||||
|Binary|✓|OAS2,OAS3
|
||||
|Boolean|✓|OAS2,OAS3
|
||||
|Date|✓|OAS2,OAS3
|
||||
|DateTime|✓|OAS2,OAS3
|
||||
|Password|✓|OAS2,OAS3
|
||||
|File|✓|OAS2
|
||||
|Array|✓|OAS2,OAS3
|
||||
|Maps|✓|ToolingExtension
|
||||
|CollectionFormat|✓|OAS2
|
||||
|CollectionFormatMulti|✓|OAS2
|
||||
|Enum|✓|OAS2,OAS3
|
||||
|ArrayOfEnum|✓|ToolingExtension
|
||||
|ArrayOfModel|✓|ToolingExtension
|
||||
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|
||||
|ArrayOfCollectionOfModel|✓|ToolingExtension
|
||||
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|
||||
|MapOfEnum|✓|ToolingExtension
|
||||
|MapOfModel|✓|ToolingExtension
|
||||
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|
||||
|MapOfCollectionOfModel|✓|ToolingExtension
|
||||
|MapOfCollectionOfEnum|✓|ToolingExtension
|
||||
|
||||
### Documentation Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Readme|✓|ToolingExtension
|
||||
|Model|✓|ToolingExtension
|
||||
|Api|✓|ToolingExtension
|
||||
|
||||
### Global Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Host|✓|OAS2,OAS3
|
||||
|BasePath|✓|OAS2,OAS3
|
||||
|Info|✓|OAS2,OAS3
|
||||
|Schemes|✗|OAS2,OAS3
|
||||
|PartialSchemes|✓|OAS2,OAS3
|
||||
|Consumes|✓|OAS2
|
||||
|Produces|✓|OAS2
|
||||
|ExternalDocumentation|✓|OAS2,OAS3
|
||||
|Examples|✓|OAS2,OAS3
|
||||
|XMLStructureDefinitions|✗|OAS2,OAS3
|
||||
|MultiServer|✗|OAS3
|
||||
|ParameterizedServer|✓|OAS3
|
||||
|ParameterStyling|✗|OAS3
|
||||
|Callbacks|✗|OAS3
|
||||
|LinkObjects|✗|OAS3
|
||||
|
||||
### Parameter Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Path|✓|OAS2,OAS3
|
||||
|Query|✓|OAS2,OAS3
|
||||
|Header|✓|OAS2,OAS3
|
||||
|Body|✓|OAS2
|
||||
|FormUnencoded|✓|OAS2
|
||||
|FormMultipart|✓|OAS2
|
||||
|Cookie|✓|OAS3
|
||||
|
||||
### Schema Support Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Simple|✓|OAS2,OAS3
|
||||
|Composite|✓|OAS2,OAS3
|
||||
|Polymorphism|✗|OAS2,OAS3
|
||||
|Union|✗|OAS3
|
||||
|
||||
### Security Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasicAuth|✓|OAS2,OAS3
|
||||
|ApiKey|✓|OAS2,OAS3
|
||||
|OpenIDConnect|✗|OAS3
|
||||
|BearerToken|✗|OAS3
|
||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||
|OAuth2_Password|✗|OAS2,OAS3
|
||||
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|
||||
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
|
||||
|
||||
### Wire Format Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|JSON|✓|OAS2,OAS3
|
||||
|XML|✓|OAS2,OAS3
|
||||
|PROTOBUF|✗|ToolingExtension
|
||||
|Custom|✗|OAS2,OAS3
|
||||
@@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -42,6 +42,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelUseDefaultValidationErrorProcessor|generate default validation error processor| |true|
|
||||
|camelValidationErrorProcessor|validation error processor bean name| |validationErrorProcessor|
|
||||
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
@@ -64,7 +65,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|
||||
|invokerPackage|root package for generated code| |org.openapitools.api|
|
||||
|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)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd></dl>|spring-boot|
|
||||
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd><dt>**spring-http-interface**</dt><dd>Spring 6 HTTP interfaces (testing)</dd></dl>|spring-boot|
|
||||
|licenseName|The name of the license| |Unlicense|
|
||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||
|modelPackage|package for generated models| |org.openapitools.model|
|
||||
|
||||
@@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|configKey|Config key in @RegisterRestClient. Default to none.| |null|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -34,6 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|build|Specify for which build tool to generate files|<dl><dt>**gradle**</dt><dd>Gradle configuration is generated for the project</dd><dt>**all**</dt><dd>Both Gradle and Maven configurations are generated</dd><dt>**maven**</dt><dd>Maven configuration is generated for the project</dd></dl>|all|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|configureAuth|Configure all the authorization methods as specified in the file| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateFormat|Specify the format pattern of date as a string| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|datetimeFormat|Specify the format pattern of date-time as a string| |null|
|
||||
|
||||
@@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|build|Specify for which build tool to generate files|<dl><dt>**gradle**</dt><dd>Gradle configuration is generated for the project</dd><dt>**all**</dt><dd>Both Gradle and Maven configurations are generated</dd><dt>**maven**</dt><dd>Maven configuration is generated for the project</dd></dl>|all|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|controllerPackage|The package in which controllers will be generated| |org.openapitools.api|
|
||||
|dateFormat|Specify the format pattern of date as a string| |null|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|controllerOnly|Whether to generate only API interface stubs without the server files.| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -34,6 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
|
||||
|configKey|Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.| |null|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
@@ -56,10 +57,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
|
||||
|invokerPackage|root package for generated code| |org.openapitools.client|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey3' or other HTTP libraries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.x. JSON processing: Jackson 2.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x. or Gson 2.x</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: JSON-B</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 4.x</dd></dl>|okhttp-gson|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey3' or other HTTP libraries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.x. JSON processing: Jackson 2.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x. or Gson 2.x</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: JSON-B or Jackson 2.9.x</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 5.x</dd></dl>|okhttp-gson|
|
||||
|licenseName|The name of the license| |Unlicense|
|
||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||
|microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null|
|
||||
|microprofileMutiny|Whether to use async types for microprofile (currently only Smallrye Mutiny is supported).| |null|
|
||||
|microprofileRestClientVersion|Version of MicroProfile Rest Client API.| |null|
|
||||
|modelPackage|package for generated models| |org.openapitools.client.model|
|
||||
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
||||
167
docs/generators/jetbrains-http-client.md
Normal file
167
docs/generators/jetbrains-http-client.md
Normal file
@@ -0,0 +1,167 @@
|
||||
---
|
||||
title: Documentation for the jetbrains-http-client Generator
|
||||
---
|
||||
|
||||
## METADATA
|
||||
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | jetbrains-http-client | pass this to the generate command after -g |
|
||||
| generator stability | EXPERIMENTAL | |
|
||||
| generator type | CLIENT | |
|
||||
| generator language | Jetbrains HTTP Client (HTTP/REST) | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates a jetbrains-http client. See https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html | |
|
||||
|
||||
## 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|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
</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
|
||||
|
||||
### Wire Format Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|JSON|✓|OAS2,OAS3
|
||||
|XML|✓|OAS2,OAS3
|
||||
|PROTOBUF|✗|ToolingExtension
|
||||
|Custom|✗|OAS2,OAS3
|
||||
219
docs/generators/julia-client.md
Normal file
219
docs/generators/julia-client.md
Normal file
@@ -0,0 +1,219 @@
|
||||
---
|
||||
title: Documentation for the julia-client Generator
|
||||
---
|
||||
|
||||
## METADATA
|
||||
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | julia-client | pass this to the generate command after -g |
|
||||
| generator stability | BETA | |
|
||||
| generator type | CLIENT | |
|
||||
| generator language | Julia | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates a julia 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 |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|exportModels|Whether to generate code to export model names.| |false|
|
||||
|exportOperations|Whether to generate code to export operation names.| |false|
|
||||
|packageName|Julia client package name.| |APIClient|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Any</li>
|
||||
<li>Bool</li>
|
||||
<li>Char</li>
|
||||
<li>Date</li>
|
||||
<li>DateTime</li>
|
||||
<li>Dict</li>
|
||||
<li>Float16</li>
|
||||
<li>Float32</li>
|
||||
<li>Float64</li>
|
||||
<li>Int128</li>
|
||||
<li>Int16</li>
|
||||
<li>Int32</li>
|
||||
<li>Int64</li>
|
||||
<li>Int8</li>
|
||||
<li>Integer</li>
|
||||
<li>Nothing</li>
|
||||
<li>String</li>
|
||||
<li>UInt128</li>
|
||||
<li>UInt16</li>
|
||||
<li>UInt32</li>
|
||||
<li>UInt64</li>
|
||||
<li>UInt8</li>
|
||||
<li>Vector</li>
|
||||
<li>Vector{UInt8}</li>
|
||||
<li>ZonedDateTime</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Any</li>
|
||||
<li>Base</li>
|
||||
<li>DataType</li>
|
||||
<li>Enum</li>
|
||||
<li>Type</li>
|
||||
<li>baremodule</li>
|
||||
<li>begin</li>
|
||||
<li>break</li>
|
||||
<li>catch</li>
|
||||
<li>ccall</li>
|
||||
<li>const</li>
|
||||
<li>continue</li>
|
||||
<li>do</li>
|
||||
<li>else</li>
|
||||
<li>elseif</li>
|
||||
<li>end</li>
|
||||
<li>export</li>
|
||||
<li>finally</li>
|
||||
<li>for</li>
|
||||
<li>function</li>
|
||||
<li>global</li>
|
||||
<li>if</li>
|
||||
<li>import</li>
|
||||
<li>let</li>
|
||||
<li>local</li>
|
||||
<li>macro</li>
|
||||
<li>module</li>
|
||||
<li>quote</li>
|
||||
<li>return</li>
|
||||
<li>try</li>
|
||||
<li>using</li>
|
||||
<li>while</li>
|
||||
</ul>
|
||||
|
||||
## FEATURE SET
|
||||
|
||||
|
||||
### Client Modification Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasePath|✓|ToolingExtension
|
||||
|Authorizations|✗|ToolingExtension
|
||||
|UserAgent|✓|ToolingExtension
|
||||
|MockServer|✗|ToolingExtension
|
||||
|
||||
### Data Type Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Custom|✗|OAS2,OAS3
|
||||
|Int32|✓|OAS2,OAS3
|
||||
|Int64|✓|OAS2,OAS3
|
||||
|Float|✓|OAS2,OAS3
|
||||
|Double|✓|OAS2,OAS3
|
||||
|Decimal|✓|ToolingExtension
|
||||
|String|✓|OAS2,OAS3
|
||||
|Byte|✓|OAS2,OAS3
|
||||
|Binary|✓|OAS2,OAS3
|
||||
|Boolean|✓|OAS2,OAS3
|
||||
|Date|✓|OAS2,OAS3
|
||||
|DateTime|✓|OAS2,OAS3
|
||||
|Password|✓|OAS2,OAS3
|
||||
|File|✓|OAS2
|
||||
|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
|
||||
|
||||
### Wire Format Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|JSON|✓|OAS2,OAS3
|
||||
|XML|✗|OAS2,OAS3
|
||||
|PROTOBUF|✗|ToolingExtension
|
||||
|Custom|✗|OAS2,OAS3
|
||||
218
docs/generators/julia-server.md
Normal file
218
docs/generators/julia-server.md
Normal file
@@ -0,0 +1,218 @@
|
||||
---
|
||||
title: Documentation for the julia-server Generator
|
||||
---
|
||||
|
||||
## METADATA
|
||||
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | julia-server | pass this to the generate command after -g |
|
||||
| generator stability | BETA | |
|
||||
| generator type | SERVER | |
|
||||
| generator language | Julia | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates a julia server. | |
|
||||
|
||||
## 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 |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|exportModels|Whether to generate code to export model names.| |false|
|
||||
|packageName|Julia server package name.| |APIServer|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Any</li>
|
||||
<li>Bool</li>
|
||||
<li>Char</li>
|
||||
<li>Date</li>
|
||||
<li>DateTime</li>
|
||||
<li>Dict</li>
|
||||
<li>Float16</li>
|
||||
<li>Float32</li>
|
||||
<li>Float64</li>
|
||||
<li>Int128</li>
|
||||
<li>Int16</li>
|
||||
<li>Int32</li>
|
||||
<li>Int64</li>
|
||||
<li>Int8</li>
|
||||
<li>Integer</li>
|
||||
<li>Nothing</li>
|
||||
<li>String</li>
|
||||
<li>UInt128</li>
|
||||
<li>UInt16</li>
|
||||
<li>UInt32</li>
|
||||
<li>UInt64</li>
|
||||
<li>UInt8</li>
|
||||
<li>Vector</li>
|
||||
<li>Vector{UInt8}</li>
|
||||
<li>ZonedDateTime</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Any</li>
|
||||
<li>Base</li>
|
||||
<li>DataType</li>
|
||||
<li>Enum</li>
|
||||
<li>Type</li>
|
||||
<li>baremodule</li>
|
||||
<li>begin</li>
|
||||
<li>break</li>
|
||||
<li>catch</li>
|
||||
<li>ccall</li>
|
||||
<li>const</li>
|
||||
<li>continue</li>
|
||||
<li>do</li>
|
||||
<li>else</li>
|
||||
<li>elseif</li>
|
||||
<li>end</li>
|
||||
<li>export</li>
|
||||
<li>finally</li>
|
||||
<li>for</li>
|
||||
<li>function</li>
|
||||
<li>global</li>
|
||||
<li>if</li>
|
||||
<li>import</li>
|
||||
<li>let</li>
|
||||
<li>local</li>
|
||||
<li>macro</li>
|
||||
<li>module</li>
|
||||
<li>quote</li>
|
||||
<li>return</li>
|
||||
<li>try</li>
|
||||
<li>using</li>
|
||||
<li>while</li>
|
||||
</ul>
|
||||
|
||||
## FEATURE SET
|
||||
|
||||
|
||||
### Client Modification Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasePath|✓|ToolingExtension
|
||||
|Authorizations|✗|ToolingExtension
|
||||
|UserAgent|✓|ToolingExtension
|
||||
|MockServer|✗|ToolingExtension
|
||||
|
||||
### Data Type Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Custom|✗|OAS2,OAS3
|
||||
|Int32|✓|OAS2,OAS3
|
||||
|Int64|✓|OAS2,OAS3
|
||||
|Float|✓|OAS2,OAS3
|
||||
|Double|✓|OAS2,OAS3
|
||||
|Decimal|✓|ToolingExtension
|
||||
|String|✓|OAS2,OAS3
|
||||
|Byte|✓|OAS2,OAS3
|
||||
|Binary|✓|OAS2,OAS3
|
||||
|Boolean|✓|OAS2,OAS3
|
||||
|Date|✓|OAS2,OAS3
|
||||
|DateTime|✓|OAS2,OAS3
|
||||
|Password|✓|OAS2,OAS3
|
||||
|File|✓|OAS2
|
||||
|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
|
||||
|
||||
### Wire Format Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|JSON|✓|OAS2,OAS3
|
||||
|XML|✗|OAS2,OAS3
|
||||
|PROTOBUF|✗|ToolingExtension
|
||||
|Custom|✗|OAS2,OAS3
|
||||
212
docs/generators/julia.md
Normal file
212
docs/generators/julia.md
Normal file
@@ -0,0 +1,212 @@
|
||||
---
|
||||
title: Documentation for the julia Generator
|
||||
---
|
||||
|
||||
## METADATA
|
||||
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | julia | pass this to the generate command after -g |
|
||||
| generator stability | STABLE | |
|
||||
| generator type | CLIENT | |
|
||||
| generator language | Java | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates a julia 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 |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|packageName|Julia package name.| |APIClient|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Array</li>
|
||||
<li>Bool</li>
|
||||
<li>Char</li>
|
||||
<li>Float16</li>
|
||||
<li>Float32</li>
|
||||
<li>Float64</li>
|
||||
<li>Int128</li>
|
||||
<li>Int16</li>
|
||||
<li>Int32</li>
|
||||
<li>Int64</li>
|
||||
<li>Int8</li>
|
||||
<li>Integer</li>
|
||||
<li>Nothing</li>
|
||||
<li>String</li>
|
||||
<li>UInt128</li>
|
||||
<li>UInt16</li>
|
||||
<li>UInt32</li>
|
||||
<li>UInt64</li>
|
||||
<li>UInt8</li>
|
||||
<li>Vector</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Any</li>
|
||||
<li>Base</li>
|
||||
<li>DataType</li>
|
||||
<li>Enum</li>
|
||||
<li>Type</li>
|
||||
<li>baremodule</li>
|
||||
<li>begin</li>
|
||||
<li>break</li>
|
||||
<li>catch</li>
|
||||
<li>ccall</li>
|
||||
<li>const</li>
|
||||
<li>continue</li>
|
||||
<li>do</li>
|
||||
<li>else</li>
|
||||
<li>elseif</li>
|
||||
<li>end</li>
|
||||
<li>export</li>
|
||||
<li>finally</li>
|
||||
<li>for</li>
|
||||
<li>function</li>
|
||||
<li>global</li>
|
||||
<li>if</li>
|
||||
<li>import</li>
|
||||
<li>let</li>
|
||||
<li>local</li>
|
||||
<li>macro</li>
|
||||
<li>module</li>
|
||||
<li>quote</li>
|
||||
<li>return</li>
|
||||
<li>try</li>
|
||||
<li>using</li>
|
||||
<li>while</li>
|
||||
</ul>
|
||||
|
||||
## FEATURE SET
|
||||
|
||||
|
||||
### Client Modification Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasePath|✗|ToolingExtension
|
||||
|Authorizations|✗|ToolingExtension
|
||||
|UserAgent|✗|ToolingExtension
|
||||
|MockServer|✗|ToolingExtension
|
||||
|
||||
### Data Type Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Custom|✗|OAS2,OAS3
|
||||
|Int32|✓|OAS2,OAS3
|
||||
|Int64|✓|OAS2,OAS3
|
||||
|Float|✓|OAS2,OAS3
|
||||
|Double|✓|OAS2,OAS3
|
||||
|Decimal|✓|ToolingExtension
|
||||
|String|✓|OAS2,OAS3
|
||||
|Byte|✓|OAS2,OAS3
|
||||
|Binary|✓|OAS2,OAS3
|
||||
|Boolean|✓|OAS2,OAS3
|
||||
|Date|✓|OAS2,OAS3
|
||||
|DateTime|✓|OAS2,OAS3
|
||||
|Password|✓|OAS2,OAS3
|
||||
|File|✓|OAS2
|
||||
|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
|
||||
|
||||
### Wire Format Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|JSON|✓|OAS2,OAS3
|
||||
|XML|✓|OAS2,OAS3
|
||||
|PROTOBUF|✗|ToolingExtension
|
||||
|Custom|✗|OAS2,OAS3
|
||||
@@ -49,6 +49,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
|title|server title name or client service name| |OpenAPI Kotlin Spring|
|
||||
|useBeanValidation|Use BeanValidation API annotations to validate data types| |true|
|
||||
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|
||||
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|
||||
|useTags|Whether to use tags for creating interface and controller class names| |false|
|
||||
|
||||
|
||||
@@ -19,7 +19,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowStringInDateTimeParameters|Allow string as input to datetime/date parameters for backward compartibility.| |false|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|floatStrictType|Use strict type for float, i.e. StrictFloat or confloat(strict=true, ...)| |true|
|
||||
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|library|library template (sub-template) to use: asyncio, tornado (deprecated), urllib3| |urllib3|
|
||||
|
||||
@@ -35,6 +35,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|
||||
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|
||||
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
@@ -57,7 +58,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|
||||
|invokerPackage|root package for generated code| |org.openapitools.api|
|
||||
|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)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd></dl>|spring-boot|
|
||||
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd><dt>**spring-http-interface**</dt><dd>Spring 6 HTTP interfaces (testing)</dd></dl>|spring-boot|
|
||||
|licenseName|The name of the license| |Unlicense|
|
||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||
|modelPackage|package for generated models| |org.openapitools.model|
|
||||
|
||||
@@ -103,18 +103,18 @@ docker run --rm \
|
||||
<!-- RELEASE_VERSION -->
|
||||
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
|
||||
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.1/openapi-generator-cli-6.2.1.jar`
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
|
||||
```bash
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.1/openapi-generator-cli-6.2.1.jar -O openapi-generator-cli.jar
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar -O openapi-generator-cli.jar
|
||||
```
|
||||
|
||||
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
|
||||
|
||||
```powershell
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.1/openapi-generator-cli-6.2.1.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar
|
||||
```
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
|
||||
@@ -642,7 +642,7 @@ openapi-generator-cli generate -i petstore.yaml -g typescript-fetch -o out \
|
||||
The `batch` command allows you to move all CLI arguments supported by the `generate` command into a YAML or JSON file.
|
||||
|
||||
*NOTE*: This command supports an additional `!include` property which may point to another "shared" file, the base path to which can be
|
||||
modified by `--includes-base-dir`. Starting with 5.0.0, the `!batch` command supports multiple `!include` properties, either sequential or nested. In order to support multiple `!include` properties in a JSON file, the property name can have a suffix, e.g. `!include1`, `!include2`, etc. The suffix have no meaning other than providing unique property names.
|
||||
modified by `--includes-base-dir`. Starting with 5.0.0, the `!batch` command supports multiple `!include` properties, either sequential or nested under other keys. In order to support multiple `!include` properties in a JSON file, the property name can have a suffix, e.g. `!include1`, `!include2`, etc. The suffix have no meaning other than providing unique property names.
|
||||
|
||||
```text
|
||||
openapi-generator-cli help batch
|
||||
@@ -697,6 +697,11 @@ additionalProperties:
|
||||
x-ext-name: "Your Name"
|
||||
EOF
|
||||
|
||||
# create nested "shared" config
|
||||
cat > shared/nested.yaml <<EOF
|
||||
useCompareNetObjects: "true"
|
||||
EOF
|
||||
|
||||
# create "standard" configs
|
||||
cat > kotlin.yaml <<EOF
|
||||
'!include': 'shared/common.yaml'
|
||||
@@ -714,7 +719,7 @@ outputDir: out/csharp-netcore
|
||||
generatorName: csharp-netcore
|
||||
additionalProperties:
|
||||
packageGuid: "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}"
|
||||
useCompareNetObjects: "true"
|
||||
'!include': 'shared/nested.yaml'
|
||||
EOF
|
||||
|
||||
# Generate them
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.stream.Stream;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.config.CodegenConfigurator;
|
||||
import org.openapitools.codegen.config.MergedSpecBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -57,6 +58,13 @@ public class Generate extends OpenApiGeneratorCommand {
|
||||
description = "location of the OpenAPI spec, as URL or file (required if not loaded via config using -c)")
|
||||
private String spec;
|
||||
|
||||
@Option(name = "--input-spec-root-directory", title = "Folder with spec(s)",
|
||||
description = "Local root folder with spec file(s)")
|
||||
private String inputSpecRootDirectory;
|
||||
|
||||
@Option(name = "--merged-spec-filename", title = "Name of resulted merged specs file (used along with --input-spec-root-directory option)")
|
||||
private String mergedFileName;
|
||||
|
||||
@Option(name = {"-t", "--template-dir"}, title = "template directory",
|
||||
description = "folder containing the template files")
|
||||
private String templateDir;
|
||||
@@ -283,6 +291,12 @@ public class Generate extends OpenApiGeneratorCommand {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
if (StringUtils.isNotBlank(inputSpecRootDirectory)) {
|
||||
spec = new MergedSpecBuilder(inputSpecRootDirectory, StringUtils.isBlank(mergedFileName) ? "_merged_spec" : mergedFileName)
|
||||
.buildMergedSpec();
|
||||
System.out.println("Merge input spec would be used - " + spec);
|
||||
}
|
||||
|
||||
if (logToStderr != null) {
|
||||
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
|
||||
Stream.of(Logger.ROOT_LOGGER_NAME, "io.swagger", "org.openapitools")
|
||||
|
||||
@@ -52,6 +52,10 @@ public class OptionUtilsTest {
|
||||
doTupleListTest("a=1,=,c=3", asList(Pair.of("a", "1"), Pair.of("c", "3")));
|
||||
doTupleListTest("", emptyPairList());
|
||||
doTupleListTest(null, emptyPairList());
|
||||
doTupleListTest("a=1,b=2,c=\"3,4,5\"",
|
||||
asList(Pair.of("a", "1"), Pair.of("b", "2"),
|
||||
Pair.of("c", "\"3,4,5\"")));
|
||||
|
||||
}
|
||||
|
||||
private static void doTupleListTest(String input, List<Pair<String, String>> expectedResults) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -97,7 +97,7 @@ task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.Valid
|
||||
[source,group]
|
||||
----
|
||||
plugins {
|
||||
id "org.openapi.generator" version "6.2.1"
|
||||
id "org.openapi.generator" version "6.3.0"
|
||||
}
|
||||
----
|
||||
|
||||
@@ -113,7 +113,7 @@ buildscript {
|
||||
// url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:6.2.1"
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:6.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -705,7 +705,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath('org.openapitools:openapi-generator-gradle-plugin:6.2.1') {
|
||||
classpath('org.openapitools:openapi-generator-gradle-plugin:6.3.0') {
|
||||
exclude group: 'com.google.guava'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=6.3.0-SNAPSHOT
|
||||
openApiGeneratorVersion=6.5.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
# BEGIN placeholders
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -19,5 +19,5 @@ gradle generateGoWithInvalidSpec # expected outcome: BUILD FAILED
|
||||
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
|
||||
|
||||
```bash
|
||||
gradle -PopenApiGeneratorVersion=6.2.1 openApiValidate
|
||||
gradle -PopenApiGeneratorVersion=6.3.0 openApiValidate
|
||||
```
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=6.3.0-SNAPSHOT
|
||||
openApiGeneratorVersion=6.5.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.openapitools.codegen.CodegenConstants
|
||||
import org.openapitools.codegen.DefaultGenerator
|
||||
import org.openapitools.codegen.config.CodegenConfigurator
|
||||
import org.openapitools.codegen.config.GlobalSettings
|
||||
import org.openapitools.codegen.config.MergedSpecBuilder
|
||||
|
||||
/**
|
||||
* A task which generates the desired code.
|
||||
@@ -96,6 +97,21 @@ open class GenerateTask : DefaultTask() {
|
||||
@PathSensitive(PathSensitivity.RELATIVE)
|
||||
val inputSpec = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Local root folder with spec files
|
||||
*/
|
||||
@Optional
|
||||
@get:InputFile
|
||||
@PathSensitive(PathSensitivity.RELATIVE)
|
||||
val inputSpecRootDirectory = project.objects.property<String>();
|
||||
|
||||
/**
|
||||
* Name of the file that will contains all merged specs
|
||||
*/
|
||||
@Input
|
||||
@Optional
|
||||
val mergedFileName = project.objects.property<String>();
|
||||
|
||||
/**
|
||||
* The remote Open API 2.0/3.x specification URL location.
|
||||
*/
|
||||
@@ -527,6 +543,11 @@ open class GenerateTask : DefaultTask() {
|
||||
@Suppress("unused")
|
||||
@TaskAction
|
||||
fun doWork() {
|
||||
inputSpecRootDirectory.ifNotEmpty { inputSpecRootDirectoryValue -> {
|
||||
inputSpec.set(MergedSpecBuilder(inputSpecRootDirectoryValue, mergedFileName.get()).buildMergedSpec())
|
||||
logger.info("Merge input spec would be used - {}", inputSpec.get())
|
||||
}}
|
||||
|
||||
cleanupOutput.ifNotEmpty { cleanup ->
|
||||
if (cleanup) {
|
||||
project.delete(outputDir)
|
||||
|
||||
@@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.2.1</version>
|
||||
<version>6.3.0</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
@@ -138,6 +138,35 @@ Notice that some of these environment variable options may overwrite or conflict
|
||||
|
||||
The difference here is that you may define `generateModels` and `modelsToGenerate` as properties, while `globalProperties` may only be configured as a configuration node.
|
||||
|
||||
### Type and import mappings
|
||||
|
||||
To override the mappings between OpenAPI spec types and the types used in the generated code, set `typeMappings`.
|
||||
|
||||
```xml
|
||||
<configuration>
|
||||
<typeMappings>
|
||||
<!-- convert Double to BigDecimal -->
|
||||
<typeMapping>Double=java.math.BigDecimal</typeMapping>
|
||||
</typeMappings>
|
||||
</configuration>
|
||||
```
|
||||
|
||||
For types that are not already included in the generator configuration, you may need to add a corresponding `importMapping` too.
|
||||
|
||||
```xml
|
||||
<configuration>
|
||||
<!-- convert file/binary to JAX-RS StreamingOutput -->
|
||||
<typeMappings>
|
||||
<typeMapping>binary=StreamingOutput</typeMapping>
|
||||
<typeMapping>file=StreamingOutput</typeMapping>
|
||||
</typeMappings>
|
||||
<importMappings>
|
||||
<importMapping>StreamingOutput=javax.ws.rs.core.StreamingOutput</importMapping>
|
||||
</importMappings>
|
||||
</configuration>
|
||||
```
|
||||
|
||||
|
||||
### Custom Generator
|
||||
|
||||
Specifying a custom generator is a bit different. It doesn't support the classpath:/ syntax, but it does support the fully qualified name of the package. You can also specify your custom templates, which also get pulled in. Notice the dependency on a project, in the plugin scope. That would be your generator/template jar.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.2.1.RELEASE</version>
|
||||
<version>2.7.6</version>
|
||||
</parent>
|
||||
<build>
|
||||
<plugins>
|
||||
@@ -20,7 +20,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
@@ -125,8 +125,6 @@
|
||||
|
||||
<properties>
|
||||
<swagger-annotations-version>1.5.8</swagger-annotations-version>
|
||||
|
||||
<spring-boot-starter-web.version>2.2.1.RELEASE</spring-boot-starter-web.version>
|
||||
<springfox-version>2.8.0</springfox-version>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -59,6 +59,7 @@ import org.openapitools.codegen.DefaultGenerator;
|
||||
import org.openapitools.codegen.auth.AuthParser;
|
||||
import org.openapitools.codegen.config.CodegenConfigurator;
|
||||
import org.openapitools.codegen.config.GlobalSettings;
|
||||
import org.openapitools.codegen.config.MergedSpecBuilder;
|
||||
import org.sonatype.plexus.build.incremental.BuildContext;
|
||||
import org.sonatype.plexus.build.incremental.DefaultBuildContext;
|
||||
import org.slf4j.Logger;
|
||||
@@ -104,6 +105,18 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(name = "inputSpec", property = "openapi.generator.maven.plugin.inputSpec", required = true)
|
||||
private String inputSpec;
|
||||
|
||||
/**
|
||||
* Local root folder with spec files
|
||||
*/
|
||||
@Parameter(name = "inputSpecRootDirectory", property = "openapi.generator.maven.plugin.inputSpecRootDirectory")
|
||||
private String inputSpecRootDirectory;
|
||||
|
||||
/**
|
||||
* Name of the file that will contains all merged specs
|
||||
*/
|
||||
@Parameter(name = "mergedFileName", property = "openapi.generator.maven.plugin.mergedFileName", defaultValue = "_merged_spec")
|
||||
private String mergedFileName;
|
||||
|
||||
/**
|
||||
* Git host, e.g. gitlab.com.
|
||||
*/
|
||||
@@ -468,6 +481,12 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
|
||||
@Override
|
||||
public void execute() throws MojoExecutionException {
|
||||
if (StringUtils.isNotBlank(inputSpecRootDirectory)) {
|
||||
inputSpec = new MergedSpecBuilder(inputSpecRootDirectory, mergedFileName)
|
||||
.buildMergedSpec();
|
||||
LOGGER.info("Merge input spec would be used - {}", inputSpec);
|
||||
}
|
||||
|
||||
File inputSpecFile = new File(inputSpec);
|
||||
|
||||
if (output == null) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
@@ -12,7 +12,7 @@
|
||||
<packaging>jar</packaging>
|
||||
<name>openapi-generator-online</name>
|
||||
<properties>
|
||||
<spring-boot.version>2.7.5</spring-boot.version>
|
||||
<spring-boot.version>2.5.14</spring-boot.version>
|
||||
<springfox-version>3.0.0</springfox-version>
|
||||
<sonar.exclusions>**/org/openapitools/codegen/online/**/*</sonar.exclusions>
|
||||
</properties>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -2188,6 +2188,21 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return " = data." + name + ";";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default value of the property
|
||||
* <p>
|
||||
* Return null if you do NOT want a default value.
|
||||
* Any non-null value will cause {{#defaultValue} check to pass.
|
||||
*
|
||||
* @param schema Property schema
|
||||
* @param codegenProperty Codegen property
|
||||
* @return string presentation of the default value of the property
|
||||
*/
|
||||
public String toDefaultValue(CodegenProperty codegenProperty, Schema schema) {
|
||||
// use toDefaultValue(schema) if generator has not overriden this method
|
||||
return toDefaultValue(schema);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the OpenAPI type for the property. Use getAlias to handle $ref of primitive type
|
||||
*
|
||||
@@ -3786,8 +3801,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
LOGGER.debug("Exception from toExampleValue: {}", e.getMessage());
|
||||
property.example = "ERROR_TO_EXAMPLE_VALUE";
|
||||
}
|
||||
property.defaultValue = toDefaultValue(p);
|
||||
property.defaultValueWithParam = toDefaultValueWithParam(name, p);
|
||||
|
||||
property.jsonSchema = Json.pretty(p);
|
||||
|
||||
if (p.getDeprecated() != null) {
|
||||
@@ -3863,8 +3877,12 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
// set isNullable using nullable or x-nullable in the schema
|
||||
if (referencedSchema.getNullable() != null) {
|
||||
property.isNullable = referencedSchema.getNullable();
|
||||
} else if (referencedSchema.getExtensions() != null &&
|
||||
referencedSchema.getExtensions().containsKey("x-nullable")) {
|
||||
property.isNullable = (Boolean) referencedSchema.getExtensions().get("x-nullable");
|
||||
}
|
||||
|
||||
property.dataType = getTypeDeclaration(p);
|
||||
@@ -3932,13 +3950,17 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
if (!ModelUtils.isArraySchema(p) && !ModelUtils.isMapSchema(p) && !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
|
||||
* so primitive schemas int, str, number, referenced schemas, AnyType schemas with properties, enums, or composition
|
||||
*/
|
||||
String type = getSchemaType(p);
|
||||
setNonArrayMapProperty(property, type);
|
||||
property.isModel = (ModelUtils.isComposedSchema(referencedSchema) || ModelUtils.isObjectSchema(referencedSchema)) && ModelUtils.isModel(referencedSchema);
|
||||
}
|
||||
|
||||
// set the default value
|
||||
property.defaultValue = toDefaultValue(property, p);
|
||||
property.defaultValueWithParam = toDefaultValueWithParam(name, p);
|
||||
|
||||
LOGGER.debug("debugging from property return: {}", property);
|
||||
schemaCodegenPropertyCache.put(ns, property);
|
||||
return property;
|
||||
@@ -5285,14 +5307,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
// sort auth methods to maintain the same order
|
||||
Collections.sort(codegenSecurities, new Comparator<CodegenSecurity>() {
|
||||
@Override
|
||||
public int compare(CodegenSecurity one, CodegenSecurity another) {
|
||||
return ObjectUtils.compare(one.name, another.name);
|
||||
}
|
||||
});
|
||||
|
||||
return codegenSecurities;
|
||||
}
|
||||
|
||||
@@ -6704,6 +6718,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// Set 'required' flag defined in the schema element
|
||||
if (!codegenParameter.required && schema.getRequired() != null) {
|
||||
codegenParameter.required = schema.getRequired().contains(entry.getKey());
|
||||
} else if (!codegenParameter.required) {
|
||||
// Set 'required' flag for properties declared inside the allOf
|
||||
codegenParameter.required = allRequired.stream().anyMatch(r -> r.equals(codegenParameter.paramName));
|
||||
}
|
||||
|
||||
parameters.add(codegenParameter);
|
||||
|
||||
@@ -727,15 +727,18 @@ public class DefaultGenerator implements Generator {
|
||||
outputFolder += File.separator + support.getFolder();
|
||||
}
|
||||
File of = new File(outputFolder);
|
||||
if (!of.isDirectory()) {
|
||||
if (!dryRun && !of.mkdirs()) {
|
||||
once(LOGGER).debug("Output directory {} not created. It {}.", outputFolder, of.exists() ? "already exists." : "may not have appropriate permissions.");
|
||||
}
|
||||
}
|
||||
String outputFilename = new File(support.getDestinationFilename()).isAbsolute() // split
|
||||
? support.getDestinationFilename()
|
||||
: outputFolder + File.separator + support.getDestinationFilename().replace('/', File.separatorChar);
|
||||
|
||||
if (!of.isDirectory()) {
|
||||
// check that its not a dryrun and the files in the directory aren't ignored before we make the directory
|
||||
if (!dryRun && ignoreProcessor.allowsFile(new File(outputFilename)) && !of.mkdirs()) {
|
||||
once(LOGGER).debug("Output directory {} not created. It {}.", outputFolder, of.exists() ? "already exists." : "may not have appropriate permissions.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean shouldGenerate = true;
|
||||
if (supportingFilesToGenerate != null && !supportingFilesToGenerate.isEmpty()) {
|
||||
shouldGenerate = supportingFilesToGenerate.contains(support.getDestinationFilename());
|
||||
|
||||
@@ -28,12 +28,12 @@ public enum GeneratorLanguage {
|
||||
DART("Dart"), EIFFEL("Eiffel"), ELIXIR("Elixir"), ELM("Elm"),
|
||||
ERLANG("Erlang"), FLASH("Flash"), F_SHARP("F#"), GO("Go"),
|
||||
JAVASCRIPT("Javascript"), GRAPH_QL("GraphQL"), GROOVY("Groovy"),
|
||||
HASKELL("Haskell"), TYPESCRIPT("Typescript"), K_SIX("k6"), KOTLIN("Kotlin"),
|
||||
HASKELL("Haskell"), HTTP("Jetbrains HTTP Client (HTTP/REST)"), TYPESCRIPT("Typescript"), K_SIX("k6"), KOTLIN("Kotlin"),
|
||||
KTORM("Ktorm"), LUA("Lua"), MYSQL("Mysql"), NIM("Nim"),
|
||||
OBJECTIVE_C("Objective-C"), OCAML("OCaml"), PERL("Perl"), PHP("PHP"),
|
||||
POWERSHELL("PowerShell"), PROTOBUF("Protocol Buffers (Protobuf)"), PYTHON("Python"),
|
||||
R("R"), RUBY("Ruby"), RUST("Rust"), SCALA("Scala"), SWIFT("Swift"),
|
||||
WSDL("Web Services Description Language (WSDL)");
|
||||
WSDL("Web Services Description Language (WSDL)"), JULIA("Julia");
|
||||
|
||||
private final String label;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.MapperFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import io.swagger.v3.oas.models.*;
|
||||
import io.swagger.v3.oas.models.PathItem.HttpMethod;
|
||||
import io.swagger.v3.oas.models.callbacks.Callback;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
@@ -107,52 +108,63 @@ public class InlineModelResolver {
|
||||
|
||||
for (Map.Entry<String, PathItem> pathsEntry : paths.entrySet()) {
|
||||
PathItem path = pathsEntry.getValue();
|
||||
List<Operation> operations = new ArrayList<>(path.readOperations());
|
||||
Map<HttpMethod, Operation> operationsMap = new LinkedHashMap<>(path.readOperationsMap());
|
||||
|
||||
// use path name (e.g. /foo/bar) and HTTP verb to come up with a name
|
||||
// in case operationId is not defined later in other methods
|
||||
String pathname = pathsEntry.getKey();
|
||||
String name = pathname;
|
||||
if (path.getDelete() != null) {
|
||||
name = pathname + "_delete";
|
||||
} else if (path.getGet() != null) {
|
||||
name = pathname + "_get";
|
||||
} else if (path.getHead() != null) {
|
||||
name = pathname + "_head";
|
||||
} else if (path.getOptions() != null) {
|
||||
name = pathname + "_options";
|
||||
} else if (path.getPatch() != null) {
|
||||
name = pathname + "_patch";
|
||||
} else if (path.getPost() != null) {
|
||||
name = pathname + "_post";
|
||||
} else if (path.getPut() != null) {
|
||||
name = pathname + "_put";
|
||||
} else if (path.getTrace() != null) {
|
||||
name = pathname + "_trace";
|
||||
} else {
|
||||
// no HTTP verb defined?
|
||||
//throw new RuntimeException("No HTTP verb found/detected in the inline model resolver");
|
||||
}
|
||||
|
||||
// Include callback operation as well
|
||||
for (Operation operation : path.readOperations()) {
|
||||
for (Map.Entry<HttpMethod, Operation> operationEntry : new LinkedHashMap<>(path.readOperationsMap()).entrySet()) {
|
||||
Operation operation = operationEntry.getValue();
|
||||
Map<String, Callback> callbacks = operation.getCallbacks();
|
||||
if (callbacks != null) {
|
||||
operations.addAll(callbacks.values().stream()
|
||||
.flatMap(callback -> callback.values().stream())
|
||||
.flatMap(pathItem -> pathItem.readOperations().stream())
|
||||
.collect(Collectors.toList()));
|
||||
for (Map.Entry<String, Callback> callbackEntry : callbacks.entrySet()) {
|
||||
Callback callback = callbackEntry.getValue();
|
||||
for (Map.Entry<String, PathItem> pathItemEntry : callback.entrySet()) {
|
||||
PathItem pathItem = pathItemEntry.getValue();
|
||||
operationsMap.putAll(pathItem.readOperationsMap());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Operation operation : operations) {
|
||||
flattenRequestBody(name, operation);
|
||||
flattenParameters(name, operation);
|
||||
flattenResponses(name, operation);
|
||||
for (Map.Entry<HttpMethod, Operation> operationEntry : operationsMap.entrySet()) {
|
||||
Operation operation = operationEntry.getValue();
|
||||
String inlineSchemaName = this.getInlineSchemaName(operationEntry.getKey(), pathname);
|
||||
flattenRequestBody(inlineSchemaName, operation);
|
||||
flattenParameters(inlineSchemaName, operation);
|
||||
flattenResponses(inlineSchemaName, operation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getInlineSchemaName(HttpMethod httpVerb, String pathname) {
|
||||
String name = pathname;
|
||||
if (httpVerb.equals(HttpMethod.DELETE)) {
|
||||
name += "_delete";
|
||||
} else if (httpVerb.equals(HttpMethod.GET)) {
|
||||
name += "_get";
|
||||
} else if (httpVerb.equals(HttpMethod.HEAD)) {
|
||||
name += "_head";
|
||||
} else if (httpVerb.equals(HttpMethod.OPTIONS)) {
|
||||
name += "_options";
|
||||
} else if (httpVerb.equals(HttpMethod.PATCH)) {
|
||||
name += "_patch";
|
||||
} else if (httpVerb.equals(HttpMethod.POST)) {
|
||||
name += "_post";
|
||||
} else if (httpVerb.equals(HttpMethod.PUT)) {
|
||||
name += "_put";
|
||||
} else if (httpVerb.equals(HttpMethod.TRACE)) {
|
||||
name += "_trace";
|
||||
} else {
|
||||
// no HTTP verb defined?
|
||||
// throw new RuntimeException("No HTTP verb found/detected in the inline model
|
||||
// resolver");
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return false if model can be represented by primitives e.g. string, object
|
||||
* without properties, array or map of other model (model contanier), etc.
|
||||
|
||||
@@ -39,7 +39,7 @@ public class OpenAPINormalizer {
|
||||
final Logger LOGGER = LoggerFactory.getLogger(OpenAPINormalizer.class);
|
||||
|
||||
// ============= a list of rules =============
|
||||
// when set to true, all rules are enabled
|
||||
// when set to true, all rules (true or false) are enabled
|
||||
final String ALL = "ALL";
|
||||
boolean enableAll;
|
||||
|
||||
@@ -63,6 +63,19 @@ public class OpenAPINormalizer {
|
||||
final String SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING = "SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING";
|
||||
boolean simplifyAnyOfStringAndEnumString;
|
||||
|
||||
// when set to true, oneOf/anyOf schema with only one sub-schema is simplified to just the sub-schema
|
||||
// and if sub-schema contains "null", remove it and set nullable to true instead
|
||||
final String SIMPLIFY_ONEOF_ANYOF = "SIMPLIFY_ONEOF_ANYOF";
|
||||
boolean simplifyOneOfAnyOf;
|
||||
|
||||
// when set to true, boolean enum will be converted to just boolean
|
||||
final String SIMPLIFY_BOOLEAN_ENUM = "SIMPLIFY_BOOLEAN_ENUM";
|
||||
boolean simplifyBooleanEnum;
|
||||
|
||||
// when set to a string value, tags in all operations will be reset to the string value provided
|
||||
final String SET_TAGS_FOR_ALL_OPERATIONS = "SET_TAGS_FOR_ALL_OPERATIONS";
|
||||
String setTagsForAllOperations;
|
||||
|
||||
// ============= end of rules =============
|
||||
|
||||
/**
|
||||
@@ -106,6 +119,19 @@ public class OpenAPINormalizer {
|
||||
if (enableAll || "true".equalsIgnoreCase(rules.get(SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING))) {
|
||||
simplifyAnyOfStringAndEnumString = true;
|
||||
}
|
||||
|
||||
if (enableAll || "true".equalsIgnoreCase(rules.get(SIMPLIFY_ONEOF_ANYOF))) {
|
||||
simplifyOneOfAnyOf = true;
|
||||
}
|
||||
|
||||
if (enableAll || "true".equalsIgnoreCase(rules.get(SIMPLIFY_BOOLEAN_ENUM))) {
|
||||
simplifyBooleanEnum = true;
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(rules.get(SET_TAGS_FOR_ALL_OPERATIONS))) {
|
||||
setTagsForAllOperations = rules.get(SET_TAGS_FOR_ALL_OPERATIONS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,6 +195,8 @@ public class OpenAPINormalizer {
|
||||
*/
|
||||
private void normalizeOperation(Operation operation) {
|
||||
processKeepOnlyFirstTagInOperation(operation);
|
||||
|
||||
processSetTagsForAllOperations(operation);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,11 +329,11 @@ public class OpenAPINormalizer {
|
||||
visitedSchemas.add(schema);
|
||||
}
|
||||
|
||||
if (schema instanceof ArraySchema) {
|
||||
if (schema instanceof ArraySchema) { // array
|
||||
normalizeSchema(schema.getItems(), visitedSchemas);
|
||||
} else if (schema.getAdditionalProperties() instanceof Schema) { // map
|
||||
normalizeSchema((Schema) schema.getAdditionalProperties(), visitedSchemas);
|
||||
} else if (ModelUtils.isComposedSchema(schema)) {
|
||||
} else if (ModelUtils.isComposedSchema(schema)) { // composed schema
|
||||
ComposedSchema cs = (ComposedSchema) schema;
|
||||
|
||||
if (ModelUtils.isComplexComposedSchema(cs)) {
|
||||
@@ -337,6 +365,8 @@ public class OpenAPINormalizer {
|
||||
normalizeSchema(schema.getNot(), visitedSchemas);
|
||||
} else if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
|
||||
normalizeProperties(schema.getProperties(), visitedSchemas);
|
||||
} else if (schema instanceof BooleanSchema) {
|
||||
normalizeBooleanSchema(schema, visitedSchemas);
|
||||
} else if (schema instanceof Schema) {
|
||||
normalizeSchemaWithOnlyProperties(schema, visitedSchemas);
|
||||
} else {
|
||||
@@ -346,6 +376,10 @@ public class OpenAPINormalizer {
|
||||
return schema;
|
||||
}
|
||||
|
||||
private void normalizeBooleanSchema(Schema schema, Set<Schema> visitedSchemas) {
|
||||
processSimplifyBooleanEnum(schema);
|
||||
}
|
||||
|
||||
private void normalizeSchemaWithOnlyProperties(Schema schema, Set<Schema> visitedSchemas) {
|
||||
// normalize non-composed schema (e.g. schema with only properties)
|
||||
}
|
||||
@@ -376,27 +410,36 @@ public class OpenAPINormalizer {
|
||||
|
||||
private Schema normalizeOneOf(Schema schema, Set<Schema> visitedSchemas) {
|
||||
for (Object item : schema.getOneOf()) {
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
if (!(item instanceof Schema)) {
|
||||
throw new RuntimeException("Error! allOf schema is not of the type Schema: " + item);
|
||||
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 (Object item : schema.getAnyOf()) {
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(item instanceof Schema)) {
|
||||
throw new RuntimeException("Error! allOf schema is not of the type Schema: " + item);
|
||||
throw new RuntimeException("Error! anyOf schema is not of the type Schema: " + item);
|
||||
}
|
||||
// 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 processSimplifyAnyOfStringAndEnumString(schema);
|
||||
@@ -469,6 +512,20 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the tag name for all operations
|
||||
*
|
||||
* @param operation Operation
|
||||
*/
|
||||
private void processSetTagsForAllOperations(Operation operation) {
|
||||
if (StringUtils.isEmpty(setTagsForAllOperations)) {
|
||||
return;
|
||||
}
|
||||
|
||||
operation.setTags(null);
|
||||
operation.addTagsItem(setTagsForAllOperations);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the schema contains anyOf/oneOf and properties, remove oneOf/anyOf as these serve as rules to
|
||||
* ensure inter-dependency between properties. It's a workaround as such validation is not supported at the moment.
|
||||
@@ -476,7 +533,6 @@ public class OpenAPINormalizer {
|
||||
* @param schema Schema
|
||||
*/
|
||||
private void processRemoveAnyOfOneOfAndKeepPropertiesOnly(Schema schema) {
|
||||
|
||||
if (!removeAnyOfOneOfAndKeepPropertiesOnly && !enableAll) {
|
||||
return;
|
||||
}
|
||||
@@ -493,7 +549,7 @@ public class OpenAPINormalizer {
|
||||
|
||||
/**
|
||||
* If the schema is anyOf and the sub-schemas are either string or enum of string,
|
||||
* then simply it to just string as many generators do not yet support anyOf.
|
||||
* then simplify it to just string as many generators do not yet support anyOf.
|
||||
*
|
||||
* @param schema Schema
|
||||
* @return Schema
|
||||
@@ -503,6 +559,11 @@ public class OpenAPINormalizer {
|
||||
return schema;
|
||||
}
|
||||
|
||||
if (schema.getAnyOf() == null) {
|
||||
// ComposedSchema, Schema with `type: null`
|
||||
return schema;
|
||||
}
|
||||
|
||||
Schema s0 = null, s1 = null;
|
||||
if (schema.getAnyOf().size() == 2) {
|
||||
s0 = ModelUtils.unaliasSchema(openAPI, (Schema) schema.getAnyOf().get(0));
|
||||
@@ -528,5 +589,91 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the schema is oneOf and the sub-schemas is null, set `nullable: true` instead.
|
||||
* If there's only one sub-schema, simply return the sub-schema directly.
|
||||
*
|
||||
* @param schema Schema
|
||||
* @return Schema
|
||||
*/
|
||||
private Schema processSimplifyOneOf(Schema schema) {
|
||||
if (!simplifyOneOfAnyOf && !enableAll) {
|
||||
return schema;
|
||||
}
|
||||
|
||||
if (schema.getOneOf() != null && !schema.getOneOf().isEmpty()) {
|
||||
// convert null sub-schema to `nullable: true`
|
||||
for (int i = 0; i < schema.getOneOf().size(); i++) {
|
||||
if (schema.getOneOf().get(i) == null || ((Schema) schema.getOneOf().get(i)).getType() == null) {
|
||||
schema.getOneOf().remove(i);
|
||||
schema.setNullable(true);
|
||||
}
|
||||
}
|
||||
|
||||
// if only one element left, simplify to just the element (schema)
|
||||
if (schema.getOneOf().size() == 1) {
|
||||
if (schema.getNullable()) { // retain nullable setting
|
||||
((Schema) schema.getOneOf().get(0)).setNullable(true);
|
||||
}
|
||||
return (Schema) schema.getOneOf().get(0);
|
||||
}
|
||||
}
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the schema is anyOf and the sub-schemas is null, set `nullable: true` instead.
|
||||
* If there's only one sub-schema, simply return the sub-schema directly.
|
||||
*
|
||||
* @param schema Schema
|
||||
* @return Schema
|
||||
*/
|
||||
private Schema processSimplifyAnyOf(Schema schema) {
|
||||
if (!simplifyOneOfAnyOf && !enableAll) {
|
||||
return schema;
|
||||
}
|
||||
|
||||
if (schema.getAnyOf() != null && !schema.getAnyOf().isEmpty()) {
|
||||
// convert null sub-schema to `nullable: true`
|
||||
for (int i = 0; i < schema.getAnyOf().size(); i++) {
|
||||
if (schema.getAnyOf().get(i) == null || ((Schema) schema.getAnyOf().get(i)).getType() == null) {
|
||||
schema.getAnyOf().remove(i);
|
||||
schema.setNullable(true);
|
||||
}
|
||||
}
|
||||
|
||||
// if only one element left, simplify to just the element (schema)
|
||||
if (schema.getAnyOf().size() == 1) {
|
||||
if (schema.getNullable()) { // retain nullable setting
|
||||
((Schema) schema.getAnyOf().get(0)).setNullable(true);
|
||||
}
|
||||
return (Schema) schema.getAnyOf().get(0);
|
||||
}
|
||||
}
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the schema is boolean and its enum is defined,
|
||||
* then simply it to just boolean.
|
||||
*
|
||||
* @param schema Schema
|
||||
* @return Schema
|
||||
*/
|
||||
private void processSimplifyBooleanEnum(Schema schema) {
|
||||
if (!simplifyBooleanEnum && !enableAll) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (schema instanceof BooleanSchema) {
|
||||
BooleanSchema bs = (BooleanSchema) schema;
|
||||
if (bs.getEnum() != null && !bs.getEnum().isEmpty()) { // enum defined
|
||||
bs.setEnum(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===================== end of rules =====================
|
||||
}
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
package org.openapitools.codegen.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import io.swagger.parser.OpenAPIParser;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.parser.core.models.ParseOptions;
|
||||
|
||||
public class MergedSpecBuilder {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MergedSpecBuilder.class);
|
||||
|
||||
private final String inputSpecRootDirectory;
|
||||
private final String mergeFileName;
|
||||
|
||||
public MergedSpecBuilder(final String rootDirectory, final String mergeFileName) {
|
||||
this.inputSpecRootDirectory = rootDirectory;
|
||||
this.mergeFileName = mergeFileName;
|
||||
}
|
||||
|
||||
public String buildMergedSpec() {
|
||||
deleteMergedFileFromPreviousRun();
|
||||
List<String> specRelatedPaths = getAllSpecFilesInDirectory();
|
||||
if (specRelatedPaths.isEmpty()) {
|
||||
throw new RuntimeException("Spec directory doesn't contains any specification");
|
||||
}
|
||||
LOGGER.info("In spec root directory {} found specs {}", inputSpecRootDirectory, specRelatedPaths);
|
||||
|
||||
String openapiVersion = null;
|
||||
boolean isJson = false;
|
||||
ParseOptions options = new ParseOptions();
|
||||
options.setResolve(true);
|
||||
List<SpecWithPaths> allPaths = new ArrayList<>();
|
||||
|
||||
for (String specRelatedPath : specRelatedPaths) {
|
||||
String specPath = inputSpecRootDirectory + File.separator + specRelatedPath;
|
||||
try {
|
||||
LOGGER.info("Reading spec: {}", specPath);
|
||||
|
||||
OpenAPI result = new OpenAPIParser()
|
||||
.readLocation(specPath, new ArrayList<>(), options)
|
||||
.getOpenAPI();
|
||||
|
||||
if (openapiVersion == null) {
|
||||
openapiVersion = result.getOpenapi();
|
||||
if (specRelatedPath.toLowerCase(Locale.ROOT).endsWith(".json")) {
|
||||
isJson = true;
|
||||
}
|
||||
}
|
||||
allPaths.add(new SpecWithPaths(specRelatedPath, result.getPaths().keySet()));
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Failed to read file: {}. It would be ignored", specPath);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> mergedSpec = generatedMergedSpec(openapiVersion, allPaths);
|
||||
String mergedFilename = this.mergeFileName + (isJson ? ".json" : ".yaml");
|
||||
Path mergedFilePath = Paths.get(inputSpecRootDirectory, mergedFilename);
|
||||
|
||||
try {
|
||||
ObjectMapper objectMapper = isJson ? new ObjectMapper() : new ObjectMapper(new YAMLFactory());
|
||||
Files.write(mergedFilePath, objectMapper.writeValueAsBytes(mergedSpec), StandardOpenOption.CREATE, StandardOpenOption.WRITE);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return mergedFilePath.toString();
|
||||
}
|
||||
|
||||
private static Map<String, Object> generatedMergedSpec(String openapiVersion, List<SpecWithPaths> allPaths) {
|
||||
Map<String, Object> spec = generateHeader(openapiVersion);
|
||||
Map<String, Object> paths = new HashMap<>();
|
||||
spec.put("paths", paths);
|
||||
|
||||
for(SpecWithPaths specWithPaths : allPaths) {
|
||||
for (String path : specWithPaths.paths) {
|
||||
String specRelatedPath = "./" + specWithPaths.specRelatedPath + "#/paths/" + path.replace("/", "~1");
|
||||
paths.put(path, ImmutableMap.of(
|
||||
"$ref", specRelatedPath
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return spec;
|
||||
}
|
||||
|
||||
private static Map<String, Object> generateHeader(String openapiVersion) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("openapi", openapiVersion);
|
||||
map.put("info", ImmutableMap.of(
|
||||
"title", "merged spec",
|
||||
"description", "merged spec",
|
||||
"version", "1.0.0"
|
||||
));
|
||||
map.put("servers", Collections.singleton(
|
||||
ImmutableMap.of("url", "http://localhost:8080")
|
||||
));
|
||||
return map;
|
||||
}
|
||||
|
||||
private List<String> getAllSpecFilesInDirectory() {
|
||||
Path rootDirectory = new File(inputSpecRootDirectory).toPath();
|
||||
try {
|
||||
return Files.walk(rootDirectory)
|
||||
.filter(path -> !Files.isDirectory(path))
|
||||
.map(path -> rootDirectory.relativize(path).toString())
|
||||
.collect(Collectors.toList());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Exception while listing files in spec root directory: " + inputSpecRootDirectory, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteMergedFileFromPreviousRun() {
|
||||
try {
|
||||
Files.deleteIfExists(Paths.get(inputSpecRootDirectory + File.separator + mergeFileName + ".json"));
|
||||
} catch (IOException e) { }
|
||||
try {
|
||||
Files.deleteIfExists(Paths.get(inputSpecRootDirectory + File.separator + mergeFileName + ".yaml"));
|
||||
} catch (IOException e) { }
|
||||
}
|
||||
|
||||
private static class SpecWithPaths {
|
||||
private final String specRelatedPath;
|
||||
private final Set<String> paths;
|
||||
|
||||
private SpecWithPaths(final String specRelatedPath, final Set<String> paths) {
|
||||
this.specRelatedPath = specRelatedPath;
|
||||
this.paths = paths;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
|
||||
@@ -85,6 +85,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
public static final String IMPLICIT_HEADERS_REGEX = "implicitHeadersRegex";
|
||||
public static final String JAVAX_PACKAGE = "javaxPackage";
|
||||
public static final String USE_JAKARTA_EE = "useJakartaEe";
|
||||
public static final String CONTAINER_DEFAULT_TO_NULL = "containerDefaultToNull";
|
||||
|
||||
public static final String CAMEL_CASE_DOLLAR_SIGN = "camelCaseDollarSign";
|
||||
|
||||
@@ -137,9 +138,9 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
protected AnnotationLibrary annotationLibrary;
|
||||
protected boolean implicitHeaders = false;
|
||||
protected String implicitHeadersRegex = null;
|
||||
|
||||
protected boolean camelCaseDollarSign = false;
|
||||
protected boolean useJakartaEe = false;
|
||||
protected boolean containerDefaultToNull = false;
|
||||
|
||||
private Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
|
||||
|
||||
@@ -276,6 +277,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
cliOptions.add(CliOption.newString(IMPLICIT_HEADERS_REGEX, "Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true"));
|
||||
cliOptions.add(CliOption.newBoolean(CAMEL_CASE_DOLLAR_SIGN, "Fix camelCase when starting with $ sign. when true : $Value when false : $value"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_JAKARTA_EE, "whether to use Jakarta EE namespace instead of javax"));
|
||||
cliOptions.add(CliOption.newBoolean(CONTAINER_DEFAULT_TO_NULL, "Set containers (array, set, map) default to null"));
|
||||
|
||||
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC));
|
||||
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC));
|
||||
@@ -686,6 +688,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
} else {
|
||||
applyJavaxPackage();
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CONTAINER_DEFAULT_TO_NULL)) {
|
||||
this.setContainerDefaultToNull(Boolean.parseBoolean(additionalProperties.get(CONTAINER_DEFAULT_TO_NULL).toString()));
|
||||
}
|
||||
additionalProperties.put(CONTAINER_DEFAULT_TO_NULL, containerDefaultToNull);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -966,20 +973,98 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default value of array property
|
||||
* <p>
|
||||
* Return null if there's no default value.
|
||||
* Any non-null value will cause {{#defaultValue} check to pass.
|
||||
*
|
||||
* @param cp Codegen property
|
||||
* @param schema Property schema
|
||||
* @return string presentation of the default value of the property
|
||||
*/
|
||||
public String toArrayDefaultValue(CodegenProperty cp, Schema schema) {
|
||||
if (schema.getDefault() != null) { // has default value
|
||||
if (cp.isArray && !cp.getUniqueItems()) { // array
|
||||
List<String> _values = new ArrayList<>();
|
||||
|
||||
if (schema.getDefault() instanceof ArrayNode) { // array of default values
|
||||
ArrayNode _default = (ArrayNode) schema.getDefault();
|
||||
if (_default.isEmpty()) {
|
||||
return "null";
|
||||
}
|
||||
|
||||
List<String> final_values = _values;
|
||||
_default.elements().forEachRemaining((element) -> {
|
||||
final_values.add(element.asText());
|
||||
});
|
||||
} else { // single value
|
||||
_values = java.util.Collections.singletonList(String.valueOf(schema.getDefault()));
|
||||
}
|
||||
|
||||
String defaultValue = "";
|
||||
|
||||
if (cp.items.getIsEnumOrRef()) { // inline or ref enum
|
||||
List<String> defaultValues = new ArrayList<>();
|
||||
for (String _value : _values) {
|
||||
defaultValues.add(cp.items.datatypeWithEnum + "." + toEnumVarName(_value, cp.items.dataType));
|
||||
}
|
||||
defaultValue = StringUtils.join(defaultValues, ", ");
|
||||
} else {
|
||||
if (cp.items.isString) { // array item is string
|
||||
defaultValue = String.format(Locale.ROOT, "\"%s\"", StringUtils.join(_values, "\", \""));
|
||||
} else if (cp.items.isNumeric) {
|
||||
defaultValue = _values.stream()
|
||||
.map(v -> {
|
||||
if ("BigInteger".equals(cp.items.dataType)) {
|
||||
return "new BigInteger(\"" + v + "\")";
|
||||
} else if ("BigDecimal".equals(cp.items.dataType)) {
|
||||
return "new BigDecimal(\"" + v + "\")";
|
||||
} else if (cp.items.isFloat) {
|
||||
return v + "f";
|
||||
} else {
|
||||
return v;
|
||||
}
|
||||
})
|
||||
.collect(Collectors.joining(", "));
|
||||
} else { // array item is non-string, e.g. integer
|
||||
defaultValue = StringUtils.join(_values, ", ");
|
||||
}
|
||||
}
|
||||
return String.format(Locale.ROOT, "new ArrayList<>(Arrays.asList(%s))", defaultValue);
|
||||
} else if (cp.isArray && cp.getUniqueItems()) { // set
|
||||
// TODO
|
||||
return null;
|
||||
} else if (cp.isMap) { // map
|
||||
// TODO
|
||||
return null;
|
||||
} else {
|
||||
throw new RuntimeException("Error. Codegen Property must be array/set/map: " + cp);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDefaultValue(Schema schema) {
|
||||
public String toDefaultValue(CodegenProperty cp, Schema schema) {
|
||||
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
|
||||
if (ModelUtils.isArraySchema(schema)) {
|
||||
final String pattern;
|
||||
if (ModelUtils.isSet(schema)) {
|
||||
String mapInstantiationType = instantiationTypes().getOrDefault("set", "LinkedHashSet");
|
||||
pattern = "new " + mapInstantiationType + "<%s>()";
|
||||
} else {
|
||||
String arrInstantiationType = instantiationTypes().getOrDefault("array", "ArrayList");
|
||||
pattern = "new " + arrInstantiationType + "<%s>()";
|
||||
if (schema.getDefault() == null) {
|
||||
if (cp.isNullable || containerDefaultToNull) { // nullable or containerDefaultToNull set to true
|
||||
return null;
|
||||
} else {
|
||||
if (ModelUtils.isSet(schema)) {
|
||||
return String.format(Locale.ROOT, "new %s<>()",
|
||||
instantiationTypes().getOrDefault("set", "LinkedHashSet"));
|
||||
} else {
|
||||
return String.format(Locale.ROOT, "new %s<>()",
|
||||
instantiationTypes().getOrDefault("array", "ArrayList"));
|
||||
}
|
||||
}
|
||||
} else { // has default value
|
||||
return toArrayDefaultValue(cp, schema);
|
||||
}
|
||||
|
||||
return String.format(Locale.ROOT, pattern, "");
|
||||
} else if (ModelUtils.isMapSchema(schema) && !(schema instanceof ComposedSchema)) {
|
||||
if (schema.getProperties() != null && schema.getProperties().size() > 0) {
|
||||
// object is complex object with free-form additional properties
|
||||
@@ -989,14 +1074,16 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
return null;
|
||||
}
|
||||
|
||||
String mapInstantiationType = instantiationTypes().getOrDefault("map", "HashMap");
|
||||
final String pattern = "new " + mapInstantiationType + "<%s>()";
|
||||
if (cp.isNullable || containerDefaultToNull) { // nullable or containerDefaultToNull set to true
|
||||
return null;
|
||||
}
|
||||
|
||||
if (getAdditionalProperties(schema) == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return String.format(Locale.ROOT, pattern, "");
|
||||
return String.format(Locale.ROOT, "new %s<>()",
|
||||
instantiationTypes().getOrDefault("map", "HashMap"));
|
||||
} else if (ModelUtils.isIntegerSchema(schema)) {
|
||||
if (schema.getDefault() != null) {
|
||||
if (SchemaTypeUtil.INTEGER64_FORMAT.equals(schema.getFormat())) {
|
||||
@@ -1090,11 +1177,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
if (defaultValue instanceof ArrayNode) {
|
||||
ArrayNode array = (ArrayNode) defaultValue;
|
||||
return StreamSupport.stream(array.spliterator(), false)
|
||||
.map(JsonNode::toString)
|
||||
// remove wrapper quotes
|
||||
.map(item -> StringUtils.removeStart(item, "\""))
|
||||
.map(item -> StringUtils.removeEnd(item, "\""))
|
||||
.collect(Collectors.joining(","));
|
||||
.map(JsonNode::toString)
|
||||
// remove wrapper quotes
|
||||
.map(item -> StringUtils.removeStart(item, "\""))
|
||||
.map(item -> StringUtils.removeEnd(item, "\""))
|
||||
.collect(Collectors.joining(","));
|
||||
}
|
||||
}
|
||||
// escape quotes
|
||||
@@ -1469,6 +1556,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
OperationMap operations = objs.getOperations();
|
||||
List<CodegenOperation> operationList = operations.getOperation();
|
||||
for (CodegenOperation op : operationList) {
|
||||
// check if the operation has form parameters
|
||||
if (op.getHasFormParams()) {
|
||||
additionalProperties.put("hasFormParamsInSpec", true);
|
||||
}
|
||||
Collection<String> operationImports = new ConcurrentSkipListSet<>();
|
||||
for (CodegenParameter p : op.allParams) {
|
||||
if (importMapping.containsKey(p.dataType)) {
|
||||
@@ -1479,6 +1570,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
|
||||
handleImplicitHeaders(op);
|
||||
}
|
||||
|
||||
return objs;
|
||||
}
|
||||
|
||||
@@ -1963,6 +2055,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
this.useJakartaEe = useJakartaEe;
|
||||
}
|
||||
|
||||
public void setContainerDefaultToNull(boolean containerDefaultToNull) {
|
||||
this.containerDefaultToNull = containerDefaultToNull;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeQuotationMark(String input) {
|
||||
// remove " to avoid code injection
|
||||
@@ -2154,8 +2250,9 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
|
||||
/**
|
||||
* Search for property by {@link CodegenProperty#name}
|
||||
* @param name - name to search for
|
||||
* @param properties - list of properties
|
||||
*
|
||||
* @param name name to search for
|
||||
* @param properties list of properties
|
||||
* @return either found property or {@link Optional#empty()} if nothing has been found
|
||||
*/
|
||||
protected Optional<CodegenProperty> findByName(String name, List<CodegenProperty> properties) {
|
||||
@@ -2164,8 +2261,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
|
||||
return properties.stream()
|
||||
.filter(p -> p.name.equals(name))
|
||||
.findFirst();
|
||||
.filter(p -> p.name.equals(name))
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2207,6 +2304,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VendorExtension> getSupportedVendorExtensions() {
|
||||
List<VendorExtension> extensions = super.getSupportedVendorExtensions();
|
||||
@@ -2232,6 +2330,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
return addImports;
|
||||
}
|
||||
|
||||
public static void addImports(List<Map<String, String>> imports, CodegenModel cm, Map<String, String> imports2Classnames) {
|
||||
for (Map.Entry<String, String> entry : imports2Classnames.entrySet()) {
|
||||
cm.imports.add(entry.getKey());
|
||||
|
||||
@@ -0,0 +1,527 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.ClientModificationFeature;
|
||||
import org.openapitools.codegen.meta.features.ClientModificationFeature;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
import org.openapitools.codegen.meta.features.GlobalFeature;
|
||||
import org.openapitools.codegen.meta.features.ParameterFeature;
|
||||
import org.openapitools.codegen.meta.features.SchemaSupportFeature;
|
||||
import org.openapitools.codegen.meta.features.SecurityFeature;
|
||||
import org.openapitools.codegen.meta.features.WireFormatFeature;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
import org.openapitools.codegen.utils.CamelizeOption;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache.Lambda;
|
||||
import org.openapitools.codegen.templating.mustache.EscapeChar;
|
||||
|
||||
public abstract class AbstractJuliaCodegen extends DefaultCodegen {
|
||||
protected final Logger LOGGER = LoggerFactory.getLogger(AbstractJuliaCodegen.class);
|
||||
|
||||
protected String srcPath = "src";
|
||||
protected String apiSrcPath = srcPath + "/apis/";
|
||||
protected String modelSrcPath = srcPath + "/models/";
|
||||
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
|
||||
protected String packageName;
|
||||
protected Boolean exportModels;
|
||||
protected Boolean exportOperations;
|
||||
|
||||
public AbstractJuliaCodegen() {
|
||||
super();
|
||||
|
||||
modifyFeatureSet(features -> features
|
||||
.includeDocumentationFeatures(DocumentationFeature.Readme)
|
||||
.includeSchemaSupportFeatures(
|
||||
SchemaSupportFeature.Union, SchemaSupportFeature.allOf,
|
||||
SchemaSupportFeature.anyOf, SchemaSupportFeature.oneOf
|
||||
)
|
||||
.excludeWireFormatFeatures(
|
||||
WireFormatFeature.XML
|
||||
)
|
||||
.excludeSecurityFeatures(
|
||||
SecurityFeature.OAuth2_Implicit, SecurityFeature.OAuth2_Password,
|
||||
SecurityFeature.OAuth2_ClientCredentials, SecurityFeature.OAuth2_AuthorizationCode
|
||||
)
|
||||
.excludeParameterFeatures(
|
||||
ParameterFeature.Cookie
|
||||
)
|
||||
.excludeGlobalFeatures(
|
||||
GlobalFeature.Callbacks, GlobalFeature.Examples,
|
||||
GlobalFeature.Produces, GlobalFeature.Consumes
|
||||
)
|
||||
.includeClientModificationFeatures(
|
||||
ClientModificationFeature.BasePath, ClientModificationFeature.UserAgent
|
||||
)
|
||||
);
|
||||
|
||||
reservedWords = new HashSet<String>(
|
||||
Arrays.asList(
|
||||
"if", "else", "elseif", "while", "for", "begin", "end", "quote",
|
||||
"try", "catch", "return", "local", "function", "macro", "ccall", "finally", "break", "continue",
|
||||
"global", "module", "using", "import", "export", "const", "let", "do", "baremodule",
|
||||
"Type", "Enum", "Any", "DataType", "Base"
|
||||
)
|
||||
);
|
||||
|
||||
// Language Specific Primitives. These types will not trigger imports by the client generator
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
Arrays.asList("Integer", "Int128", "Int64", "Int32", "Int16", "Int8", "UInt128", "UInt64", "UInt32", "UInt16", "UInt8", "Float64", "Float32", "Float16", "Char", "Vector", "Dict", "Vector{UInt8}", "Bool", "String", "Date", "DateTime", "ZonedDateTime", "Nothing", "Any")
|
||||
);
|
||||
|
||||
typeMapping.clear();
|
||||
typeMapping.put("int", "Int64");
|
||||
typeMapping.put("integer", "Int64");
|
||||
typeMapping.put("long", "Int64");
|
||||
typeMapping.put("short", "Int32");
|
||||
typeMapping.put("byte", "UInt8");
|
||||
typeMapping.put("float", "Float32");
|
||||
typeMapping.put("double", "Float64");
|
||||
typeMapping.put("string", "String");
|
||||
typeMapping.put("char", "String");
|
||||
typeMapping.put("binary", "Vector{UInt8}");
|
||||
typeMapping.put("boolean", "Bool");
|
||||
typeMapping.put("number", "Float64");
|
||||
typeMapping.put("decimal", "Float64");
|
||||
typeMapping.put("array", "Vector");
|
||||
typeMapping.put("set", "Vector");
|
||||
typeMapping.put("map", "Dict");
|
||||
typeMapping.put("date", "Date");
|
||||
typeMapping.put("DateTime", "ZonedDateTime");
|
||||
typeMapping.put("File", "String");
|
||||
typeMapping.put("file", "String");
|
||||
typeMapping.put("UUID", "String");
|
||||
typeMapping.put("URI", "String");
|
||||
typeMapping.put("ByteArray", "Vector{UInt8}");
|
||||
typeMapping.put("object", "Any");
|
||||
typeMapping.put("Object", "Any");
|
||||
typeMapping.put("AnyType", "Any");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratorLanguage generatorLanguage() {
|
||||
return GeneratorLanguage.JULIA;
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public void setExportModels(Boolean exportModels) {
|
||||
this.exportModels = exportModels;
|
||||
}
|
||||
|
||||
public void setExportOperations(Boolean exportOperations) {
|
||||
this.exportOperations = exportOperations;
|
||||
}
|
||||
|
||||
protected static String dropDots(String str) {
|
||||
return str.replaceAll("\\.", "_");
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a reserved word as defined in the `reservedWords` array. Handle escaping
|
||||
* those terms here. This logic is only called if a variable matches the reseved words
|
||||
*
|
||||
* @return the escaped term
|
||||
*/
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
if (reservedWords.contains(name)) {
|
||||
return "__" + name + "__"; // add underscores to reserved words, and also to obscure it to lessen chances of clashing with any other names
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Location to write model files.
|
||||
*/
|
||||
@Override
|
||||
public String modelFileFolder() {
|
||||
return (outputFolder + "/" + modelSrcPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Location to write api files.
|
||||
*/
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return (outputFolder + "/" + apiSrcPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelFilename(String name) {
|
||||
return "model_" + toModelName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiFilename(String name) {
|
||||
name = name.replaceAll("-", "_");
|
||||
return "api_" + camelize(name) + "Api";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiName(String name) {
|
||||
if (name.length() == 0) {
|
||||
return "DefaultApi";
|
||||
}
|
||||
// e.g. phone_number_api => PhoneNumberApi
|
||||
return camelize(name) + "Api";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toParamName(String name) {
|
||||
CamelizeOption camelizeOption = CamelizeOption.UPPERCASE_FIRST_CHAR;
|
||||
name = camelize(sanitizeName(name), camelizeOption);
|
||||
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||
return escapeReservedWord(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiVarName(String name) {
|
||||
CamelizeOption camelizeOption = CamelizeOption.UPPERCASE_FIRST_CHAR;
|
||||
name = camelize(sanitizeName(name), camelizeOption);
|
||||
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||
return escapeReservedWord(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toVarName(String name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize name (parameter, property, method, etc)
|
||||
*
|
||||
* @param name string to be sanitize
|
||||
* @return sanitized string
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public String sanitizeName(String name) {
|
||||
if (name == null) {
|
||||
LOGGER.error("String to be sanitized is null. Default to ERROR_UNKNOWN");
|
||||
return "ERROR_UNKNOWN";
|
||||
}
|
||||
|
||||
// if the name is just '$', map it to 'value', as that's sometimes used in the spec
|
||||
if ("$".equals(name)) {
|
||||
return "value";
|
||||
}
|
||||
|
||||
name = name.replaceAll("\\[\\]", "");
|
||||
name = name.replaceAll("\\[", "_");
|
||||
name = name.replaceAll("\\]", "");
|
||||
name = name.replaceAll("\\(", "_");
|
||||
name = name.replaceAll("\\)", "");
|
||||
name = name.replaceAll("\\.", "_");
|
||||
name = name.replaceAll("-", "_");
|
||||
name = name.replaceAll(" ", "_");
|
||||
name = name.replaceAll("/", "_");
|
||||
return name.replaceAll("[^a-zA-Z0-9_{}]", "");
|
||||
}
|
||||
|
||||
protected boolean needsVarEscape(String name) {
|
||||
return (!name.matches("[a-zA-Z0-9_]*") && !name.matches("var\".*\"")) || reservedWords.contains(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the proper Julia model name.
|
||||
*
|
||||
* @param name the name of the model
|
||||
* @return Julia model name
|
||||
*/
|
||||
@Override
|
||||
public String toModelName(final String name) {
|
||||
String result = sanitizeName(name);
|
||||
|
||||
// remove dollar sign
|
||||
result = result.replaceAll("$", "");
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(result)) {
|
||||
LOGGER.warn(result + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + result));
|
||||
result = "model_" + result; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (result.matches("^\\d.*")) {
|
||||
LOGGER.warn(result + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + result));
|
||||
result = "model_" + result; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(modelNamePrefix)) {
|
||||
result = modelNamePrefix + "_" + result;
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(modelNameSuffix)) {
|
||||
result = result + "_" + modelNameSuffix;
|
||||
}
|
||||
|
||||
result = dropDots(result);
|
||||
// camelize the model name
|
||||
// phone_number => PhoneNumber
|
||||
result = camelize(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Schema schema) {
|
||||
if (ModelUtils.isArraySchema(schema)) {
|
||||
ArraySchema ap = (ArraySchema) schema;
|
||||
Schema inner = ap.getItems();
|
||||
return getSchemaType(schema) + "{" + getTypeDeclaration(inner) + "}";
|
||||
} else if (ModelUtils.isSet(schema)) {
|
||||
Schema inner = getAdditionalProperties(schema);
|
||||
return getSchemaType(schema) + "{" + getTypeDeclaration(inner) + "}";
|
||||
} else if (ModelUtils.isMapSchema(schema)) {
|
||||
Schema inner = getAdditionalProperties(schema);
|
||||
return getSchemaType(schema) + "{String, " + getTypeDeclaration(inner) + "}";
|
||||
}
|
||||
return super.getTypeDeclaration(schema);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the type declaration for a given schema
|
||||
*
|
||||
* @param schema the schema
|
||||
* @return the type declaration
|
||||
*/
|
||||
@Override
|
||||
public String getSchemaType(Schema schema) {
|
||||
String openAPIType = super.getSchemaType(schema);
|
||||
String type = null;
|
||||
|
||||
if (openAPIType == null) {
|
||||
LOGGER.error("OpenAPI Type for {} is null. Default to Object instead.", schema.getName());
|
||||
openAPIType = "Object";
|
||||
}
|
||||
|
||||
if (typeMapping.containsKey(openAPIType)) {
|
||||
type = typeMapping.get(openAPIType);
|
||||
if (languageSpecificPrimitives.contains(type)) {
|
||||
return type;
|
||||
}
|
||||
} else {
|
||||
type = openAPIType;
|
||||
}
|
||||
|
||||
return toModelName(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default value of the property
|
||||
*
|
||||
* @param schema OpenAPI property object
|
||||
* @return string presentation of the default value of the property
|
||||
*/
|
||||
@Override
|
||||
public String toDefaultValue(Schema schema) {
|
||||
if (ModelUtils.isBooleanSchema(schema)) {
|
||||
if (schema.getDefault() != null) {
|
||||
return schema.getDefault().toString();
|
||||
}
|
||||
} else if (ModelUtils.isDateSchema(schema)) {
|
||||
// TODO
|
||||
} else if (ModelUtils.isDateTimeSchema(schema)) {
|
||||
// TODO
|
||||
} else if (ModelUtils.isIntegerSchema(schema) || ModelUtils.isLongSchema(schema) || ModelUtils.isNumberSchema(schema)) {
|
||||
if (schema.getDefault() != null) {
|
||||
return schema.getDefault().toString();
|
||||
}
|
||||
} else if (ModelUtils.isStringSchema(schema)) {
|
||||
if (schema.getDefault() != null) {
|
||||
String _default = (String) schema.getDefault();
|
||||
if (schema.getEnum() == null) {
|
||||
return "\"" + _default + "\"";
|
||||
} else {
|
||||
// convert to enum var name later in postProcessModels
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "nothing";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeUnsafeCharacters(String input) {
|
||||
return input.replace("#=", "#_=").replace("=#", "=_#");
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape single and/or double quote to avoid code injection
|
||||
*
|
||||
* @param input String to be cleaned up
|
||||
* @return string with quotation mark removed or escaped
|
||||
*/
|
||||
public String escapeQuotationMark(String input) {
|
||||
return input.replace("\"", "\\\"");
|
||||
}
|
||||
|
||||
protected String escapeRegex(String pattern) {
|
||||
pattern = pattern.replaceAll("\\\\\\\\", "\\\\");
|
||||
pattern = pattern.replaceAll("^/", "");
|
||||
pattern = pattern.replaceAll("/$", "");
|
||||
return pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert OpenAPI Parameter object to Codegen Parameter object
|
||||
*
|
||||
* @param imports set of imports for library/package/module
|
||||
* @param param OpenAPI parameter object
|
||||
* @return Codegen Parameter object
|
||||
*/
|
||||
@Override
|
||||
public CodegenParameter fromParameter(Parameter param, Set<String> imports) {
|
||||
CodegenParameter parameter = super.fromParameter(param, imports);
|
||||
if (parameter.pattern != null) {
|
||||
parameter.pattern = escapeRegex(parameter.pattern);
|
||||
}
|
||||
return parameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert OAS Property schema to Codegen Property object.
|
||||
* <p>
|
||||
* The return value is cached. An internal cache is looked up to determine
|
||||
* if the CodegenProperty return value has already been instantiated for
|
||||
* the (String name, Schema schema) arguments.
|
||||
* Any subsequent processing of the CodegenModel return value must be idempotent
|
||||
* for a given (String name, Schema schema).
|
||||
*
|
||||
* @param name name of the property
|
||||
* @param schema OAS property schema
|
||||
* @param required true if the property is required in the next higher object schema, false otherwise
|
||||
* @return Codegen Property object
|
||||
*/
|
||||
@Override
|
||||
public CodegenProperty fromProperty(String name, Schema schema, boolean required) {
|
||||
CodegenProperty property = super.fromProperty(name, schema, required);
|
||||
// if the name needs any escaping, we set it to var"name"
|
||||
if (needsVarEscape(property.name)) {
|
||||
property.name = "var\"" + property.name + "\"";
|
||||
}
|
||||
if (property.pattern != null) {
|
||||
property.pattern = escapeRegex(property.pattern);
|
||||
}
|
||||
return property;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the operation ID (method name)
|
||||
*
|
||||
* @param operationId operation ID
|
||||
* @return the sanitized method name
|
||||
*/
|
||||
@SuppressWarnings("static-method")
|
||||
public String toOperationId(String operationId) {
|
||||
CamelizeOption camelizeOption = CamelizeOption.UPPERCASE_FIRST_CHAR;
|
||||
operationId = camelize(super.toOperationId(operationId), camelizeOption);
|
||||
operationId = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, operationId);
|
||||
return sanitizeName(operationId);
|
||||
}
|
||||
|
||||
private void changeParamNames(List<CodegenParameter> paramsList, HashSet<String> reservedNames) {
|
||||
// check if any param name clashes with type name and rename it
|
||||
for (CodegenParameter param : paramsList) {
|
||||
if (reservedNames.contains(param.paramName)) {
|
||||
do {
|
||||
param.paramName = param.paramName + "_";
|
||||
} while (reservedNames.contains(param.paramName + "param"));
|
||||
param.paramName = param.paramName + "param";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert OAS Operation object to Codegen Operation object
|
||||
*
|
||||
* @param httpMethod HTTP method
|
||||
* @param operation OAS operation object
|
||||
* @param path the path of the operation
|
||||
* @param servers list of servers
|
||||
* @return Codegen Operation object
|
||||
*/
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path,
|
||||
String httpMethod,
|
||||
Operation operation,
|
||||
List<Server> servers) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers);
|
||||
|
||||
// collect all reserved names
|
||||
HashSet<String> reservedNames = new HashSet<String>();
|
||||
reservedNames.add(op.returnType);
|
||||
reservedNames.add(op.operationId);
|
||||
for (CodegenParameter param : op.allParams) {
|
||||
reservedNames.add(param.dataType);
|
||||
}
|
||||
|
||||
changeParamNames(op.allParams, reservedNames);
|
||||
changeParamNames(op.bodyParams, reservedNames);
|
||||
changeParamNames(op.headerParams, reservedNames);
|
||||
changeParamNames(op.pathParams, reservedNames);
|
||||
changeParamNames(op.queryParams, reservedNames);
|
||||
changeParamNames(op.formParams, reservedNames);
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ImmutableMap.Builder<String, Lambda> addMustacheLambdas() {
|
||||
return super.addMustacheLambdas()
|
||||
.put("escapeDollar", new EscapeChar("(?<!\\\\)\\$", "\\\\\\$"));
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,9 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
public static final String MODEL_MUTABLE_DESC = "Create mutable models";
|
||||
public static final String ADDITIONAL_MODEL_TYPE_ANNOTATIONS = "additionalModelTypeAnnotations";
|
||||
|
||||
public static final String JAVAX_PACKAGE = "javaxPackage";
|
||||
public static final String USE_JAKARTA_EE = "useJakartaEe";
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractKotlinCodegen.class);
|
||||
|
||||
protected String artifactId;
|
||||
@@ -69,6 +72,8 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
protected boolean parcelizeModels = false;
|
||||
protected boolean serializableModel = false;
|
||||
|
||||
protected boolean useJakartaEe = false;
|
||||
|
||||
protected boolean nonPublicApi = false;
|
||||
|
||||
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase;
|
||||
@@ -544,6 +549,17 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
typeMapping.put("set", "kotlin.collections.MutableSet");
|
||||
typeMapping.put("map", "kotlin.collections.MutableMap");
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(USE_JAKARTA_EE)) {
|
||||
setUseJakartaEe(Boolean.TRUE.equals(additionalProperties.get(USE_JAKARTA_EE)));
|
||||
}
|
||||
additionalProperties.put(USE_JAKARTA_EE, useJakartaEe);
|
||||
|
||||
if (useJakartaEe) {
|
||||
applyJakartaPackage();
|
||||
} else {
|
||||
applyJavaxPackage();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isModelMutable() {
|
||||
@@ -594,6 +610,10 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
this.serializableModel = serializableModel;
|
||||
}
|
||||
|
||||
public void setUseJakartaEe(boolean useJakartaEe) {
|
||||
this.useJakartaEe = useJakartaEe;
|
||||
}
|
||||
|
||||
public boolean nonPublicApi() {
|
||||
return nonPublicApi;
|
||||
}
|
||||
@@ -842,6 +862,14 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
return input.substring(0, 1).toUpperCase(Locale.ROOT) + input.substring(1);
|
||||
}
|
||||
|
||||
protected void applyJavaxPackage() {
|
||||
writePropertyBack(JAVAX_PACKAGE, "javax");
|
||||
}
|
||||
|
||||
protected void applyJakartaPackage() {
|
||||
writePropertyBack(JAVAX_PACKAGE, "jakarta");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isReservedWord(String word) {
|
||||
// We want case-sensitive escaping, to avoid unnecessary backtick-escaping.
|
||||
|
||||
@@ -31,6 +31,8 @@ import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenConfig {
|
||||
public static final String OPTIONAL_PROJECT_FILE_DESC = "Generate client.pri.";
|
||||
public static final String DEFAULT_PACKAGE_NAME = "QtOpenAPIClient";
|
||||
protected String packageName = "";
|
||||
// source folder where to write the files
|
||||
protected String sourceFolder = "client";
|
||||
protected boolean optionalProjectFileFlag = true;
|
||||
@@ -89,7 +91,10 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
|
||||
*/
|
||||
embeddedTemplateDir = templateDir = "cpp-qt-client";
|
||||
|
||||
// CLI options
|
||||
addOption(CodegenConstants.PACKAGE_NAME, "C++ package (library) name.", DEFAULT_PACKAGE_NAME);
|
||||
addSwitch(CodegenConstants.OPTIONAL_PROJECT_FILE, OPTIONAL_PROJECT_FILE_DESC, this.optionalProjectFileFlag);
|
||||
|
||||
supportingFiles.add(new SupportingFile("helpers-header.mustache", sourceFolder, PREFIX + "Helpers.h"));
|
||||
supportingFiles.add(new SupportingFile("helpers-body.mustache", sourceFolder, PREFIX + "Helpers.cpp"));
|
||||
supportingFiles.add(new SupportingFile("HttpRequest.h.mustache", sourceFolder, PREFIX + "HttpRequest.h"));
|
||||
@@ -103,6 +108,7 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
|
||||
supportingFiles.add(new SupportingFile("oauth.cpp.mustache", sourceFolder, PREFIX + "Oauth.cpp"));
|
||||
supportingFiles.add(new SupportingFile("oauth.h.mustache", sourceFolder, PREFIX + "Oauth.h"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("CMakeConfig.mustache", sourceFolder, "Config.cmake.in"));
|
||||
supportingFiles.add(new SupportingFile("CMakeLists.txt.mustache", sourceFolder, "CMakeLists.txt"));
|
||||
if (optionalProjectFileFlag) {
|
||||
supportingFiles.add(new SupportingFile("Project.mustache", sourceFolder, "client.pri"));
|
||||
@@ -117,12 +123,16 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
packageName = (String) additionalProperties.getOrDefault(CodegenConstants.PACKAGE_NAME, DEFAULT_PACKAGE_NAME);
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_FILE)) {
|
||||
setOptionalProjectFileFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_PROJECT_FILE));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.OPTIONAL_PROJECT_FILE, optionalProjectFileFlag);
|
||||
}
|
||||
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
|
||||
|
||||
if (additionalProperties.containsKey("modelNamePrefix")) {
|
||||
supportingFiles.clear();
|
||||
supportingFiles.add(new SupportingFile("helpers-header.mustache", sourceFolder, modelNamePrefix + "Helpers.h"));
|
||||
@@ -138,6 +148,7 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
|
||||
supportingFiles.add(new SupportingFile("oauth.cpp.mustache", sourceFolder, modelNamePrefix + "Oauth.cpp"));
|
||||
supportingFiles.add(new SupportingFile("oauth.h.mustache", sourceFolder, modelNamePrefix + "Oauth.h"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("CMakeConfig.mustache", sourceFolder, "Config.cmake.in"));
|
||||
supportingFiles.add(new SupportingFile("CMakeLists.txt.mustache", sourceFolder, "CMakeLists.txt"));
|
||||
|
||||
|
||||
|
||||
@@ -47,9 +47,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
@@ -109,14 +107,14 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
serializationLibrary.setDefault(SERIALIZATION_LIBRARY_DEFAULT);
|
||||
cliOptions.add(serializationLibrary);
|
||||
|
||||
final CliOption finalProperties = CliOption.newBoolean(FINAL_PROPERTIES, "Whether properties are marked as final when using Json Serializable for serialization");
|
||||
finalProperties.setDefault("true");
|
||||
cliOptions.add(finalProperties);
|
||||
|
||||
// Date Library Option
|
||||
final CliOption dateOption = CliOption.newString(DATE_LIBRARY, "Specify Date library");
|
||||
dateOption.setDefault(DATE_LIBRARY_DEFAULT);
|
||||
|
||||
final CliOption finalProperties = CliOption.newBoolean(FINAL_PROPERTIES, "Whether properties are marked as final when using Json Serializable for serialization");
|
||||
finalProperties.setDefault("true");
|
||||
cliOptions.add(finalProperties);
|
||||
|
||||
final Map<String, String> dateOptions = new HashMap<>();
|
||||
dateOptions.put(DATE_LIBRARY_CORE, "[DEFAULT] Dart core library (DateTime)");
|
||||
dateOptions.put(DATE_LIBRARY_TIME_MACHINE, "Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.");
|
||||
@@ -147,7 +145,7 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a Dart Dio client library with null-safety.";
|
||||
return "Generates a Dart Dio client library.";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -672,7 +670,6 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
resultImports.addAll(rewriteImports(op.imports, false));
|
||||
if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library) && (op.getHasFormParams() || op.getHasQueryParams())) {
|
||||
resultImports.add("package:" + pubName + "/" + sourceFolder + "/api_util.dart");
|
||||
}
|
||||
|
||||
@@ -50,10 +50,12 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
protected String packageVersion = "1.0.0";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
protected String modelFileFolder = null;
|
||||
public static final String WITH_XML = "withXml";
|
||||
public static final String STRUCT_PREFIX = "structPrefix";
|
||||
public static final String WITH_AWSV4_SIGNATURE = "withAWSV4Signature";
|
||||
public static final String GENERATE_INTERFACES = "generateInterfaces";
|
||||
public static final String MODEL_FILE_FOLDER = "modelFileFolder";
|
||||
protected String goImportAlias = "openapiclient";
|
||||
protected boolean isGoSubmodule = false;
|
||||
protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
|
||||
@@ -255,6 +257,10 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
.get(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT).toString()));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(MODEL_FILE_FOLDER)) {
|
||||
modelFileFolder = additionalProperties.get(MODEL_FILE_FOLDER).toString();
|
||||
}
|
||||
|
||||
// add lambda for mustache templates to handle oneOf/anyOf naming
|
||||
// e.g. []string => ArrayOfString
|
||||
additionalProperties.put("lambda.type-to-name", (Mustache.Lambda) (fragment, writer) -> writer.write(typeToName(fragment.execute())));
|
||||
@@ -301,9 +307,17 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
return outputFolder + File.separator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of created model files (it can be overriden using --additional-properties in openapi-generator-cli
|
||||
*/
|
||||
@Override
|
||||
public String modelFileFolder() {
|
||||
return outputFolder + File.separator;
|
||||
String modelFileFolderPath = outputFolder + File.separator;
|
||||
|
||||
if(modelFileFolder != null) {
|
||||
modelFileFolderPath = modelFileFolderPath + modelFileFolder + File.separator;
|
||||
}
|
||||
return modelFileFolderPath.replace("/", File.separator);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -373,10 +387,29 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if at least one of the allOf pieces of a schema are of type string
|
||||
*
|
||||
* @param p
|
||||
* @return
|
||||
*/
|
||||
private boolean isAllOfStringSchema(Schema schema) {
|
||||
if (schema.getAllOf() != null) {
|
||||
Iterator<Schema> it = schema.getAllOf().iterator();
|
||||
while (it.hasNext()) {
|
||||
Schema childSchema = ModelUtils.getReferencedSchema(this.openAPI, it.next());
|
||||
if (ModelUtils.isStringSchema(childSchema)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDefaultValue(Schema p) {
|
||||
p = ModelUtils.getReferencedSchema(this.openAPI, p);
|
||||
if (ModelUtils.isStringSchema(p)) {
|
||||
if (ModelUtils.isStringSchema(p) || isAllOfStringSchema(p)) {
|
||||
Object defaultObj = p.getDefault();
|
||||
if (defaultObj != null) {
|
||||
if (defaultObj instanceof java.lang.String) {
|
||||
|
||||
@@ -65,6 +65,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode";
|
||||
public static final String CASE_INSENSITIVE_RESPONSE_HEADERS = "caseInsensitiveResponseHeaders";
|
||||
public static final String MICROPROFILE_FRAMEWORK = "microprofileFramework";
|
||||
public static final String MICROPROFILE_MUTINY = "microprofileMutiny";
|
||||
public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles";
|
||||
public static final String DYNAMIC_OPERATIONS = "dynamicOperations";
|
||||
public static final String SUPPORT_STREAMING = "supportStreaming";
|
||||
@@ -107,6 +108,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
protected boolean doNotUseRx = true;
|
||||
protected boolean usePlayWS = false;
|
||||
protected String microprofileFramework = MICROPROFILE_DEFAULT;
|
||||
protected boolean microprofileMutiny = false;
|
||||
protected String configKey = null;
|
||||
|
||||
protected boolean asyncNative = false;
|
||||
@@ -199,6 +201,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact."));
|
||||
cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries"));
|
||||
cliOptions.add(CliOption.newString(MICROPROFILE_FRAMEWORK, "Framework for microprofile. Possible values \"kumuluzee\""));
|
||||
cliOptions.add(CliOption.newString(MICROPROFILE_MUTINY, "Whether to use async types for microprofile (currently only Smallrye Mutiny is supported)."));
|
||||
cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries"));
|
||||
cliOptions.add(CliOption.newBoolean(DYNAMIC_OPERATIONS, "Generate operations dynamically at runtime from an OAS", this.dynamicOperations));
|
||||
cliOptions.add(CliOption.newBoolean(SUPPORT_STREAMING, "Support streaming endpoint (beta)", this.supportStreaming));
|
||||
@@ -224,8 +227,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
supportedLibraries.put(GOOGLE_API_CLIENT, "HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x");
|
||||
supportedLibraries.put(REST_ASSURED, "HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8");
|
||||
supportedLibraries.put(NATIVE, "HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+");
|
||||
supportedLibraries.put(MICROPROFILE, "HTTP client: Microprofile client 1.x. JSON processing: JSON-B");
|
||||
supportedLibraries.put(APACHE, "HTTP client: Apache httpclient 4.x");
|
||||
supportedLibraries.put(MICROPROFILE, "HTTP client: Microprofile client 1.x. JSON processing: JSON-B or Jackson 2.9.x");
|
||||
supportedLibraries.put(APACHE, "HTTP client: Apache httpclient 5.x");
|
||||
|
||||
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
|
||||
libraryOption.setEnum(supportedLibraries);
|
||||
@@ -336,6 +339,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
}
|
||||
additionalProperties.put(MICROPROFILE_FRAMEWORK, microprofileFramework);
|
||||
|
||||
if (additionalProperties.containsKey(MICROPROFILE_MUTINY)) {
|
||||
this.setMicroprofileMutiny(convertPropertyToBooleanAndWriteBack(MICROPROFILE_MUTINY));
|
||||
}
|
||||
|
||||
if (!additionalProperties.containsKey(MICROPROFILE_REST_CLIENT_VERSION)) {
|
||||
additionalProperties.put(MICROPROFILE_REST_CLIENT_VERSION, MICROPROFILE_REST_CLIENT_DEFAULT_VERSION);
|
||||
} else {
|
||||
@@ -646,7 +653,12 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("api_exception.mustache", apiExceptionFolder, "ApiException.java"));
|
||||
supportingFiles.add(new SupportingFile("api_exception_mapper.mustache", apiExceptionFolder, "ApiExceptionMapper.java"));
|
||||
serializationLibrary = "none";
|
||||
if (getSerializationLibrary() == null) {
|
||||
LOGGER.info("No serializationLibrary configured, using '{}' as fallback", SERIALIZATION_LIBRARY_JSONB);
|
||||
setSerializationLibrary(SERIALIZATION_LIBRARY_JSONB);
|
||||
} else if (getSerializationLibrary().equals(SERIALIZATION_LIBRARY_GSON)) {
|
||||
forceSerializationLibrary(SERIALIZATION_LIBRARY_JSONB);
|
||||
}
|
||||
|
||||
if (microprofileFramework.equals(MICROPROFILE_KUMULUZEE)) {
|
||||
supportingFiles.add(new SupportingFile("kumuluzee.pom.mustache", "", "pom.xml"));
|
||||
@@ -971,7 +983,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
}
|
||||
|
||||
// TODO: inverse logic. Do not add the imports unconditionally in the first place.
|
||||
if (! AnnotationLibrary.SWAGGER1.equals(getAnnotationLibrary())) {
|
||||
if (!AnnotationLibrary.SWAGGER1.equals(getAnnotationLibrary())) {
|
||||
// Remove io.swagger.annotations.* imports
|
||||
codegenModel.imports.remove("ApiModel");
|
||||
codegenModel.imports.remove("ApiModelProperty");
|
||||
@@ -1123,6 +1135,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
this.microprofileFramework = microprofileFramework;
|
||||
}
|
||||
|
||||
public void setMicroprofileMutiny(boolean microprofileMutiny) {
|
||||
this.microprofileMutiny = microprofileMutiny;
|
||||
}
|
||||
|
||||
public void setConfigKey(String configKey) {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
import org.openapitools.codegen.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
import org.openapitools.codegen.model.ApiInfoMap;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
import org.openapitools.codegen.model.OperationMap;
|
||||
import org.openapitools.codegen.model.OperationsMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class JetbrainsHttpClientClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public static final String PROJECT_NAME = "Jetbrains HTTP Client";
|
||||
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "jetbrains-http-client";
|
||||
}
|
||||
|
||||
public String getHelp() {
|
||||
return "Generates a jetbrains-http client. See https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html";
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratorLanguage generatorLanguage() {
|
||||
return GeneratorLanguage.HTTP;
|
||||
}
|
||||
|
||||
public JetbrainsHttpClientClientCodegen() {
|
||||
super();
|
||||
|
||||
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
|
||||
.stability(Stability.EXPERIMENTAL)
|
||||
.build();
|
||||
|
||||
outputFolder = "generated-code" + File.separator + "jetbrains-http-client";
|
||||
apiTemplateFiles.put("api.mustache", ".http");
|
||||
embeddedTemplateDir = templateDir = "jetbrains-http-client";
|
||||
apiPackage = "Apis";
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ImmutableMap.Builder<String, Mustache.Lambda> addMustacheLambdas() {
|
||||
|
||||
return super.addMustacheLambdas()
|
||||
.put("doubleMustache", new DoubleMustacheLambda());
|
||||
}
|
||||
|
||||
public static class DoubleMustacheLambda implements Mustache.Lambda {
|
||||
@Override
|
||||
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
|
||||
String text = fragment.execute();
|
||||
writer.write(text
|
||||
.replaceAll("\\{", "{{")
|
||||
.replaceAll("}", "}}")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> bundle) {
|
||||
|
||||
return bundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) {
|
||||
return super.postProcessOperationsWithModels(objs, allModels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcess() {
|
||||
System.out.println("################################################################################");
|
||||
System.out.println("# Thanks for using OpenAPI Generator. #");
|
||||
System.out.println("# Please consider donation to help us maintain this project \uD83D\uDE4F #");
|
||||
System.out.println("# https://opencollective.com/openapi_generator/donate #");
|
||||
System.out.println("# #");
|
||||
System.out.println("# This generator was written by Julien Lengrand-Lambert (https://github.com/jlengrand) #");
|
||||
System.out.println("################################################################################");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class JuliaClientCodegen extends AbstractJuliaCodegen {
|
||||
/**
|
||||
* Configures the type of generator.
|
||||
*
|
||||
* @return the CodegenType for this generator
|
||||
* @see org.openapitools.codegen.CodegenType
|
||||
*/
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the name of the generator.
|
||||
* This will be used to refer to the generator when configuration is read from config files.
|
||||
*
|
||||
* @return the name of the generator
|
||||
*/
|
||||
public String getName() {
|
||||
return "julia-client";
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a help message for the generator.
|
||||
* TODO: add parameters, tips here
|
||||
*
|
||||
* @return the help message for the generator
|
||||
*/
|
||||
public String getHelp() {
|
||||
return "Generates a julia client.";
|
||||
}
|
||||
|
||||
public JuliaClientCodegen() {
|
||||
super();
|
||||
|
||||
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
|
||||
.stability(Stability.BETA)
|
||||
.build();
|
||||
|
||||
outputFolder = "generated-code" + File.separator + "julia-client";
|
||||
modelTemplateFiles.put("model.mustache", ".jl");
|
||||
apiTemplateFiles.put("api.mustache", ".jl");
|
||||
embeddedTemplateDir = templateDir = "julia-client";
|
||||
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||
|
||||
// apiPackage = "Apis";
|
||||
// modelPackage = "Models";
|
||||
supportingFiles.clear();
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "README.md"));
|
||||
|
||||
cliOptions.clear();
|
||||
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Julia client package name.").defaultValue("APIClient"));
|
||||
cliOptions.add(new CliOption("exportModels", "Whether to generate code to export model names.").defaultValue("false"));
|
||||
cliOptions.add(new CliOption("exportOperations", "Whether to generate code to export operation names.").defaultValue("false"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {
|
||||
setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));
|
||||
} else {
|
||||
setPackageName("APIClient");
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey("exportModels")) {
|
||||
setExportModels(Boolean.parseBoolean((String) additionalProperties.get("exportModels")));
|
||||
}
|
||||
additionalProperties.put("exportModels", exportModels);
|
||||
|
||||
if (additionalProperties.containsKey("exportOperations")) {
|
||||
setExportModels(Boolean.parseBoolean((String) additionalProperties.get("exportOperations")));
|
||||
}
|
||||
additionalProperties.put("exportOperations", exportModels);
|
||||
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
supportingFiles.add(new SupportingFile("client.mustache", srcPath, packageName + ".jl"));
|
||||
supportingFiles.add(new SupportingFile("modelincludes.mustache", srcPath, "modelincludes.jl"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class JuliaServerCodegen extends AbstractJuliaCodegen {
|
||||
/**
|
||||
* Configures the type of generator.
|
||||
*
|
||||
* @return the CodegenType for this generator
|
||||
* @see org.openapitools.codegen.CodegenType
|
||||
*/
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.SERVER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the name of the generator.
|
||||
* This will be used to refer to the generator when configuration is read from config files.
|
||||
*
|
||||
* @return the name of the generator
|
||||
*/
|
||||
public String getName() {
|
||||
return "julia-server";
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a help message for the generator.
|
||||
* TODO: add parameters, tips here
|
||||
*
|
||||
* @return the help message for the generator
|
||||
*/
|
||||
public String getHelp() {
|
||||
return "Generates a julia server.";
|
||||
}
|
||||
|
||||
public JuliaServerCodegen() {
|
||||
super();
|
||||
|
||||
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
|
||||
.stability(Stability.BETA)
|
||||
.build();
|
||||
|
||||
outputFolder = "generated-code" + File.separator + "julia-server";
|
||||
modelTemplateFiles.put("model.mustache", ".jl");
|
||||
apiTemplateFiles.put("api.mustache", ".jl");
|
||||
embeddedTemplateDir = templateDir = "julia-server";
|
||||
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||
|
||||
supportingFiles.clear();
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "README.md"));
|
||||
|
||||
cliOptions.clear();
|
||||
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Julia server package name.").defaultValue("APIServer"));
|
||||
cliOptions.add(new CliOption("exportModels", "Whether to generate code to export model names.").defaultValue("false"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {
|
||||
setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));
|
||||
} else {
|
||||
setPackageName("APIServer");
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey("exportModels")) {
|
||||
setExportModels(Boolean.parseBoolean((String) additionalProperties.get("exportModels")));
|
||||
}
|
||||
additionalProperties.put("exportModels", exportModels);
|
||||
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
supportingFiles.add(new SupportingFile("server.mustache", srcPath, packageName + ".jl"));
|
||||
supportingFiles.add(new SupportingFile("modelincludes.mustache", srcPath, "modelincludes.jl"));
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
public static final String USE_TAGS = "useTags";
|
||||
public static final String BEAN_QUALIFIERS = "beanQualifiers";
|
||||
|
||||
public static final String USE_SPRING_BOOT3 = "useSpringBoot3";
|
||||
|
||||
private String basePackage;
|
||||
private String invokerPackage;
|
||||
private String serverPort = "8080";
|
||||
@@ -87,6 +89,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
private boolean delegatePattern = false;
|
||||
protected boolean useTags = false;
|
||||
private boolean beanQualifiers = false;
|
||||
|
||||
protected boolean useSpringBoot3 = false;
|
||||
private DocumentationProvider documentationProvider;
|
||||
private AnnotationLibrary annotationLibrary;
|
||||
|
||||
@@ -156,6 +160,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
addSwitch(BEAN_QUALIFIERS, "Whether to add fully-qualifier class names as bean qualifiers in @Component and " +
|
||||
"@RestController annotations. May be used to prevent bean names clash if multiple generated libraries" +
|
||||
" (contexts) added to single project.", beanQualifiers);
|
||||
addSwitch(USE_SPRING_BOOT3, "Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.", useSpringBoot3);
|
||||
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
|
||||
setLibrary(SPRING_BOOT);
|
||||
|
||||
@@ -180,6 +185,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
cliOptions.add(annotationLibraryCliOption);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocumentationProvider getDocumentationProvider() {
|
||||
return documentationProvider;
|
||||
@@ -230,7 +236,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
* @return true if the selected DocumentationProvider requires us to bootstrap swagger-ui.
|
||||
*/
|
||||
private boolean selectedDocumentationProviderRequiresSwaggerUiBootstrap() {
|
||||
return getDocumentationProvider().equals(DocumentationProvider.SPRINGFOX) ||
|
||||
return getDocumentationProvider().equals(DocumentationProvider.SPRINGFOX) ||
|
||||
getDocumentationProvider().equals(DocumentationProvider.SOURCE);
|
||||
}
|
||||
|
||||
@@ -315,6 +321,14 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
this.useTags = useTags;
|
||||
}
|
||||
|
||||
public void setUseSpringBoot3(boolean isSpringBoot3) {
|
||||
this.useSpringBoot3 = isSpringBoot3;
|
||||
}
|
||||
|
||||
public boolean isUseSpringBoot3() {
|
||||
return useSpringBoot3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseBeanValidation(boolean useBeanValidation) {
|
||||
this.useBeanValidation = useBeanValidation;
|
||||
@@ -357,11 +371,11 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
|
||||
if (null != defaultDocumentationProvider()) {
|
||||
documentationProvider = DocumentationProvider.ofCliOption(
|
||||
(String)additionalProperties.getOrDefault(DOCUMENTATION_PROVIDER,
|
||||
(String) additionalProperties.getOrDefault(DOCUMENTATION_PROVIDER,
|
||||
defaultDocumentationProvider().toCliOptValue())
|
||||
);
|
||||
|
||||
if (! supportedDocumentationProvider().contains(documentationProvider)) {
|
||||
if (!supportedDocumentationProvider().contains(documentationProvider)) {
|
||||
String msg = String.format(Locale.ROOT,
|
||||
"The [%s] Documentation Provider is not supported by this generator",
|
||||
documentationProvider.toCliOptValue());
|
||||
@@ -373,13 +387,13 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
documentationProvider.getPreferredAnnotationLibrary().toCliOptValue())
|
||||
);
|
||||
|
||||
if (! supportedAnnotationLibraries().contains(annotationLibrary)) {
|
||||
if (!supportedAnnotationLibraries().contains(annotationLibrary)) {
|
||||
String msg = String.format(Locale.ROOT, "The Annotation Library [%s] is not supported by this generator",
|
||||
annotationLibrary.toCliOptValue());
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
|
||||
if (! documentationProvider.supportedAnnotationLibraries().contains(annotationLibrary)) {
|
||||
if (!documentationProvider.supportedAnnotationLibraries().contains(annotationLibrary)) {
|
||||
String msg = String.format(Locale.ROOT,
|
||||
"The [%s] documentation provider does not support [%s] as complementary annotation library",
|
||||
documentationProvider.toCliOptValue(), annotationLibrary.toCliOptValue());
|
||||
@@ -503,6 +517,22 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
this.setUseTags(Boolean.parseBoolean(additionalProperties.get(USE_TAGS).toString()));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(USE_SPRING_BOOT3)) {
|
||||
this.setUseSpringBoot3(convertPropertyToBoolean(USE_SPRING_BOOT3));
|
||||
}
|
||||
if (isUseSpringBoot3()) {
|
||||
if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) {
|
||||
throw new IllegalArgumentException(DocumentationProvider.SPRINGFOX.getPropertyName() + " is not supported with Spring Boot > 3.x");
|
||||
}
|
||||
if (AnnotationLibrary.SWAGGER1.equals(getAnnotationLibrary())) {
|
||||
throw new IllegalArgumentException(AnnotationLibrary.SWAGGER1.getPropertyName() + " is not supported with Spring Boot > 3.x");
|
||||
}
|
||||
useJakartaEe=true;
|
||||
additionalProperties.put(USE_JAKARTA_EE, useJakartaEe);
|
||||
applyJakartaPackage();
|
||||
}
|
||||
writePropertyBack(USE_SPRING_BOOT3, isUseSpringBoot3());
|
||||
|
||||
modelTemplateFiles.put("model.mustache", ".kt");
|
||||
|
||||
if (!this.interfaceOnly && this.delegatePattern) {
|
||||
@@ -544,10 +574,18 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
|
||||
if (library.equals(SPRING_BOOT)) {
|
||||
LOGGER.info("Setup code generator for Kotlin Spring Boot");
|
||||
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||
if (isUseSpringBoot3()) {
|
||||
supportingFiles.add(new SupportingFile("pom-sb3.mustache", "", "pom.xml"));
|
||||
} else {
|
||||
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||
}
|
||||
|
||||
if (this.gradleBuildFile) {
|
||||
supportingFiles.add(new SupportingFile("buildGradleKts.mustache", "", "build.gradle.kts"));
|
||||
if (isUseSpringBoot3()) {
|
||||
supportingFiles.add(new SupportingFile("buildGradle-sb3-Kts.mustache", "", "build.gradle.kts"));
|
||||
} else {
|
||||
supportingFiles.add(new SupportingFile("buildGradleKts.mustache", "", "build.gradle.kts"));
|
||||
}
|
||||
supportingFiles.add(new SupportingFile("settingsGradle.mustache", "", "settings.gradle"));
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user