forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 7.0.x
This commit is contained in:
47
.devcontainer/devcontainer.json
Normal file
47
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "OpenAPIGenerator",
|
||||
"image": "mcr.microsoft.com/devcontainers/base:debian",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/java:1": {
|
||||
"version": "11",
|
||||
"installMaven": true
|
||||
},
|
||||
"ghcr.io/devcontainers/features/node:1": {
|
||||
"version": "lts"
|
||||
},
|
||||
"ghcr.io/snebjorn/devcontainer-feature/chromium:latest": {}
|
||||
},
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {
|
||||
"java.configuration.runtimes": [
|
||||
{
|
||||
"name": "JavaSE-11",
|
||||
"path": "/usr/local/sdkman/candidates/java/11.0.16.1-ms",
|
||||
"sources": "/usr/local/sdkman/candidates/java/11.0.16.1-ms/lib/src.zip",
|
||||
"javadoc": "https://docs.oracle.com/en/java/javase/11/docs/api",
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
},
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"vscjava.vscode-java-pack",
|
||||
"attilabuti.mustache-syntax-vscode",
|
||||
"formulahendry.code-runner",
|
||||
"visualstudioexptteam.vscodeintellicode",
|
||||
"42crunch.vscode-openapi",
|
||||
"mermade.openapi-lint"
|
||||
]
|
||||
}
|
||||
},
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "mvn clean package -DskipTests",
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode"
|
||||
}
|
||||
6
.github/workflows/samples-cpp-qt-client.yaml
vendored
6
.github/workflows/samples-cpp-qt-client.yaml
vendored
@@ -23,12 +23,16 @@ jobs:
|
||||
- ubuntu-latest
|
||||
- macOS-latest
|
||||
- windows-latest
|
||||
include:
|
||||
- os: windows-latest
|
||||
tools: 'tools_openssl_x64'
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
version: ${{ matrix.qt-version }}
|
||||
tools: ${{ matrix.tools }}
|
||||
- name: Build
|
||||
working-directory: "samples/client/petstore/cpp-qt"
|
||||
run: ./build-and-test.bash
|
||||
run: cmake . && cmake --build .
|
||||
|
||||
3
.github/workflows/samples-dotnet.yaml
vendored
3
.github/workflows/samples-dotnet.yaml
vendored
@@ -7,12 +7,14 @@ on:
|
||||
- 'samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore**/'
|
||||
- 'samples/server/petstore/aspnetcore-6.0/**'
|
||||
- 'samples/server/petstore/aspnetcore-6.0-pocoModels/**'
|
||||
- 'samples/server/petstore/aspnetcore-6.0-useSwashBuckle/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'samples/client/petstore/csharp-netcore/**net6.0**/'
|
||||
- 'samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore**/'
|
||||
- 'samples/server/petstore/aspnetcore-6.0/**'
|
||||
- 'samples/server/petstore/aspnetcore-6.0-pocoModels/**'
|
||||
- 'samples/server/petstore/aspnetcore-6.0-useSwashBuckle/**'
|
||||
jobs:
|
||||
build:
|
||||
name: Build .Net projects
|
||||
@@ -30,6 +32,7 @@ jobs:
|
||||
- samples/server/petstore/aspnetcore-6.0
|
||||
- samples/server/petstore/aspnetcore-6.0-pocoModels
|
||||
- samples/server/petstore/aspnetcore-6.0-project4Models
|
||||
- samples/server/petstore/aspnetcore-6.0-useSwashBuckle
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-dotnet@v3.0.3
|
||||
|
||||
2
.github/workflows/samples-go.yaml
vendored
2
.github/workflows/samples-go.yaml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
#- samples/server/petstore/go-chi-server/
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: "stable"
|
||||
- run: go version
|
||||
|
||||
@@ -34,6 +34,9 @@ jobs:
|
||||
path: |
|
||||
~/.m2
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Build
|
||||
- name: Build with Maven
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: mvn clean package
|
||||
- name: Build with Gradle
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: gradle clean build
|
||||
|
||||
10
.github/workflows/samples-spring.yaml
vendored
10
.github/workflows/samples-spring.yaml
vendored
@@ -22,26 +22,30 @@ jobs:
|
||||
- samples/openapi3/client/petstore/spring-cloud
|
||||
- samples/client/petstore/spring-cloud-date-time
|
||||
- samples/openapi3/client/petstore/spring-cloud-date-time
|
||||
- samples/client/petstore/spring-stubs
|
||||
- samples/openapi3/client/petstore/spring-stubs
|
||||
- samples/openapi3/client/petstore/spring-stubs-skip-default-interface
|
||||
- samples/openapi3/client/petstore/spring-cloud-async
|
||||
- samples/openapi3/client/petstore/spring-cloud-spring-pageable
|
||||
# servers
|
||||
- samples/server/petstore/springboot
|
||||
- samples/openapi3/server/petstore/springboot
|
||||
- samples/server/petstore/springboot-beanvalidation
|
||||
- samples/server/petstore/springboot-useoptional
|
||||
- samples/openapi3/server/petstore/springboot-useoptional
|
||||
- samples/server/petstore/springboot-reactive
|
||||
- samples/openapi3/server/petstore/springboot-reactive
|
||||
- samples/server/petstore/springboot-implicitHeaders
|
||||
- samples/openapi3/server/petstore/springboot-implicitHeaders
|
||||
- samples/server/petstore/springboot-delegate
|
||||
- samples/server/petstore/springboot-delegate-no-response-entity
|
||||
- samples/openapi3/server/petstore/springboot-delegate
|
||||
- samples/server/petstore/spring-boot-nullable-set
|
||||
- samples/server/petstore/spring-boot-defaultInterface-unhandledException
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof
|
||||
- samples/server/petstore/springboot-virtualan
|
||||
- samples/server/petstore/springboot-implicitHeaders-annotationLibrary
|
||||
- samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8
|
||||
- samples/server/petstore/springboot-spring-pageable-delegatePattern
|
||||
- samples/server/petstore/springboot-spring-pageable-without-j8
|
||||
- samples/server/petstore/springboot-spring-pageable
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-java@v3
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -35,6 +35,7 @@ packages/
|
||||
nbproject/
|
||||
nbactions.xml
|
||||
nb-configuration.xml
|
||||
.direnv/
|
||||
|
||||
.settings
|
||||
|
||||
|
||||
@@ -150,14 +150,15 @@ script:
|
||||
- docker buildx version
|
||||
# run integration tests defined in maven pom.xml
|
||||
# WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet.
|
||||
- mvn -e --no-snapshot-updates --quiet --batch-mode --show-version clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
# show "error" only to reduce the log size
|
||||
- mvn -e --no-snapshot-updates --quiet --batch-mode --show-version clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error 2>&1 | grep -i error
|
||||
#- mvn -e --no-snapshot-updates --quiet --batch-mode --show-version verify -Psamples -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
after_success:
|
||||
# push to maven repo
|
||||
- if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ]; then
|
||||
echo "Publishing from branch $TRAVIS_BRANCH";
|
||||
mvn clean deploy -DskipTests=true -B -U -P release --settings CI/settings.xml;
|
||||
mvn clean deploy -DskipTests=true -B -U -P release --settings CI/settings.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error;
|
||||
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
|
||||
pushd .;
|
||||
cd modules/openapi-generator-gradle-plugin;
|
||||
@@ -166,7 +167,7 @@ after_success:
|
||||
popd;
|
||||
elif [ -z $TRAVIS_TAG ] && [[ "$TRAVIS_BRANCH" =~ ^[0-9]+\.[0-9]+\.x$ ]]; then
|
||||
echo "Publishing from branch $TRAVIS_BRANCH";
|
||||
mvn clean deploy --settings CI/settings.xml;
|
||||
mvn clean deploy --settings CI/settings.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error;
|
||||
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
|
||||
pushd .;
|
||||
cd modules/openapi-generator-gradle-plugin;
|
||||
|
||||
50
README.md
50
README.md
@@ -15,14 +15,14 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`6.4.0`):
|
||||
[](https://travis-ci.com/OpenAPITools/openapi-generator)
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`6.6.0`):
|
||||
[](https://app.travis-ci.com/github/OpenAPITools/openapi-generator/builds)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
|
||||
[7.0.x](https://github.com/OpenAPITools/openapi-generator/tree/7.0.x) (`7.0.x`):
|
||||
[](https://travis-ci.com/OpenAPITools/openapi-generator)
|
||||
[](https://app.travis-ci.com/github/OpenAPITools/openapi-generator/builds)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
@@ -78,7 +78,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
|
||||
|
||||
| | Languages/Frameworks |
|
||||
| -------------------------------- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient 4.x, Apache HttpClient 5.x, 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) |
|
||||
| **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 - 15.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/) |
|
||||
@@ -120,9 +120,9 @@ 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.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) |
|
||||
| 7.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.0.0-SNAPSHOT/) | May/Jun 2023 | Major release with breaking changes (no fallback) |
|
||||
| 6.6.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/6.5.0-SNAPSHOT/) | 28.04.2023 | Minor release with breaking changes (with fallback) |
|
||||
| [6.5.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.5.0) (latest stable release) | 01.04.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) |
|
||||
|
||||
@@ -182,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.3.0/openapi-generator-cli-6.3.0.jar`
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.5.0/openapi-generator-cli-6.5.0.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
```sh
|
||||
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
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.5.0/openapi-generator-cli-6.5.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.3.0/openapi-generator-cli-6.3.0.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.5.0/openapi-generator-cli-6.5.0.jar
|
||||
```
|
||||
|
||||
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
|
||||
@@ -263,6 +263,20 @@ If you don't have maven installed, you may directly use the included [maven wrap
|
||||
./mvnw clean install
|
||||
```
|
||||
|
||||
#### Nix users
|
||||
|
||||
If you're a nix user, you can enter OpenAPI Generator shell, by typing:
|
||||
```sh
|
||||
nix develop
|
||||
```
|
||||
It will enter a shell with Java 8 and Maven installed.
|
||||
|
||||
Direnv supports automatically loading of the nix developer shell, so if you're using direnv too, type:
|
||||
```sh
|
||||
direnv allow
|
||||
```
|
||||
and have `java` and `mvn` set up with correct versions each time you enter project directory.
|
||||
|
||||
The default build contains minimal static analysis (via CheckStyle). To run your build with PMD and Spotbugs, use the `static-analysis` profile:
|
||||
|
||||
```sh
|
||||
@@ -416,7 +430,7 @@ openapi-generator-cli version
|
||||
To use a specific version of "openapi-generator-cli"
|
||||
|
||||
```sh
|
||||
openapi-generator-cli version-manager set 6.3.0
|
||||
openapi-generator-cli version-manager set 6.5.0
|
||||
```
|
||||
|
||||
Or install it as dev-dependency:
|
||||
@@ -440,7 +454,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.3.0/openapi-generator-cli-6.3.0.jar)
|
||||
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.5.0/openapi-generator-cli-6.5.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`
|
||||
@@ -588,8 +602,9 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [Angular.Schule](https://angular.schule/)
|
||||
- [Aqovia](https://aqovia.com/)
|
||||
- [Australia and New Zealand Banking Group (ANZ)](http://www.anz.com/)
|
||||
- [ASKUL](https://www.askul.co.jp)
|
||||
- [Arduino](https://www.arduino.cc/)
|
||||
- [ASKUL](https://www.askul.co.jp)
|
||||
- [Amazon Web Services (AWS)](https://aws.amazon.com/)
|
||||
- [b<>com](https://b-com.com/en)
|
||||
- [百度营销](https://e.baidu.com)
|
||||
- [Bandwidth](https://dev.bandwidth.com)
|
||||
@@ -878,6 +893,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- 2022-04-06 - [Effective Software Development using OpenAPI Generator](https://apexlabs.ai/post/openapi-generator) by Ajil Oommen (Senior Flutter Developer)
|
||||
- 2022-05-13 - [A Path From an API To Client Libraries](https://www.youtube.com/watch?v=XC8oVn_efTw) by [Filip Srnec](https://www.devoxx.co.uk/talk/?id=11211) at Infobip
|
||||
- 2022-06-01 - [API First, using OpenAPI and Spring Boot](https://medium.com/xgeeks/api-first-using-openapi-and-spring-boot-2602c04bb0d3) by [Micael Estrázulas Vianna](https://estrazulas.medium.com/)
|
||||
- 2022-06-12 - [Mustache templates with OpenAPI specs](https://medium.com/geekculture/mustache-templates-with-openapi-specs-f24711c67dec) by [Beppe Catanese](https://github.com/gcatanese)
|
||||
- 2022-07-01 - [Generate API contract using OpenAPI Generator Maven plugin](https://huongdanjava.com/generate-api-contract-using-openapi-generator-maven-plugin.html) by [Khanh Nguyen](https://huongdanjava.com/)
|
||||
- 2022-07-22 - [使用OpenAPI Generator Maven plugin开发api优先的java客户端和服务端代码](https://blog.roccoshi.top/2022/java/openapi-generator%E7%9A%84%E4%BD%BF%E7%94%A8/) by [Lincest](https://github.com/Lincest)
|
||||
- 2022-08-01 - [Tutorial: Etsy Open API v3 (ruby)](https://blog.tjoyal.dev/etsy-open-api-v3/) by [Thierry Joyal](https://github.com/tjoyal)
|
||||
@@ -889,6 +905,10 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- 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)
|
||||
- 2023-03-15 - [OpenAPI Generatorに適したOpenAPIの書き方](https://techblog.zozo.com/entry/how-to-write-openapi-for-openapi-generator) by [ZOZO Tech Blog](https://techblog.zozo.com/)
|
||||
- 2023-03-19 - [EXOGEM: Extending OpenAPI Generator for Monitoring of RESTful APIs](https://link.springer.com/chapter/10.1007/978-3-031-26507-5_10) by Daniel Friis Holtebo, Jannik Lucas Sommer, Magnus Mølgaard Lund, Alessandro Tibo, Junior Dongo & Michele Albano at "ICSOC 2022: Service-Oriented Computing – ICSOC 2022 Workshops"
|
||||
- 2023-03-28 - [API-First Design with OpenAPI Generator](https://www.linkedin.com/pulse/api-first-design-openapi-generator-jonathan-manera/) by [Jonathan Manera](https://www.linkedin.com/in/manerajona/)
|
||||
- 2023-03-28 - [ハンズオンで学ぶサーバーサイド Kotlin(Spring Boot&Arrow&OpenAPI Generator)v1.0.1](https://zenn.dev/msksgm/books/implementing-server-side-kotlin-development) by [msk](https://zenn.dev/msksgm)
|
||||
|
||||
## [6 - About Us](#table-of-contents)
|
||||
|
||||
@@ -1016,6 +1036,7 @@ Here is a list of template creators:
|
||||
* Erlang Server: @galaxie
|
||||
* F# (Giraffe) Server: @nmfisher
|
||||
* Go Server: @guohuang
|
||||
* Go Server (refactored in 7.0.0): @lwj5
|
||||
* Go (Echo) Server: @ph4r5h4d
|
||||
* Go (Gin) Server: @kemokemo
|
||||
* GraphQL Express Server: @renepardon
|
||||
@@ -1120,7 +1141,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| 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) |
|
||||
| Go | @antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) @ph4r5h4d (2021/04) @lwj5 (2023/04) |
|
||||
| GraphQL | @renepardon (2018/12) |
|
||||
| Groovy | |
|
||||
| Haskell | |
|
||||
@@ -1230,3 +1251,4 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
---
|
||||
|
||||
|
||||
11
bin/configs/aspnetcore-6.0-useSwashBuckle.yaml
Normal file
11
bin/configs/aspnetcore-6.0-useSwashBuckle.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
generatorName: aspnetcore
|
||||
outputDir: samples/server/petstore/aspnetcore-6.0-useSwashBuckle
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
|
||||
additionalProperties:
|
||||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
|
||||
aspnetCoreVersion: "6.0"
|
||||
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
|
||||
useSwashBuckle: false
|
||||
buildTarget: library
|
||||
isLibrary: true
|
||||
@@ -9,3 +9,4 @@ additionalProperties:
|
||||
disallowAdditionalPropertiesIfNotPresent: false
|
||||
useOneOfDiscriminatorLookup: true
|
||||
targetFramework: net47
|
||||
skipOneOfAnyOfGetter: true
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# for .net Unity
|
||||
generatorName: csharp-netcore
|
||||
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
|
||||
library: unityWebRequest
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: jaxrs-cxf-cdi
|
||||
outputDir: samples/server/petstore/jaxrs-cxf-cdi
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/jaxrs/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
|
||||
10
bin/configs/jaxrs-spec-required-and-readonly-property.yaml
Normal file
10
bin/configs/jaxrs-spec-required-and-readonly-property.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
generatorName: jaxrs-spec
|
||||
outputDir: samples/server/petstore/jaxrs-spec-required-and-readonly-property
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/required-and-readonly-property.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/spec
|
||||
additionalProperties:
|
||||
artifactId: jaxrs-spec-petstore-server
|
||||
serializableModel: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
implicitHeadersRegex: (api_key|enum_header_string)
|
||||
generateBuilders: "true"
|
||||
@@ -5,4 +5,4 @@ templateDir: modules/openapi-generator/src/main/resources/python-nextgen
|
||||
library: asyncio
|
||||
additionalProperties:
|
||||
packageName: petstore_api
|
||||
floatStrictType: false
|
||||
mapNumberTo: float
|
||||
|
||||
@@ -4,4 +4,3 @@ 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
|
||||
|
||||
@@ -6,3 +6,4 @@ additionalProperties:
|
||||
packageName: petstore_api
|
||||
useOneOfDiscriminatorLookup: "true"
|
||||
disallowAdditionalPropertiesIfNotPresent: false
|
||||
mapNumberTo: StrictFloat
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable
|
||||
library: spring-boot
|
||||
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:
|
||||
groupId: org.openapitools.openapi3
|
||||
documentationProvider: springdoc
|
||||
java8: "false"
|
||||
useBeanValidation: true
|
||||
artifactId: spring-boot-beanvalidation-no-nullable
|
||||
hideGenerationTimestamp: "true"
|
||||
openApiNullable: "false"
|
||||
@@ -1,9 +1,10 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-beanvalidation-no-nullable
|
||||
library: spring-boot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
documentationProvider: springfox
|
||||
java8: "false"
|
||||
useBeanValidation: true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-beanvalidation
|
||||
library: spring-boot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
documentationProvider: springfox
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/spring-boot-defaultInterface-unhandledException
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
artifactId: spring-boot-defaultInterface-unhandledException
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-delegate-j8
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
documentationProvider: springfox
|
||||
|
||||
11
bin/configs/spring-boot-delegate-no-response-entity.yaml
Normal file
11
bin/configs/spring-boot-delegate-no-response-entity.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-delegate-no-response-entity
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
documentationProvider: springfox
|
||||
artifactId: springboot-delegate-no-response-entity
|
||||
hideGenerationTimestamp: "true"
|
||||
java8: true
|
||||
delegatePattern: "true"
|
||||
useResponseEntity: "false"
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/openapi3/server/petstore/springboot-delegate
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-delegate
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
documentationProvider: springfox
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/openapi3/server/petstore/springboot-implicitHeaders
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-implicitHeaders
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
artifactId: springboot-implicitHeaders
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/openapi3/server/petstore/springboot-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:
|
||||
groupId: org.openapitools.openapi3
|
||||
documentationProvider: springdoc
|
||||
artifactId: springboot-reactive
|
||||
reactive: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
delegatePattern: "true"
|
||||
@@ -1,8 +1,9 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-reactive
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
artifactId: springboot-reactive
|
||||
documentationProvider: springfox
|
||||
reactive: "true"
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/openapi3/server/petstore/springboot-useoptional
|
||||
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:
|
||||
groupId: org.openapitools.openapi3
|
||||
documentationProvider: springdoc
|
||||
useOptional: true
|
||||
artifactId: spring-boot-useoptional
|
||||
hideGenerationTimestamp: "true"
|
||||
@@ -1,8 +1,9 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-useoptional
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
documentationProvider: springfox
|
||||
useOptional: true
|
||||
artifactId: spring-boot-useoptional
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-virtualan
|
||||
library: spring-boot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
documentationProvider: springdoc
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
documentationProvider: springfox
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/openapi3/client/petstore/spring-cloud-async
|
||||
library: spring-cloud
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/client/petstore/spring-cloud-async
|
||||
library: spring-cloud
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
documentationProvider: springfox
|
||||
async: "true"
|
||||
java8: "true"
|
||||
artifactId: petstore-spring-cloud
|
||||
hideGenerationTimestamp: "true"
|
||||
@@ -1,7 +1,7 @@
|
||||
generatorName: spring
|
||||
library: spring-cloud
|
||||
outputDir: samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
@@ -10,3 +10,4 @@ additionalProperties:
|
||||
interfaceOnly: "true"
|
||||
singleContentTypes: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
generatedConstructorWithRequiredArgs: "false"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/openapi3/client/petstore/spring-cloud-spring-pageable
|
||||
library: spring-cloud
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-spring-pageable.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-spring-pageable.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/client/petstore/spring-cloud-spring-pageable
|
||||
library: spring-cloud
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-spring-pageable.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
documentationProvider: springfox
|
||||
artifactId: spring-cloud-spring-pageable
|
||||
hideGenerationTimestamp: 'true'
|
||||
@@ -1,7 +1,7 @@
|
||||
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
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
artifactId: spring-http-interface-reactive
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
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
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
artifactId: spring-http-interface
|
||||
snapshotVersion: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
modelNameSuffix: 'Dto'
|
||||
generatedConstructorWithRequiredArgs: "false"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/openapi3/client/petstore/spring-stubs
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/openapi3/client/petstore/spring-stubs-skip-default-interface
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
groupId: org.openapitools.openapi3
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/spring-stubs
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
documentationProvider: springfox
|
||||
artifactId: spring-stubs
|
||||
interfaceOnly: "true"
|
||||
singleContentTypes: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
@@ -1,7 +1,7 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8
|
||||
library: spring-boot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
delegatePattern: true
|
||||
java8: false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-spring-pageable-delegatePattern
|
||||
library: spring-boot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
delegatePattern: true
|
||||
additionalProperties:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-spring-pageable-without-j8
|
||||
library: spring-boot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
java8: false
|
||||
additionalProperties:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
generatorName: spring
|
||||
outputDir: samples/server/petstore/springboot-spring-pageable
|
||||
library: spring-boot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
documentationProvider: springfox
|
||||
|
||||
10
bin/configs/swift5-any-codable.yaml
Normal file
10
bin/configs/swift5-any-codable.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
generatorName: swift5
|
||||
outputDir: samples/client/petstore/swift5/anycodable
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/any_codable.yaml
|
||||
modelNamePrefix: Prefix
|
||||
modelNameSuffix: Suffix
|
||||
additionalProperties:
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
@@ -1,6 +0,0 @@
|
||||
generatorName: csharp-dotnet2
|
||||
outputDir: samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp-dotnet2
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
@@ -216,7 +216,7 @@ These options default to true and don't limit the generation of the feature opti
|
||||
|
||||
When using selective generation, _only_ the templates needed for the specific generation will be used.
|
||||
|
||||
To skip models defined as the form parameters in "requestBody", please use `skipFormModel` (default to `true`) (this option is introduced at v3.2.2 and `true` by default starting from v5.x).
|
||||
To skip models defined as the form parameters in "requestBody", please use `skipFormModel` (default to `true`) (this option is introduced at v3.2.2 and `true` by default starting from v5.0.0).
|
||||
|
||||
```sh
|
||||
--global-property skipFormModel=true
|
||||
@@ -458,7 +458,6 @@ OpenAPI Normalizer (off by default) transforms the input OpenAPI doc/spec (which
|
||||
|
||||
- `REF_AS_PARENT_IN_ALLOF`: when set to `true`, child schemas in `allOf` is considered a parent if it's a `$ref` (instead of inline schema).
|
||||
|
||||
|
||||
Example:
|
||||
```
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/allOf_extension_parent.yaml -o /tmp/java-okhttp/ --openapi-normalizer REF_AS_PARENT_IN_ALLOF=true
|
||||
@@ -485,7 +484,7 @@ 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.
|
||||
- `SIMPLIFY_ONEOF_ANYOF`: when set to `true`, simplify oneOf/anyOf by 1) removing null (sub-schema) or enum of 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:
|
||||
```
|
||||
@@ -505,3 +504,18 @@ 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
|
||||
```
|
||||
|
||||
- `ADD_UNSIGNED_TO_INTEGER_WITH_INVALID_MAX_VALUE`: when set to true, auto fix integer with maximum value 4294967295 (2^32-1) or long with 18446744073709551615 (2^64-1) by adding x-unsigned to the schema
|
||||
|
||||
Example:
|
||||
```
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/addUnsignedToIntegerWithInvalidMaxValue_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer ADD_UNSIGNED_TO_INTEGER_WITH_INVALID_MAX_VALUE=true
|
||||
```
|
||||
|
||||
- `REFACTOR_ALLOF_WITH_PROPERTIES_ONLY`: When set to true, refactor schema with allOf and properties in the same level to a schema with allOf only and, the allOf contains a new schema containing the properties in the top level.
|
||||
|
||||
Example:
|
||||
```
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/allOf_extension_parent.yaml -o /tmp/java-okhttp/ --openapi-normalizer REFACTOR_ALLOF_WITH_PROPERTIES_ONLY=true
|
||||
```
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ The following generators are available:
|
||||
* [cpp-ue4 (beta)](generators/cpp-ue4.md)
|
||||
* [crystal (beta)](generators/crystal.md)
|
||||
* [csharp](generators/csharp.md)
|
||||
* [csharp-dotnet2 (deprecated)](generators/csharp-dotnet2.md)
|
||||
* [csharp-netcore](generators/csharp-netcore.md)
|
||||
* [dart](generators/dart.md)
|
||||
* [dart-dio](generators/dart-dio.md)
|
||||
|
||||
@@ -105,6 +105,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>long</li>
|
||||
<li>long?</li>
|
||||
<li>string</li>
|
||||
<li>uint</li>
|
||||
<li>uint?</li>
|
||||
<li>ulong</li>
|
||||
<li>ulong?</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
@@ -1,293 +0,0 @@
|
||||
---
|
||||
title: Documentation for the csharp-dotnet2 Generator
|
||||
---
|
||||
|
||||
## METADATA
|
||||
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | csharp-dotnet2 | pass this to the generate command after -g |
|
||||
| generator stability | DEPRECATED | |
|
||||
| generator type | CLIENT | |
|
||||
| generator language | C# | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates a C# .Net 2.0 client library (beta). | |
|
||||
|
||||
## CONFIG OPTIONS
|
||||
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|clientPackage|C# client package name (convention: Camel.Case).| |Org.OpenAPITools.Client|
|
||||
|packageName|C# package name (convention: Camel.Case).| |Org.OpenAPITools|
|
||||
|packageVersion|C# package version.| |1.0.0|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|array|List|
|
||||
|list|List|
|
||||
|map|Dictionary|
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Boolean</li>
|
||||
<li>Collection</li>
|
||||
<li>DateTime</li>
|
||||
<li>DateTime?</li>
|
||||
<li>DateTimeOffset</li>
|
||||
<li>DateTimeOffset?</li>
|
||||
<li>Decimal</li>
|
||||
<li>Dictionary</li>
|
||||
<li>Double</li>
|
||||
<li>Float</li>
|
||||
<li>Guid</li>
|
||||
<li>Guid?</li>
|
||||
<li>ICollection</li>
|
||||
<li>Int32</li>
|
||||
<li>Int64</li>
|
||||
<li>List</li>
|
||||
<li>Object</li>
|
||||
<li>String</li>
|
||||
<li>System.IO.Stream</li>
|
||||
<li>bool</li>
|
||||
<li>bool?</li>
|
||||
<li>byte[]</li>
|
||||
<li>decimal</li>
|
||||
<li>decimal?</li>
|
||||
<li>double</li>
|
||||
<li>double?</li>
|
||||
<li>float</li>
|
||||
<li>float?</li>
|
||||
<li>int</li>
|
||||
<li>int?</li>
|
||||
<li>long</li>
|
||||
<li>long?</li>
|
||||
<li>string</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Client</li>
|
||||
<li>Configuration</li>
|
||||
<li>Version</li>
|
||||
<li>abstract</li>
|
||||
<li>as</li>
|
||||
<li>base</li>
|
||||
<li>bool</li>
|
||||
<li>break</li>
|
||||
<li>byte</li>
|
||||
<li>case</li>
|
||||
<li>catch</li>
|
||||
<li>char</li>
|
||||
<li>checked</li>
|
||||
<li>class</li>
|
||||
<li>client</li>
|
||||
<li>const</li>
|
||||
<li>continue</li>
|
||||
<li>decimal</li>
|
||||
<li>default</li>
|
||||
<li>delegate</li>
|
||||
<li>do</li>
|
||||
<li>double</li>
|
||||
<li>else</li>
|
||||
<li>enum</li>
|
||||
<li>event</li>
|
||||
<li>explicit</li>
|
||||
<li>extern</li>
|
||||
<li>false</li>
|
||||
<li>finally</li>
|
||||
<li>fixed</li>
|
||||
<li>float</li>
|
||||
<li>for</li>
|
||||
<li>foreach</li>
|
||||
<li>goto</li>
|
||||
<li>if</li>
|
||||
<li>implicit</li>
|
||||
<li>in</li>
|
||||
<li>int</li>
|
||||
<li>interface</li>
|
||||
<li>internal</li>
|
||||
<li>is</li>
|
||||
<li>localVarFileParams</li>
|
||||
<li>localVarFormParams</li>
|
||||
<li>localVarHeaderParams</li>
|
||||
<li>localVarHttpContentType</li>
|
||||
<li>localVarHttpContentTypes</li>
|
||||
<li>localVarHttpHeaderAccept</li>
|
||||
<li>localVarHttpHeaderAccepts</li>
|
||||
<li>localVarPath</li>
|
||||
<li>localVarPathParams</li>
|
||||
<li>localVarPostBody</li>
|
||||
<li>localVarQueryParams</li>
|
||||
<li>localVarResponse</li>
|
||||
<li>localVarStatusCode</li>
|
||||
<li>lock</li>
|
||||
<li>long</li>
|
||||
<li>namespace</li>
|
||||
<li>new</li>
|
||||
<li>null</li>
|
||||
<li>object</li>
|
||||
<li>operator</li>
|
||||
<li>out</li>
|
||||
<li>override</li>
|
||||
<li>parameter</li>
|
||||
<li>params</li>
|
||||
<li>private</li>
|
||||
<li>protected</li>
|
||||
<li>public</li>
|
||||
<li>readonly</li>
|
||||
<li>ref</li>
|
||||
<li>return</li>
|
||||
<li>sbyte</li>
|
||||
<li>sealed</li>
|
||||
<li>short</li>
|
||||
<li>sizeof</li>
|
||||
<li>stackalloc</li>
|
||||
<li>static</li>
|
||||
<li>string</li>
|
||||
<li>struct</li>
|
||||
<li>switch</li>
|
||||
<li>this</li>
|
||||
<li>throw</li>
|
||||
<li>true</li>
|
||||
<li>try</li>
|
||||
<li>typeof</li>
|
||||
<li>uint</li>
|
||||
<li>ulong</li>
|
||||
<li>unchecked</li>
|
||||
<li>unsafe</li>
|
||||
<li>ushort</li>
|
||||
<li>using</li>
|
||||
<li>virtual</li>
|
||||
<li>void</li>
|
||||
<li>volatile</li>
|
||||
<li>while</li>
|
||||
</ul>
|
||||
|
||||
## FEATURE SET
|
||||
|
||||
|
||||
### Client Modification Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasePath|✗|ToolingExtension
|
||||
|Authorizations|✗|ToolingExtension
|
||||
|UserAgent|✗|ToolingExtension
|
||||
|MockServer|✗|ToolingExtension
|
||||
|
||||
### Data Type Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Custom|✗|OAS2,OAS3
|
||||
|Int32|✓|OAS2,OAS3
|
||||
|Int64|✓|OAS2,OAS3
|
||||
|Float|✓|OAS2,OAS3
|
||||
|Double|✓|OAS2,OAS3
|
||||
|Decimal|✓|ToolingExtension
|
||||
|String|✓|OAS2,OAS3
|
||||
|Byte|✓|OAS2,OAS3
|
||||
|Binary|✓|OAS2,OAS3
|
||||
|Boolean|✓|OAS2,OAS3
|
||||
|Date|✓|OAS2,OAS3
|
||||
|DateTime|✓|OAS2,OAS3
|
||||
|Password|✓|OAS2,OAS3
|
||||
|File|✓|OAS2
|
||||
|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
|
||||
@@ -98,6 +98,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>long</li>
|
||||
<li>long?</li>
|
||||
<li>string</li>
|
||||
<li>uint</li>
|
||||
<li>uint?</li>
|
||||
<li>ulong</li>
|
||||
<li>ulong?</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
@@ -22,10 +22,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|apiName|Must be a valid C# class name. Only used in Generic Host library. Default: Api| |Api|
|
||||
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive| |false|
|
||||
|conditionalSerialization|Serialize only those properties which are initialized by user, accepted values are true or false, default value is false.| |false|
|
||||
|dateFormat|The default Date format (only `generichost` library supports this option).| |yyyy'-'MM'-'dd|
|
||||
|dateTimeFormat|The default DateTime format (only `generichost` library supports this option).| |yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|interfacePrefix|Prefix interfaces with a community standard or widely accepted prefix.| |I|
|
||||
|library|HTTP library template (sub-template) to use|<dl><dt>**generichost**</dt><dd>HttpClient with Generic Host dependency injection (https://docs.microsoft.com/en-us/dotnet/core/extensions/generic-host) (Experimental. Subject to breaking changes without notice.)</dd><dt>**httpclient**</dt><dd>HttpClient (https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) (Experimental. Subject to breaking changes without notice.)</dd><dt>**restsharp**</dt><dd>RestSharp (https://github.com/restsharp/RestSharp)</dd></dl>|restsharp|
|
||||
|library|HTTP library template (sub-template) to use|<dl><dt>**generichost**</dt><dd>HttpClient with Generic Host dependency injection (https://docs.microsoft.com/en-us/dotnet/core/extensions/generic-host) (Experimental. Subject to breaking changes without notice.)</dd><dt>**httpclient**</dt><dd>HttpClient (https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) (Experimental. Subject to breaking changes without notice.)</dd><dt>**unityWebRequest**</dt><dd>UnityWebRequest (...) (Experimental. Subject to breaking changes without notice.)</dd><dt>**restsharp**</dt><dd>RestSharp (https://github.com/restsharp/RestSharp)</dd></dl>|restsharp|
|
||||
|licenseId|The identifier of the license| |null|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |PascalCase|
|
||||
|netCoreProjectFile|Use the new format (.NET Core) for .NET project files (.csproj).| |false|
|
||||
@@ -41,6 +43,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|packageVersion|C# package version.| |1.0.0|
|
||||
|releaseNote|Release note, default to 'Minor update'.| |Minor update|
|
||||
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|
||||
|skipOneOfAnyOfGetter|Skip the generation of getter for sub-schemas in oneOf/anyOf models.| |false|
|
||||
|sourceFolder|source folder for generated code| |src|
|
||||
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.1`|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4 compatible</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5 compatible</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6 compatible</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0 compatible</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1 compatible</dd><dt>**netcoreapp3.1**</dt><dd>.NET Core 3.1 compatible (End of Support 13 Dec 2022)</dd><dt>**net47**</dt><dd>.NET Framework 4.7 compatible</dd><dt>**net48**</dt><dd>.NET Framework 4.8 compatible</dd><dt>**net6.0**</dt><dd>.NET 6.0 compatible</dd><dt>**net7.0**</dt><dd>.NET 7.0 compatible</dd></dl>|netstandard2.0|
|
||||
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
||||
@@ -99,6 +102,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>long</li>
|
||||
<li>long?</li>
|
||||
<li>string</li>
|
||||
<li>uint</li>
|
||||
<li>uint?</li>
|
||||
<li>ulong</li>
|
||||
<li>ulong?</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
@@ -93,6 +93,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>long</li>
|
||||
<li>long?</li>
|
||||
<li>string</li>
|
||||
<li>uint</li>
|
||||
<li>uint?</li>
|
||||
<li>ulong</li>
|
||||
<li>ulong?</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
@@ -218,7 +218,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|BasicAuth|✓|OAS2,OAS3
|
||||
|ApiKey|✓|OAS2,OAS3
|
||||
|OpenIDConnect|✗|OAS3
|
||||
|BearerToken|✗|OAS3
|
||||
|BearerToken|✓|OAS3
|
||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||
|OAuth2_Password|✗|OAS2,OAS3
|
||||
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|
||||
|
||||
@@ -56,6 +56,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|
||||
|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false|
|
||||
|generatedConstructorWithRequiredArgs|Whether to generate constructors with required args for models| |true|
|
||||
|groupId|groupId in generated pom.xml| |org.openapitools|
|
||||
|hateoas|Use Spring HATEOAS library to allow adding HATEOAS links| |false|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|
||||
@@ -96,6 +97,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|
||||
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|
||||
|useOptional|Use Optional container for optional parameters| |false|
|
||||
|useResponseEntity|Use the `ResponseEntity` type to wrap return values of generated API methods. If disabled, method are annotated using a `@ResponseStatus` annotation, which has the status of the first response declared in the Api definition| |true|
|
||||
|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|
|
||||
|useSpringController|Annotate the generated API as a Spring Controller| |false|
|
||||
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|
||||
|
||||
@@ -29,10 +29,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-micronaut-client|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|authorizationFilterPattern|Configure the authorization filter pattern for the client. Generally defined when generating clients from multiple specification files| |null|
|
||||
|basePathSeparator|Configure the separator to use between the application name and base path when referencing the property| |-|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|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|
|
||||
|clientId|Configure the service ID for the Client| |null|
|
||||
|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|
|
||||
|
||||
@@ -38,7 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|returnResponse|Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true. This option is currently supported only when using jaxrs-spec library.| |false|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson'| |moshi|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson or 'kotlinx_serialization'| |moshi|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
|
||||
@@ -40,10 +40,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|reactive|use coroutines for reactive behavior| |false|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson'| |moshi|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson or 'kotlinx_serialization'| |moshi|
|
||||
|serverPort|configuration the port in which the sever is to run on| |8080|
|
||||
|serviceImplementation|generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated| |false|
|
||||
|serviceInterface|generate service interfaces to go alongside controllers. In most cases this option would be used to update an existing project, so not to override implementations. Useful to help facilitate the generation gap pattern| |false|
|
||||
|skipDefaultInterface|Whether to skip generation of default implementations for interfaces| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
|
||||
@@ -28,7 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|packageName|Generated artifact package name.| |org.openapitools|
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson'| |moshi|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson or 'kotlinx_serialization'| |moshi|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
|
||||
@@ -37,7 +37,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|
||||
|requestDateConverter|JVM-Option. Defines in how to handle date-time objects that are used for a request (as query or parameter)|<dl><dt>**toJson**</dt><dd>[DEFAULT] Date formatter option using a json converter.</dd><dt>**toString**</dt><dd>Use the 'toString'-method of the date-time object to retrieve the related string representation.</dd></dl>|toJson|
|
||||
|serializableModel|boolean - toggle "implements Serializable" for generated models| |null|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson'| |moshi|
|
||||
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson or 'kotlinx_serialization'| |moshi|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
@@ -46,6 +46,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useRxJava|Whether to use the RxJava adapter with the retrofit2 library. IMPORTANT: this option has been deprecated. Please use `useRxJava3` instead.| |false|
|
||||
|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: this option has been deprecated. Please use `useRxJava3` instead.| |false|
|
||||
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library.| |false|
|
||||
|useSettingsGradle|Whether the project uses settings.gradle.| |false|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
|
||||
@@ -19,14 +19,13 @@ 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|
|
||||
|dateFormat|date format for query parameters| |%Y-%m-%d|
|
||||
|datetimeFormat|datetime format for query parameters| |%Y-%m-%dT%H:%M:%S%z|
|
||||
|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|
|
||||
|mapNumberTo|Map number to Union[StrictFloat, StrictInt], StrictStr or float.| |Union[StrictFloat, StrictInt]|
|
||||
|packageName|python package name (convention: snake_case).| |openapi_client|
|
||||
|packageUrl|python package URL.| |null|
|
||||
|packageVersion|python package version.| |1.0.0|
|
||||
@@ -51,6 +50,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>Dict</li>
|
||||
<li>List</li>
|
||||
<li>bool</li>
|
||||
<li>bytearray</li>
|
||||
<li>bytes</li>
|
||||
<li>date</li>
|
||||
<li>datetime</li>
|
||||
@@ -59,6 +59,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>float</li>
|
||||
<li>int</li>
|
||||
<li>list</li>
|
||||
<li>none_type</li>
|
||||
<li>object</li>
|
||||
<li>str</li>
|
||||
</ul>
|
||||
|
||||
@@ -49,6 +49,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|
||||
|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false|
|
||||
|generatedConstructorWithRequiredArgs|Whether to generate constructors with required args for models| |true|
|
||||
|groupId|groupId in generated pom.xml| |org.openapitools|
|
||||
|hateoas|Use Spring HATEOAS library to allow adding HATEOAS links| |false|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|
||||
@@ -89,6 +90,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|
||||
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|
||||
|useOptional|Use Optional container for optional parameters| |false|
|
||||
|useResponseEntity|Use the `ResponseEntity` type to wrap return values of generated API methods. If disabled, method are annotated using a `@ResponseStatus` annotation, which has the status of the first response declared in the Api definition| |true|
|
||||
|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|
|
||||
|useSpringController|Annotate the generated API as a Spring Controller| |false|
|
||||
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|
||||
|
||||
@@ -73,6 +73,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Any</li>
|
||||
<li>AnyCodable</li>
|
||||
<li>AnyObject</li>
|
||||
<li>Bool</li>
|
||||
<li>Character</li>
|
||||
|
||||
@@ -21,6 +21,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|
|
||||
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
|
||||
|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|
|
||||
|fileContentDataType|Specifies the type to use for the content of a file - i.e. Blob (Browser, Deno) / Buffer (node)| |Buffer|
|
||||
|framework|Specify the framework which should be used in the client code.|<dl><dt>**fetch-api**</dt><dd>fetch-api</dd><dt>**jquery**</dt><dd>jquery</dd></dl>|fetch-api|
|
||||
@@ -30,6 +32,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|platform|Specifies the platform the code should run on. The default is 'node' for the 'request' framework and 'browser' otherwise.|<dl><dt>**browser**</dt><dd>browser</dd><dt>**node**</dt><dd>node</dd><dt>**deno**</dt><dd>deno</dd></dl>|browser|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
@@ -67,11 +71,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>Long</li>
|
||||
<li>Map</li>
|
||||
<li>Object</li>
|
||||
<li>ReadonlyArray</li>
|
||||
<li>Set</li>
|
||||
<li>String</li>
|
||||
<li>any</li>
|
||||
<li>boolean</li>
|
||||
<li>number</li>
|
||||
<li>object</li>
|
||||
<li>string</li>
|
||||
</ul>
|
||||
|
||||
@@ -156,7 +162,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
### Client Modification Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasePath|✗|ToolingExtension
|
||||
|BasePath|✓|ToolingExtension
|
||||
|Authorizations|✗|ToolingExtension
|
||||
|UserAgent|✗|ToolingExtension
|
||||
|MockServer|✗|ToolingExtension
|
||||
@@ -201,7 +207,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
### Documentation Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Readme|✗|ToolingExtension
|
||||
|Readme|✓|ToolingExtension
|
||||
|Model|✓|ToolingExtension
|
||||
|Api|✓|ToolingExtension
|
||||
|
||||
@@ -221,7 +227,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|MultiServer|✗|OAS3
|
||||
|ParameterizedServer|✗|OAS3
|
||||
|ParameterStyling|✗|OAS3
|
||||
|Callbacks|✓|OAS3
|
||||
|Callbacks|✗|OAS3
|
||||
|LinkObjects|✗|OAS3
|
||||
|
||||
### Parameter Feature
|
||||
@@ -250,14 +256,14 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
### Security Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasicAuth|✓|OAS2,OAS3
|
||||
|ApiKey|✓|OAS2,OAS3
|
||||
|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
|
||||
|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 |
|
||||
|
||||
@@ -96,14 +96,14 @@ This gives access to the following tasks:
|
||||
|
||||
> The plugin implements the above tasks as project extensions of the same name. If you’d like to declare these tasks as dependencies to other tasks (using `dependsOn`), you’ll need a task reference. e.g.:
|
||||
> ```groovy
|
||||
> compileJava.dependsOn tasks.openApiGenerate
|
||||
> compileJava.dependsOn tasks.named("openApiGenerate")
|
||||
> ```
|
||||
|
||||
For full details of all options, see the [plugin README](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-gradle-plugin).
|
||||
|
||||
### Example
|
||||
|
||||
An example task for generating a kotlin client:
|
||||
An example openApiGenerate task configuration for generating a kotlin client:
|
||||
|
||||
```groovy
|
||||
openApiGenerate {
|
||||
@@ -113,8 +113,10 @@ openApiGenerate {
|
||||
apiPackage = "org.openapi.example.api"
|
||||
invokerPackage = "org.openapi.example.invoker"
|
||||
modelPackage = "org.openapi.example.model"
|
||||
configOptions = [
|
||||
configOptions.putAll([
|
||||
dateLibrary: "java8"
|
||||
]
|
||||
])
|
||||
}
|
||||
```
|
||||
|
||||
*If you want to create separate tasks (for example when you have more than one api spec and require different parameters for each), this is how to do so in Gradle 7+: `tasks.register('taskName', org.openapitools.generator.gradle.plugin.tasks.GenerateTask) { ... }`.*
|
||||
|
||||
42
flake.lock
generated
Normal file
42
flake.lock
generated
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1676283394,
|
||||
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1678083093,
|
||||
"narHash": "sha256-eTkS9GcdSAYA3cE9zCAAs9wY3+oM2zT45ydIkAcEFFQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "684306b246d05168e42425a3610df7e2c4d51fcd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
23
flake.nix
Normal file
23
flake.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
description = "OpenAPI generator nix flake";
|
||||
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell
|
||||
{
|
||||
buildInputs = with pkgs;[
|
||||
jdk8
|
||||
maven
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
<apiPackage>remote.org.openapitools.client.api</apiPackage>
|
||||
<modelPackage>remote.org.openapitools.client.model</modelPackage>
|
||||
<invokerPackage>remote.org.openapitools.client</invokerPackage>
|
||||
<cleanupOutput>true</cleanupOutput>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -76,8 +77,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<proc>none</proc>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
<configuration>
|
||||
<!-- specify the swagger yaml -->
|
||||
<inputSpec>${project.basedir}/swagger.yaml</inputSpec>
|
||||
<cleanupOutput>true</cleanupOutput>
|
||||
|
||||
<!-- target to generate kotlin client code -->
|
||||
<generatorName>kotlin</generatorName>
|
||||
|
||||
@@ -59,8 +59,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<proc>none</proc>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -41,6 +41,7 @@ import java.util.Set;
|
||||
import com.google.common.io.ByteSource;
|
||||
import com.google.common.io.CharSource;
|
||||
import io.swagger.v3.parser.util.ClasspathHelper;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
@@ -99,6 +100,9 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(name = "output", property = "openapi.generator.maven.plugin.output")
|
||||
private File output;
|
||||
|
||||
@Parameter(name = "cleanupOutput", property = "openapi.generator.maven.plugin.cleanupOutput", defaultValue = "false")
|
||||
private boolean cleanupOutput;
|
||||
|
||||
/**
|
||||
* Location of the OpenAPI spec, as URL or file.
|
||||
*/
|
||||
@@ -494,6 +498,16 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
LifecyclePhase.GENERATE_TEST_SOURCES.id().equals(mojo.getLifecyclePhase()) ?
|
||||
"generated-test-sources/openapi" : "generated-sources/openapi");
|
||||
}
|
||||
|
||||
if (cleanupOutput) {
|
||||
try {
|
||||
FileUtils.deleteDirectory(output);
|
||||
LOGGER.info("Previous run output is removed from {}", output);
|
||||
} catch (IOException e) {
|
||||
LOGGER.warn("Failed to clean-up output directory {}", output, e);
|
||||
}
|
||||
}
|
||||
|
||||
addCompileSourceRootIfConfigured();
|
||||
|
||||
try {
|
||||
|
||||
@@ -272,6 +272,12 @@
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons-io.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-ext</artifactId>
|
||||
|
||||
@@ -378,6 +378,9 @@ public class CodegenConstants {
|
||||
public static final String REMOVE_ENUM_VALUE_PREFIX = "removeEnumValuePrefix";
|
||||
public static final String REMOVE_ENUM_VALUE_PREFIX_DESC = "Remove the common prefix of enum values";
|
||||
|
||||
public static final String SKIP_ONEOF_ANYOF_GETTER = "skipOneOfAnyOfGetter";
|
||||
public static final String SKIP_ONEOF_ANYOF_GETTER_DESC = "Skip the generation of getter for sub-schemas in oneOf/anyOf models.";
|
||||
|
||||
public static final String LEGACY_DISCRIMINATOR_BEHAVIOR = "legacyDiscriminatorBehavior";
|
||||
public static final String LEGACY_DISCRIMINATOR_BEHAVIOR_DESC = "Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).";
|
||||
|
||||
@@ -388,10 +391,12 @@ public class CodegenConstants {
|
||||
public static final String DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_DESC =
|
||||
"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.";
|
||||
|
||||
public static final String UNSUPPORTED_V310_SPEC_MSG =
|
||||
"Generation using 3.1.0 specs is in development and is not officially supported yet. " +
|
||||
"If you would like to expedite development, please consider woking on the open issues in the 3.1.0 project: https://github.com/orgs/OpenAPITools/projects/4/views/1 " +
|
||||
"and reach out to our team on Slack at https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g";
|
||||
|
||||
public static final String ENUM_UNKNOWN_DEFAULT_CASE = "enumUnknownDefaultCase";
|
||||
public static final String ENUM_UNKNOWN_DEFAULT_CASE_DESC =
|
||||
"If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response." +
|
||||
@@ -399,13 +404,13 @@ public class CodegenConstants {
|
||||
|
||||
public static final String USE_ONEOF_DISCRIMINATOR_LOOKUP = "useOneOfDiscriminatorLookup";
|
||||
public static final String USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC = "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.";
|
||||
|
||||
public static final String INIT_REQUIRED_VARS = "initRequiredVars";
|
||||
public static final String INIT_REQUIRED_VARS_DESC = "If set to true then the required variables are included as positional arguments in __init__ and _from_openapi_data methods. Note: this can break some composition use cases. To learn more read PR #8802.";
|
||||
|
||||
public static final String ERROR_OBJECT_TYPE = "errorObjectType";
|
||||
|
||||
public static final String NON_COMPLIANT_USE_DISCR_IF_COMPOSITION_FAILS = "nonCompliantUseDiscriminatorIfCompositionFails";
|
||||
|
||||
public static final String NON_COMPLIANT_USE_DISCR_IF_COMPOSITION_FAILS_DESC =
|
||||
"When true, If the payload fails to validate against composed schemas (allOf/anyOf/oneOf/not) and a " +
|
||||
"discriminator is present, then ignore the composition validation errors and attempt to use the " +
|
||||
|
||||
@@ -1209,10 +1209,25 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void addDiscriminatorMappedModelsImports() {
|
||||
/*
|
||||
* To clean up mapped models if needed and add mapped models to imports
|
||||
*
|
||||
* @param cleanUpMappedModels Clean up mapped models if set to true
|
||||
*/
|
||||
public void addDiscriminatorMappedModelsImports(boolean cleanUpMappedModels) {
|
||||
if (discriminator == null || discriminator.getMappedModels() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cleanUpMappedModels && !this.hasChildren && // no child
|
||||
(this.oneOf == null || this.oneOf.isEmpty()) && // not oneOf
|
||||
(this.anyOf == null || this.anyOf.isEmpty())) { // not anyOf
|
||||
//clear the mapping
|
||||
discriminator.setMappedModels(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// import child schemas defined in mapped models
|
||||
for (CodegenDiscriminator.MappedModel mm : discriminator.getMappedModels()) {
|
||||
if (!"".equals(mm.getModelName())) {
|
||||
imports.add(mm.getModelName());
|
||||
|
||||
@@ -35,7 +35,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
public String example; // example value (x-example)
|
||||
public String jsonSchema;
|
||||
public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary,
|
||||
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isShort, isUnboundedInteger;
|
||||
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isPassword, isFreeFormObject, isAnyType, isShort, isUnboundedInteger;
|
||||
public boolean isArray, isMap;
|
||||
public boolean isFile;
|
||||
public boolean isEnum;
|
||||
@@ -229,6 +229,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
output.isUuid = this.isUuid;
|
||||
output.isUri = this.isUri;
|
||||
output.isEmail = this.isEmail;
|
||||
output.isPassword = this.isPassword;
|
||||
output.isFreeFormObject = this.isFreeFormObject;
|
||||
output.isAnyType = this.isAnyType;
|
||||
output.isArray = this.isArray;
|
||||
@@ -244,7 +245,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumDefaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, schema, content, requiredVarsMap, ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties);
|
||||
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumDefaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isPassword, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, schema, content, requiredVarsMap, ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -281,6 +282,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
isUuid == that.isUuid &&
|
||||
isUri == that.isUri &&
|
||||
isEmail == that.isEmail &&
|
||||
isPassword == that.isPassword &&
|
||||
isFreeFormObject == that.isFreeFormObject &&
|
||||
isAnyType == that.isAnyType &&
|
||||
isArray == that.isArray &&
|
||||
@@ -394,6 +396,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
sb.append(", isUuid=").append(isUuid);
|
||||
sb.append(", isUri=").append(isUri);
|
||||
sb.append(", isEmail=").append(isEmail);
|
||||
sb.append(", isPassword=").append(isPassword);
|
||||
sb.append(", isFreeFormObject=").append(isFreeFormObject);
|
||||
sb.append(", isAnyType=").append(isAnyType);
|
||||
sb.append(", isArray=").append(isArray);
|
||||
|
||||
@@ -134,6 +134,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
public boolean isUuid;
|
||||
public boolean isUri;
|
||||
public boolean isEmail;
|
||||
public boolean isPassword;
|
||||
public boolean isNull;
|
||||
/**
|
||||
* The type is a free-form object, i.e. it is a map of string to values with no declared properties.
|
||||
@@ -158,6 +159,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
public boolean isCircularReference;
|
||||
public boolean isDiscriminator;
|
||||
public boolean isNew; // true when this property overrides an inherited property
|
||||
public Boolean isOverridden; // true if the property is a parent property (not defined in child/current schema)
|
||||
public List<String> _enum;
|
||||
public Map<String, Object> allowableValues;
|
||||
// If 'additionalProperties' is not set, items is null.
|
||||
@@ -1051,6 +1053,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
sb.append(", isUuid=").append(isUuid);
|
||||
sb.append(", isUri=").append(isUri);
|
||||
sb.append(", isEmail=").append(isEmail);
|
||||
sb.append(", isPassword=").append(isPassword);
|
||||
sb.append(", isFreeFormObject=").append(isFreeFormObject);
|
||||
sb.append(", isArray=").append(isArray);
|
||||
sb.append(", isMap=").append(isMap);
|
||||
@@ -1065,6 +1068,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
sb.append(", isCircularReference=").append(isCircularReference);
|
||||
sb.append(", isDiscriminator=").append(isDiscriminator);
|
||||
sb.append(", isNew=").append(isNew);
|
||||
sb.append(", isOverridden=").append(isOverridden);
|
||||
sb.append(", _enum=").append(_enum);
|
||||
sb.append(", allowableValues=").append(allowableValues);
|
||||
sb.append(", items=").append(items);
|
||||
@@ -1142,6 +1146,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
isUuid == that.isUuid &&
|
||||
isUri == that.isUri &&
|
||||
isEmail == that.isEmail &&
|
||||
isPassword == that.isPassword &&
|
||||
isFreeFormObject == that.isFreeFormObject &&
|
||||
isArray == that.isArray &&
|
||||
isMap == that.isMap &&
|
||||
@@ -1156,6 +1161,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
isCircularReference == that.isCircularReference &&
|
||||
isDiscriminator == that.isDiscriminator &&
|
||||
isNew == that.isNew &&
|
||||
isOverridden == that.isOverridden &&
|
||||
hasValidation == that.hasValidation &&
|
||||
isInherited == that.isInherited &&
|
||||
isXmlAttribute == that.isXmlAttribute &&
|
||||
@@ -1231,9 +1237,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
exclusiveMinimum, exclusiveMaximum, required, deprecated,
|
||||
hasMoreNonReadOnly, isPrimitiveType, isModel, isContainer, isString, isNumeric,
|
||||
isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isFile,
|
||||
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject,
|
||||
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isPassword, isFreeFormObject,
|
||||
isArray, isMap, isEnum, isInnerEnum, isEnumRef, isAnyType, isReadOnly, isWriteOnly, isNullable, isShort,
|
||||
isUnboundedInteger, isSelfReference, isCircularReference, isDiscriminator, isNew, _enum,
|
||||
isUnboundedInteger, isSelfReference, isCircularReference, isDiscriminator, isNew, isOverridden, _enum,
|
||||
allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars,
|
||||
vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase,
|
||||
nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName,
|
||||
|
||||
@@ -50,6 +50,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
public boolean isDateTime;
|
||||
public boolean isUuid;
|
||||
public boolean isEmail;
|
||||
public boolean isPassword;
|
||||
public boolean isModel;
|
||||
public boolean isFreeFormObject;
|
||||
public boolean isAnyType;
|
||||
@@ -98,7 +99,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
public int hashCode() {
|
||||
return Objects.hash(headers, code, message, examples, dataType, baseType, containerType, hasHeaders,
|
||||
isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBoolean, isDate,
|
||||
isDateTime, isUuid, isEmail, isModel, isFreeFormObject, isAnyType, isDefault, simpleType, primitiveType,
|
||||
isDateTime, isUuid, isEmail, isPassword, isModel, isFreeFormObject, isAnyType, isDefault, simpleType, primitiveType,
|
||||
isMap, isArray, isBinary, isFile, schema, jsonSchema, vendorExtensions, items, additionalProperties,
|
||||
vars, requiredVars, isNull, hasValidation, isShort, isUnboundedInteger,
|
||||
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
|
||||
@@ -130,6 +131,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
isDateTime == that.isDateTime &&
|
||||
isUuid == that.isUuid &&
|
||||
isEmail == that.isEmail &&
|
||||
isPassword == that.isPassword &&
|
||||
isModel == that.isModel &&
|
||||
isFreeFormObject == that.isFreeFormObject &&
|
||||
isAnyType == that.isAnyType &&
|
||||
@@ -568,6 +570,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
sb.append(", isDateTime=").append(isDateTime);
|
||||
sb.append(", isUuid=").append(isUuid);
|
||||
sb.append(", isEmail=").append(isEmail);
|
||||
sb.append(", isPassword=").append(isPassword);
|
||||
sb.append(", isModel=").append(isModel);
|
||||
sb.append(", isFreeFormObject=").append(isFreeFormObject);
|
||||
sb.append(", isAnyType=").append(isAnyType);
|
||||
|
||||
@@ -25,15 +25,32 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Mustache.Compiler;
|
||||
import com.samskivert.mustache.Mustache.Lambda;
|
||||
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.PathItem;
|
||||
import io.swagger.v3.oas.models.callbacks.Callback;
|
||||
import io.swagger.v3.oas.models.examples.Example;
|
||||
import io.swagger.v3.oas.models.headers.Header;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.oas.models.parameters.*;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.models.security.OAuthFlow;
|
||||
import io.swagger.v3.oas.models.security.OAuthFlows;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import io.swagger.v3.oas.models.servers.ServerVariable;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
import org.openapitools.codegen.CodegenDiscriminator.MappedModel;
|
||||
import org.openapitools.codegen.api.TemplatingEngineAdapter;
|
||||
import org.openapitools.codegen.config.GlobalSettings;
|
||||
import org.openapitools.codegen.examples.ExampleGenerator;
|
||||
import org.openapitools.codegen.languages.PythonClientCodegen;
|
||||
import org.openapitools.codegen.languages.RustServerCodegen;
|
||||
import org.openapitools.codegen.meta.FeatureSet;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
@@ -595,6 +612,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
/**
|
||||
* Loop through all models to update different flags (e.g. isSelfReference), children models, etc
|
||||
* and update mapped models for import.
|
||||
*
|
||||
* @param objs Map of models
|
||||
* @return maps of models with various updates
|
||||
@@ -645,10 +663,17 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// loop through properties of each model to detect self-reference
|
||||
// and update mapped models for import
|
||||
for (ModelsMap entry : objs.values()) {
|
||||
for (ModelMap mo : entry.getModels()) {
|
||||
CodegenModel cm = mo.getModel();
|
||||
removeSelfReferenceImports(cm);
|
||||
|
||||
if (!this.getLegacyDiscriminatorBehavior()) {
|
||||
// skip cleaning up mapped models for python client generator
|
||||
// which uses its own logic
|
||||
cm.addDiscriminatorMappedModelsImports(!(this instanceof PythonClientCodegen));
|
||||
}
|
||||
}
|
||||
}
|
||||
setCircularReferences(allModels);
|
||||
@@ -1728,9 +1753,11 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("DateTime", "Date");
|
||||
typeMapping.put("long", "Long");
|
||||
typeMapping.put("short", "Short");
|
||||
typeMapping.put("integer", "Integer");
|
||||
typeMapping.put("UnsignedInteger", "Integer");
|
||||
typeMapping.put("UnsignedLong", "Long");
|
||||
typeMapping.put("char", "String");
|
||||
typeMapping.put("object", "Object");
|
||||
typeMapping.put("integer", "Integer");
|
||||
// FIXME: java specific type should be in Java Based Abstract Impl's
|
||||
typeMapping.put("ByteArray", "byte[]");
|
||||
typeMapping.put("binary", "File");
|
||||
@@ -2394,8 +2421,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return "number";
|
||||
}
|
||||
} else if (ModelUtils.isIntegerSchema(schema)) {
|
||||
if (ModelUtils.isLongSchema(schema)) {
|
||||
if (ModelUtils.isUnsignedLongSchema(schema)) {
|
||||
return "UnsignedLong";
|
||||
} else if (ModelUtils.isUnsignedIntegerSchema(schema)) {
|
||||
return "UnsignedInteger";
|
||||
} else if (ModelUtils.isLongSchema(schema)) {
|
||||
return "long";
|
||||
} else if (ModelUtils.isShortSchema(schema)) {// int32
|
||||
return "integer";
|
||||
} else {
|
||||
return schema.getType(); // integer
|
||||
}
|
||||
@@ -2631,9 +2664,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (m.discriminator == null && innerSchema.getDiscriminator() != null) {
|
||||
LOGGER.debug("discriminator is set to null (not correctly set earlier): {}", m.name);
|
||||
m.setDiscriminator(createDiscriminator(m.name, innerSchema, this.openAPI));
|
||||
if (!this.getLegacyDiscriminatorBehavior()) {
|
||||
m.addDiscriminatorMappedModelsImports();
|
||||
}
|
||||
modelDiscriminators++;
|
||||
}
|
||||
|
||||
@@ -2788,6 +2818,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (Boolean.TRUE.equals(schema.getNullable())) {
|
||||
m.isNullable = Boolean.TRUE;
|
||||
}
|
||||
|
||||
// end of code block for composed schema
|
||||
}
|
||||
|
||||
@@ -2975,9 +3006,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
m.isAlias = (typeAliases.containsKey(name)
|
||||
|| isAliasOfSimpleTypes(schema)); // check if the unaliased schema is an alias of simple OAS types
|
||||
m.setDiscriminator(createDiscriminator(name, schema, this.openAPI));
|
||||
if (!this.getLegacyDiscriminatorBehavior()) {
|
||||
m.addDiscriminatorMappedModelsImports();
|
||||
}
|
||||
|
||||
if (schema.getDeprecated() != null) {
|
||||
m.isDeprecated = schema.getDeprecated();
|
||||
@@ -3024,7 +3052,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// referenced models here, component that refs another component which is a model
|
||||
// if a component references a schema which is not a generated model, the refed schema will be loaded into
|
||||
// schema by unaliasSchema and one of the above code paths will be taken
|
||||
;
|
||||
}
|
||||
if (schema.get$ref() != null) {
|
||||
m.setRef(schema.get$ref());
|
||||
@@ -3432,16 +3459,16 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
break;
|
||||
}
|
||||
currentSchemaName = queue.remove(0);
|
||||
MappedModel mm = new MappedModel(currentSchemaName, toModelName(currentSchemaName));
|
||||
descendentSchemas.add(mm);
|
||||
Schema cs = schemas.get(currentSchemaName);
|
||||
Map<String, Object> vendorExtensions = cs.getExtensions();
|
||||
if (vendorExtensions != null && !vendorExtensions.isEmpty() && vendorExtensions.containsKey("x-discriminator-value")) {
|
||||
String xDiscriminatorValue = (String) vendorExtensions.get("x-discriminator-value");
|
||||
mm = new MappedModel(xDiscriminatorValue, toModelName(currentSchemaName));
|
||||
String mappingName =
|
||||
Optional.ofNullable(vendorExtensions)
|
||||
.map(ve -> ve.get("x-discriminator-value"))
|
||||
.map(discriminatorValue -> (String) discriminatorValue)
|
||||
.orElse(currentSchemaName);
|
||||
MappedModel mm = new MappedModel(mappingName, toModelName(currentSchemaName));
|
||||
descendentSchemas.add(mm);
|
||||
}
|
||||
}
|
||||
return descendentSchemas;
|
||||
}
|
||||
|
||||
@@ -3490,10 +3517,11 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// for schemas that allOf inherit from this schema, add those descendants to this discriminator map
|
||||
List<MappedModel> otherDescendants = getAllOfDescendants(schemaName, openAPI);
|
||||
for (MappedModel otherDescendant : otherDescendants) {
|
||||
// add only if the mapping names are not the same
|
||||
// add only if the mapping names are not the same and the model names are not the same
|
||||
boolean matched = false;
|
||||
for (MappedModel uniqueDescendant : uniqueDescendants) {
|
||||
if (uniqueDescendant.getMappingName().equals(otherDescendant.getMappingName())) {
|
||||
if (uniqueDescendant.getMappingName().equals(otherDescendant.getMappingName())
|
||||
|| (uniqueDescendant.getModelName().equals(otherDescendant.getModelName()))) {
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
@@ -3672,6 +3700,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
property.isUri = true;
|
||||
} else if (ModelUtils.isEmailSchema(p)) {
|
||||
property.isEmail = true;
|
||||
} else if (ModelUtils.isPasswordSchema(p)) {
|
||||
property.isPassword = true;
|
||||
} else if (ModelUtils.isDateSchema(p)) { // date format
|
||||
property.setIsString(false); // for backward compatibility with 2.x
|
||||
property.isDate = true;
|
||||
@@ -3764,6 +3794,18 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return cpc;
|
||||
}
|
||||
|
||||
Schema original = null;
|
||||
// check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level
|
||||
if (ModelUtils.isAllOf(p) && p.getAllOf().size() == 1 && !(this instanceof PythonClientCodegen)) {
|
||||
if (p.getAllOf().get(0) instanceof Schema) {
|
||||
original = p;
|
||||
p = (Schema) p.getAllOf().get(0);
|
||||
} else {
|
||||
LOGGER.error("Unknown type in allOf schema. Please report the issue via openapi-generator's Github issue tracker.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
|
||||
if (p.equals(trueSchema)) {
|
||||
property.setIsBooleanSchemaTrue(true);
|
||||
@@ -3920,7 +3962,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
property.baseType = getSchemaType(p);
|
||||
if (p.getXml() != null) {
|
||||
property.isXmlWrapped = p.getXml().getWrapped() == null ? false : p.getXml().getWrapped();
|
||||
property.isXmlWrapped = p.getXml().getWrapped() != null && p.getXml().getWrapped();
|
||||
property.xmlPrefix = p.getXml().getPrefix();
|
||||
property.xmlNamespace = p.getXml().getNamespace();
|
||||
property.xmlName = p.getXml().getName();
|
||||
@@ -3957,6 +3999,25 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
property.isModel = (ModelUtils.isComposedSchema(referencedSchema) || ModelUtils.isObjectSchema(referencedSchema)) && ModelUtils.isModel(referencedSchema);
|
||||
}
|
||||
|
||||
// restore original schema with default value, nullable, readonly etc
|
||||
if (original != null) {
|
||||
p = original;
|
||||
// evaluate common attributes if defined in the top level
|
||||
if (p.getNullable() != null) {
|
||||
property.isNullable = p.getNullable();
|
||||
} else if (p.getExtensions() != null && p.getExtensions().containsKey("x-nullable")) {
|
||||
property.isNullable = (Boolean) p.getExtensions().get("x-nullable");
|
||||
}
|
||||
|
||||
if (p.getReadOnly() != null) {
|
||||
property.isReadOnly = p.getReadOnly();
|
||||
}
|
||||
|
||||
if (p.getWriteOnly() != null) {
|
||||
property.isWriteOnly = p.getWriteOnly();
|
||||
}
|
||||
}
|
||||
|
||||
// set the default value
|
||||
property.defaultValue = toDefaultValue(property, p);
|
||||
property.defaultValueWithParam = toDefaultValueWithParam(name, p);
|
||||
@@ -4699,6 +4760,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else if (ModelUtils.isStringSchema(responseSchema)) {
|
||||
if (ModelUtils.isEmailSchema(responseSchema)) {
|
||||
r.isEmail = true;
|
||||
} else if (ModelUtils.isPasswordSchema(responseSchema)) {
|
||||
r.isPassword = true;
|
||||
} else if (ModelUtils.isUUIDSchema(responseSchema)) {
|
||||
r.isUuid = true;
|
||||
} else if (ModelUtils.isByteArraySchema(responseSchema)) {
|
||||
@@ -5009,7 +5072,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// the default value is false
|
||||
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-parameterexplode
|
||||
codegenParameter.isExplode = parameter.getExplode() == null ? false : parameter.getExplode();
|
||||
codegenParameter.isExplode = parameter.getExplode() != null && parameter.getExplode();
|
||||
|
||||
// TODO revise collectionFormat, default collection format in OAS 3 appears to multi at least for query parameters
|
||||
// https://swagger.io/docs/specification/serialization/
|
||||
@@ -5038,7 +5101,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (ModelUtils.isShortSchema(parameterSchema)) { // int32/short format
|
||||
codegenParameter.isShort = true;
|
||||
} else { // unbounded integer
|
||||
;
|
||||
}
|
||||
}
|
||||
} else if (ModelUtils.isTypeObjectSchema(parameterSchema)) {
|
||||
@@ -5050,7 +5112,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
addVarsRequiredVarsAdditionalProps(parameterSchema, codegenParameter);
|
||||
} else if (ModelUtils.isNullType(parameterSchema)) {
|
||||
;
|
||||
} else if (ModelUtils.isAnyType(parameterSchema)) {
|
||||
// any schema with no type set, composed schemas often do this
|
||||
if (ModelUtils.isMapSchema(parameterSchema)) { // for map parameter
|
||||
@@ -5078,7 +5139,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
} else {
|
||||
// referenced schemas
|
||||
;
|
||||
}
|
||||
|
||||
CodegenProperty codegenProperty = fromProperty(parameter.getName(), parameterSchema, false);
|
||||
@@ -5563,6 +5623,10 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param modelName model name
|
||||
*/
|
||||
protected void addImport(ComposedSchema composed, Schema childSchema, CodegenModel model, String modelName ) {
|
||||
if (composed == null || childSchema == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// import only if it's not allOf composition schema (without discriminator)
|
||||
if (!(composed.getAllOf() != null && childSchema.getDiscriminator() == null)) {
|
||||
addImport(model, modelName);
|
||||
@@ -5660,6 +5724,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
for (CodegenProperty var : cm.vars) {
|
||||
// create a map of codegen properties for lookup later
|
||||
varsMap.put(var.baseName, var);
|
||||
var.isOverridden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5684,6 +5749,10 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
cp = fromProperty(key, prop, mandatory.contains(key));
|
||||
}
|
||||
|
||||
if (cm != null && cm.allVars == vars && cp.isOverridden == null) { // processing allVars and it's a parent property
|
||||
cp.isOverridden = true;
|
||||
}
|
||||
|
||||
vars.add(cp);
|
||||
m.setHasVars(true);
|
||||
|
||||
@@ -6247,6 +6316,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
if (Boolean.TRUE.equals(property.isEmail) && Boolean.TRUE.equals(property.isString)) {
|
||||
parameter.isEmail = true;
|
||||
} else if (Boolean.TRUE.equals(property.isPassword) && Boolean.TRUE.equals(property.isString)) {
|
||||
parameter.isPassword = true;
|
||||
} else if (Boolean.TRUE.equals(property.isUuid) && Boolean.TRUE.equals(property.isString)) {
|
||||
parameter.isUuid = true;
|
||||
} else if (Boolean.TRUE.equals(property.isByteArray)) {
|
||||
@@ -6762,6 +6833,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else if (ModelUtils.isStringSchema(ps)) {
|
||||
if (ModelUtils.isEmailSchema(ps)) {
|
||||
codegenParameter.isEmail = true;
|
||||
} else if (ModelUtils.isPasswordSchema(ps)) {
|
||||
codegenParameter.isPassword = true;
|
||||
} else if (ModelUtils.isUUIDSchema(ps)) {
|
||||
codegenParameter.isUuid = true;
|
||||
} else if (ModelUtils.isByteArraySchema(ps)) {
|
||||
@@ -6806,7 +6879,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (ModelUtils.isShortSchema(ps)) { // int32/short format
|
||||
codegenParameter.isShort = true;
|
||||
} else { // unbounded integer
|
||||
;
|
||||
}
|
||||
}
|
||||
} else if (ModelUtils.isTypeObjectSchema(ps)) {
|
||||
@@ -6814,10 +6886,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
codegenParameter.isFreeFormObject = true;
|
||||
}
|
||||
} else if (ModelUtils.isNullType(ps)) {
|
||||
;
|
||||
} else if (ModelUtils.isAnyType(ps)) {
|
||||
// any schema with no type set, composed schemas often do this
|
||||
;
|
||||
} else if (ModelUtils.isArraySchema(ps)) {
|
||||
Schema inner = getSchemaItems((ArraySchema) ps);
|
||||
CodegenProperty arrayInnerProperty = fromProperty("inner", inner, false);
|
||||
@@ -6858,7 +6928,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
} else {
|
||||
// referenced schemas
|
||||
;
|
||||
}
|
||||
|
||||
if (Boolean.TRUE.equals(codegenProperty.isModel)) {
|
||||
@@ -7701,9 +7770,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
CodegenModel cm = new CodegenModel();
|
||||
|
||||
cm.setDiscriminator(createDiscriminator("", cs, openAPI));
|
||||
if (!this.getLegacyDiscriminatorBehavior()) {
|
||||
cm.addDiscriminatorMappedModelsImports();
|
||||
}
|
||||
|
||||
for (Schema o : Optional.ofNullable(cs.getOneOf()).orElse(Collections.emptyList())) {
|
||||
if (o.get$ref() == null) {
|
||||
if (cm.discriminator != null && o.get$ref() == null) {
|
||||
@@ -7762,9 +7829,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return exceptions;
|
||||
}
|
||||
|
||||
private String name;
|
||||
private String removeCharRegEx;
|
||||
private List<String> exceptions;
|
||||
private final String name;
|
||||
private final String removeCharRegEx;
|
||||
private final List<String> exceptions;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@@ -820,6 +820,11 @@ public class DefaultGenerator implements Generator {
|
||||
bundle.put("hasServers", true);
|
||||
}
|
||||
|
||||
boolean hasOperationServers = allOperations != null && allOperations.stream()
|
||||
.flatMap(om -> om.getOperations().getOperation().stream())
|
||||
.anyMatch(o -> o.servers != null && !o.servers.isEmpty());
|
||||
bundle.put("hasOperationServers", hasOperationServers);
|
||||
|
||||
if (openAPI.getExternalDocs() != null) {
|
||||
bundle.put("externalDocs", openAPI.getExternalDocs());
|
||||
}
|
||||
|
||||
@@ -247,6 +247,8 @@ public interface IJsonSchemaValidationProperties {
|
||||
;
|
||||
} else if (ModelUtils.isEmailSchema(p)) {
|
||||
;
|
||||
} else if (ModelUtils.isPasswordSchema(p)) {
|
||||
;
|
||||
} else if (ModelUtils.isDateSchema(p)) {
|
||||
;
|
||||
} else if (ModelUtils.isDateTimeSchema(p)) {
|
||||
|
||||
@@ -224,7 +224,7 @@ public class InlineModelResolver {
|
||||
}
|
||||
|
||||
if (m.getAllOf() != null && !m.getAllOf().isEmpty()) {
|
||||
// check to ensure at least of the allOf item is model
|
||||
// check to ensure at least one of the allOf item is model
|
||||
for (Schema inner : m.getAllOf()) {
|
||||
if (isModelNeeded(ModelUtils.getReferencedSchema(openAPI, inner), visitedSchemas)) {
|
||||
return true;
|
||||
@@ -385,6 +385,7 @@ public class InlineModelResolver {
|
||||
}
|
||||
}
|
||||
m.setAnyOf(newAnyOf);
|
||||
|
||||
}
|
||||
if (m.getOneOf() != null) {
|
||||
List<Schema> newOneOf = new ArrayList<Schema>();
|
||||
@@ -577,6 +578,8 @@ public class InlineModelResolver {
|
||||
// instead of inline.
|
||||
String innerModelName = resolveModelName(component.getTitle(), key);
|
||||
Schema innerModel = modelFromProperty(openAPI, component, innerModelName);
|
||||
// Recurse to create $refs for inner models
|
||||
gatherInlineModels(innerModel, innerModelName);
|
||||
String existing = matchGenerated(innerModel);
|
||||
if (existing == null) {
|
||||
innerModelName = addSchemas(innerModelName, innerModel);
|
||||
@@ -604,13 +607,17 @@ public class InlineModelResolver {
|
||||
List<String> modelNames = new ArrayList<String>(models.keySet());
|
||||
for (String modelName : modelNames) {
|
||||
Schema model = models.get(modelName);
|
||||
if (ModelUtils.isComposedSchema(model)) {
|
||||
if (ModelUtils.isAnyOf(model)) { // contains anyOf only
|
||||
gatherInlineModels(model, modelName);
|
||||
} else if (ModelUtils.isOneOf(model)) { // contains oneOf only
|
||||
gatherInlineModels(model, modelName);
|
||||
} else if (ModelUtils.isComposedSchema(model)) {
|
||||
ComposedSchema m = (ComposedSchema) model;
|
||||
// inline child schemas
|
||||
flattenComposedChildren(modelName + "_allOf", m.getAllOf());
|
||||
flattenComposedChildren(modelName + "_anyOf", m.getAnyOf());
|
||||
flattenComposedChildren(modelName + "_oneOf", m.getOneOf());
|
||||
} else if (model instanceof Schema) {
|
||||
} else {
|
||||
gatherInlineModels(model, modelName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ public class OpenAPINormalizer {
|
||||
|
||||
// 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
|
||||
// and if sub-schema contains enum of "null", remove it and set nullable to true instead
|
||||
final String SIMPLIFY_ONEOF_ANYOF = "SIMPLIFY_ONEOF_ANYOF";
|
||||
boolean simplifyOneOfAnyOf;
|
||||
|
||||
@@ -76,6 +77,16 @@ public class OpenAPINormalizer {
|
||||
final String SET_TAGS_FOR_ALL_OPERATIONS = "SET_TAGS_FOR_ALL_OPERATIONS";
|
||||
String setTagsForAllOperations;
|
||||
|
||||
// when set to true, auto fix integer with maximum value 4294967295 (2^32-1) or long with 18446744073709551615 (2^64-1)
|
||||
// by adding x-unsigned to the schema
|
||||
final String ADD_UNSIGNED_TO_INTEGER_WITH_INVALID_MAX_VALUE = "ADD_UNSIGNED_TO_INTEGER_WITH_INVALID_MAX_VALUE";
|
||||
boolean addUnsignedToIntegerWithInvalidMaxValue;
|
||||
|
||||
// when set to true, refactor schema with allOf and properties in the same level to a schema with allOf only and
|
||||
// the allOf contains a new schema containing the properties in the top level
|
||||
final String REFACTOR_ALLOF_WITH_PROPERTIES_ONLY = "REFACTOR_ALLOF_WITH_PROPERTIES_ONLY";
|
||||
boolean refactorAllOfWithPropertiesOnly;
|
||||
|
||||
// ============= end of rules =============
|
||||
|
||||
/**
|
||||
@@ -132,6 +143,13 @@ public class OpenAPINormalizer {
|
||||
setTagsForAllOperations = rules.get(SET_TAGS_FOR_ALL_OPERATIONS);
|
||||
}
|
||||
|
||||
if (enableAll || "true".equalsIgnoreCase(rules.get(ADD_UNSIGNED_TO_INTEGER_WITH_INVALID_MAX_VALUE))) {
|
||||
addUnsignedToIntegerWithInvalidMaxValue = true;
|
||||
}
|
||||
|
||||
if (enableAll || "true".equalsIgnoreCase(rules.get(REFACTOR_ALLOF_WITH_PROPERTIES_ONLY))) {
|
||||
refactorAllOfWithPropertiesOnly = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -333,6 +351,15 @@ public class OpenAPINormalizer {
|
||||
normalizeSchema(schema.getItems(), visitedSchemas);
|
||||
} else if (schema.getAdditionalProperties() instanceof Schema) { // map
|
||||
normalizeSchema((Schema) schema.getAdditionalProperties(), visitedSchemas);
|
||||
} else if (ModelUtils.isOneOf(schema)) { // oneOf
|
||||
return normalizeOneOf(schema, visitedSchemas);
|
||||
} else if (ModelUtils.isAnyOf(schema)) { // anyOf
|
||||
return normalizeAnyOf(schema, visitedSchemas);
|
||||
} else if (ModelUtils.isAllOfWithProperties(schema)) { // allOf with properties
|
||||
schema = normalizeAllOfWithProperties(schema, visitedSchemas);
|
||||
normalizeSchema(schema, visitedSchemas);
|
||||
} else if (ModelUtils.isAllOf(schema)) { // allOf
|
||||
return normalizeAllOf(schema, visitedSchemas);
|
||||
} else if (ModelUtils.isComposedSchema(schema)) { // composed schema
|
||||
ComposedSchema cs = (ComposedSchema) schema;
|
||||
|
||||
@@ -361,12 +388,12 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
|
||||
return cs;
|
||||
} else if (schema.getNot() != null) {// not schema
|
||||
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 IntegerSchema) {
|
||||
normalizeIntegerSchema(schema, visitedSchemas);
|
||||
} else if (schema instanceof Schema) {
|
||||
normalizeSchemaWithOnlyProperties(schema, visitedSchemas);
|
||||
} else {
|
||||
@@ -380,6 +407,10 @@ public class OpenAPINormalizer {
|
||||
processSimplifyBooleanEnum(schema);
|
||||
}
|
||||
|
||||
private void normalizeIntegerSchema(Schema schema, Set<Schema> visitedSchemas) {
|
||||
processAddUnsignedToIntegerWithInvalidMaxValue(schema);
|
||||
}
|
||||
|
||||
private void normalizeSchemaWithOnlyProperties(Schema schema, Set<Schema> visitedSchemas) {
|
||||
// normalize non-composed schema (e.g. schema with only properties)
|
||||
}
|
||||
@@ -408,6 +439,20 @@ public class OpenAPINormalizer {
|
||||
return schema;
|
||||
}
|
||||
|
||||
private Schema normalizeAllOfWithProperties(Schema schema, Set<Schema> visitedSchemas) {
|
||||
for (Object item : schema.getAllOf()) {
|
||||
if (!(item instanceof Schema)) {
|
||||
throw new RuntimeException("Error! allOf schema is not of the type Schema: " + item);
|
||||
}
|
||||
// normalize allOf sub schemas one by one
|
||||
normalizeSchema((Schema) item, visitedSchemas);
|
||||
}
|
||||
// process rules here
|
||||
schema = processRefactorAllOfWithPropertiesOnly(schema);
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
private Schema normalizeOneOf(Schema schema, Set<Schema> visitedSchemas) {
|
||||
for (Object item : schema.getOneOf()) {
|
||||
if (item == null) {
|
||||
@@ -446,6 +491,10 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
|
||||
private Schema normalizeComplexComposedSchema(Schema schema, Set<Schema> visitedSchemas) {
|
||||
// loop through properties, if any
|
||||
if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
|
||||
normalizeProperties(schema.getProperties(), visitedSchemas);
|
||||
}
|
||||
|
||||
processRemoveAnyOfOneOfAndKeepPropertiesOnly(schema);
|
||||
|
||||
@@ -549,7 +598,7 @@ public class OpenAPINormalizer {
|
||||
|
||||
/**
|
||||
* If the schema is anyOf and the sub-schemas are either string or enum of string,
|
||||
* then simplify it to just string as many generators do not yet support anyOf.
|
||||
* then simplify it to just enum of string as many generators do not yet support anyOf.
|
||||
*
|
||||
* @param schema Schema
|
||||
* @return Schema
|
||||
@@ -564,7 +613,7 @@ public class OpenAPINormalizer {
|
||||
return schema;
|
||||
}
|
||||
|
||||
Schema s0 = null, s1 = null;
|
||||
Schema result = null, s0 = null, s1 = null;
|
||||
if (schema.getAnyOf().size() == 2) {
|
||||
s0 = ModelUtils.unaliasSchema(openAPI, (Schema) schema.getAnyOf().get(0));
|
||||
s1 = ModelUtils.unaliasSchema(openAPI, (Schema) schema.getAnyOf().get(1));
|
||||
@@ -575,18 +624,30 @@ public class OpenAPINormalizer {
|
||||
s0 = ModelUtils.getReferencedSchema(openAPI, s0);
|
||||
s1 = ModelUtils.getReferencedSchema(openAPI, s1);
|
||||
|
||||
// find the string schema (not enum)
|
||||
// find the string schema (enum)
|
||||
if (s0 instanceof StringSchema && s1 instanceof StringSchema) {
|
||||
if (((StringSchema) s0).getEnum() != null) { // s0 is enum, s1 is string
|
||||
return (StringSchema) s1;
|
||||
result = (StringSchema) s0;
|
||||
} else if (((StringSchema) s1).getEnum() != null) { // s1 is enum, s0 is string
|
||||
return (StringSchema) s0;
|
||||
result = (StringSchema) s1;
|
||||
} else { // both are string
|
||||
return schema;
|
||||
result = schema;
|
||||
}
|
||||
} else {
|
||||
return schema;
|
||||
result = schema;
|
||||
}
|
||||
|
||||
// set nullable
|
||||
if (schema.getNullable() != null) {
|
||||
result.setNullable(schema.getNullable());
|
||||
}
|
||||
|
||||
// set default
|
||||
if (schema.getDefault() != null) {
|
||||
result.setDefault(schema.getDefault());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -602,11 +663,22 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
|
||||
if (schema.getOneOf() != null && !schema.getOneOf().isEmpty()) {
|
||||
// convert null sub-schema to `nullable: true`
|
||||
for (int i = 0; i < schema.getOneOf().size(); i++) {
|
||||
// convert null sub-schema to `nullable: true`
|
||||
if (schema.getOneOf().get(i) == null || ((Schema) schema.getOneOf().get(i)).getType() == null) {
|
||||
schema.getOneOf().remove(i);
|
||||
schema.setNullable(true);
|
||||
continue;
|
||||
}
|
||||
|
||||
// convert enum of null only to `nullable:true`
|
||||
Schema oneOfElement = ModelUtils.getReferencedSchema(openAPI, (Schema) schema.getOneOf().get(i));
|
||||
if (oneOfElement.getEnum() != null && oneOfElement.getEnum().size() == 1) {
|
||||
if ("null".equals(String.valueOf(oneOfElement.getEnum().get(0)))) {
|
||||
schema.setNullable(true);
|
||||
schema.getOneOf().remove(i);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -635,17 +707,28 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
|
||||
if (schema.getAnyOf() != null && !schema.getAnyOf().isEmpty()) {
|
||||
// convert null sub-schema to `nullable: true`
|
||||
for (int i = 0; i < schema.getAnyOf().size(); i++) {
|
||||
// convert null sub-schema to `nullable: true`
|
||||
if (schema.getAnyOf().get(i) == null || ((Schema) schema.getAnyOf().get(i)).getType() == null) {
|
||||
schema.getAnyOf().remove(i);
|
||||
schema.setNullable(true);
|
||||
continue;
|
||||
}
|
||||
|
||||
// convert enum of null only to `nullable:true`
|
||||
Schema anyOfElement = ModelUtils.getReferencedSchema(openAPI, (Schema) schema.getAnyOf().get(i));
|
||||
if (anyOfElement.getEnum() != null && anyOfElement.getEnum().size() == 1) {
|
||||
if ("null".equals(String.valueOf(anyOfElement.getEnum().get(0)))) {
|
||||
schema.setNullable(true);
|
||||
schema.getAnyOf().remove(i);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if only one element left, simplify to just the element (schema)
|
||||
if (schema.getAnyOf().size() == 1) {
|
||||
if (schema.getNullable()) { // retain nullable setting
|
||||
if (Boolean.TRUE.equals(schema.getNullable())) { // retain nullable setting
|
||||
((Schema) schema.getAnyOf().get(0)).setNullable(true);
|
||||
}
|
||||
return (Schema) schema.getAnyOf().get(0);
|
||||
@@ -675,5 +758,73 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the schema is integer and the max value is invalid (out of bound)
|
||||
* then add x-unsigned to use unsigned integer/long instead.
|
||||
*
|
||||
* @param schema Schema
|
||||
* @return Schema
|
||||
*/
|
||||
private void processAddUnsignedToIntegerWithInvalidMaxValue(Schema schema) {
|
||||
if (!addUnsignedToIntegerWithInvalidMaxValue && !enableAll) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (schema instanceof IntegerSchema) {
|
||||
if (ModelUtils.isLongSchema(schema)) {
|
||||
if ("18446744073709551615".equals(String.valueOf(schema.getMaximum())) &&
|
||||
"0".equals(String.valueOf(schema.getMinimum()))) {
|
||||
schema.addExtension("x-unsigned", true);
|
||||
}
|
||||
} else {
|
||||
if ("4294967295".equals(String.valueOf(schema.getMaximum())) &&
|
||||
"0".equals(String.valueOf(schema.getMinimum()))) {
|
||||
schema.addExtension("x-unsigned", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* When set to true, refactor schema with allOf and properties in the same level to a schema with allOf only and
|
||||
* the allOf contains a new schema containing the properties in the top level.
|
||||
*
|
||||
* @param schema Schema
|
||||
* @return Schema
|
||||
*/
|
||||
private Schema processRefactorAllOfWithPropertiesOnly(Schema schema) {
|
||||
if (!refactorAllOfWithPropertiesOnly && !enableAll) {
|
||||
return schema;
|
||||
}
|
||||
|
||||
ObjectSchema os = new ObjectSchema();
|
||||
// set the properties, etc of the new schema to the properties of schema
|
||||
os.setProperties(schema.getProperties());
|
||||
os.setRequired(schema.getRequired());
|
||||
os.setAdditionalProperties(schema.getAdditionalProperties());
|
||||
os.setNullable(schema.getNullable());
|
||||
os.setDescription(schema.getDescription());
|
||||
os.setDeprecated(schema.getDeprecated());
|
||||
os.setExample(schema.getExample());
|
||||
os.setExamples(schema.getExamples());
|
||||
os.setTitle(schema.getTitle());
|
||||
schema.getAllOf().add(os); // move new schema as a child schema of allOf
|
||||
// clean up by removing properties, etc
|
||||
schema.setProperties(null);
|
||||
schema.setRequired(null);
|
||||
schema.setAdditionalProperties(null);
|
||||
schema.setNullable(null);
|
||||
schema.setDescription(null);
|
||||
schema.setDeprecated(null);
|
||||
schema.setExample(null);
|
||||
schema.setExamples(null);
|
||||
schema.setTitle(null);
|
||||
|
||||
// at this point the schema becomes a simple allOf (no properties) with an additional schema containing
|
||||
// the properties
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
// ===================== end of rules =====================
|
||||
}
|
||||
|
||||
@@ -70,6 +70,10 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
protected String packageCompany = "OpenAPI";
|
||||
protected String packageCopyright = "No Copyright";
|
||||
protected String packageAuthors = "OpenAPI";
|
||||
public static final String DATE_FORMAT = "dateFormat";
|
||||
protected String dateFormat = "yyyy'-'MM'-'dd";
|
||||
public static final String DATETIME_FORMAT = "dateTimeFormat";
|
||||
protected String dateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK";
|
||||
|
||||
protected String interfacePrefix = "I";
|
||||
protected String enumNameSuffix = "Enum";
|
||||
@@ -160,8 +164,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
"decimal",
|
||||
"int?",
|
||||
"int",
|
||||
"uint",
|
||||
"uint?",
|
||||
"long?",
|
||||
"long",
|
||||
"ulong",
|
||||
"ulong?",
|
||||
"float?",
|
||||
"float",
|
||||
"byte[]",
|
||||
@@ -197,8 +205,10 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
typeMapping.put("ByteArray", "byte[]");
|
||||
typeMapping.put("boolean", "bool?");
|
||||
typeMapping.put("integer", "int?");
|
||||
typeMapping.put("float", "float?");
|
||||
typeMapping.put("UnsignedInteger", "uint?");
|
||||
typeMapping.put("UnsignedLong", "ulong?");
|
||||
typeMapping.put("long", "long?");
|
||||
typeMapping.put("float", "float?");
|
||||
typeMapping.put("double", "double?");
|
||||
typeMapping.put("number", "decimal?");
|
||||
typeMapping.put("BigDecimal", "decimal?");
|
||||
@@ -215,11 +225,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// nullable type
|
||||
nullableType = new HashSet<>(
|
||||
Arrays.asList("decimal", "bool", "int", "float", "long", "double", "DateTime", "DateTimeOffset", "Guid")
|
||||
Arrays.asList("decimal", "bool", "int", "uint", "long", "ulong", "float", "double",
|
||||
"DateTime", "DateTimeOffset", "Guid")
|
||||
);
|
||||
// value Types
|
||||
valueTypes = new HashSet<>(
|
||||
Arrays.asList("decimal", "bool", "int", "float", "long", "double")
|
||||
Arrays.asList("decimal", "bool", "int", "uint", "long", "ulong", "float", "double")
|
||||
);
|
||||
|
||||
this.setSortParamsByRequiredFlag(true);
|
||||
@@ -326,6 +337,20 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_PRODUCTNAME, packageProductName);
|
||||
}
|
||||
|
||||
// {{dateFormat}}
|
||||
if (additionalProperties.containsKey(DATE_FORMAT)) {
|
||||
setDateFormat((String) additionalProperties.get(DATE_FORMAT));
|
||||
} else {
|
||||
additionalProperties.put(DATE_FORMAT, this.dateFormat);
|
||||
}
|
||||
|
||||
// {{dateTimeFormat}}
|
||||
if (additionalProperties.containsKey(DATETIME_FORMAT)) {
|
||||
setDateTimeFormat((String) additionalProperties.get(DATETIME_FORMAT));
|
||||
} else {
|
||||
additionalProperties.put(DATETIME_FORMAT, this.dateTimeFormat);
|
||||
}
|
||||
|
||||
// {{packageDescription}}
|
||||
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_DESCRIPTION)) {
|
||||
setPackageDescription((String) additionalProperties.get(CodegenConstants.PACKAGE_DESCRIPTION));
|
||||
@@ -527,14 +552,19 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
|
||||
// fix incorrect data types for maps of maps
|
||||
if (property.datatypeWithEnum.contains("List>") && property.items != null) {
|
||||
property.datatypeWithEnum = property.datatypeWithEnum.replace("List>", property.items.datatypeWithEnum + ">");
|
||||
if (property.datatypeWithEnum.endsWith(", List>") && property.items != null) {
|
||||
property.datatypeWithEnum = property.datatypeWithEnum.replace(", List>", ", " + property.items.datatypeWithEnum + ">");
|
||||
property.dataType = property.datatypeWithEnum;
|
||||
}
|
||||
if (property.datatypeWithEnum.contains("Dictionary>") && property.items != null) {
|
||||
property.datatypeWithEnum = property.datatypeWithEnum.replace("Dictionary>", property.items.datatypeWithEnum + ">");
|
||||
if (property.datatypeWithEnum.endsWith(", Dictionary>") && property.items != null) {
|
||||
property.datatypeWithEnum = property.datatypeWithEnum.replace(", Dictionary>", ", " + property.items.datatypeWithEnum + ">");
|
||||
property.dataType = property.datatypeWithEnum;
|
||||
}
|
||||
|
||||
// HOTFIX: https://github.com/OpenAPITools/openapi-generator/issues/14944
|
||||
if (property.datatypeWithEnum.equals("decimal")) {
|
||||
property.isDecimal = true;
|
||||
}
|
||||
}
|
||||
|
||||
/** Mitigates https://github.com/OpenAPITools/openapi-generator/issues/13709 */
|
||||
@@ -1262,6 +1292,14 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
this.packageProductName = packageProductName;
|
||||
}
|
||||
|
||||
public void setDateFormat(String dateFormat) {
|
||||
this.dateFormat = dateFormat;
|
||||
}
|
||||
|
||||
public void setDateTimeFormat(String dateTimeFormat) {
|
||||
this.dateTimeFormat = dateTimeFormat;
|
||||
}
|
||||
|
||||
public void setPackageDescription(String packageDescription) {
|
||||
this.packageDescription = packageDescription;
|
||||
}
|
||||
@@ -1334,7 +1372,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
// Per: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/enum
|
||||
// The approved types for an enum are byte, sbyte, short, ushort, int, uint, long, or ulong.
|
||||
// but we're not supporting unsigned integral types or shorts.
|
||||
if (datatype.startsWith("int") || datatype.startsWith("long") || datatype.startsWith("byte")) {
|
||||
if (datatype.startsWith("int") || datatype.startsWith("uint") ||
|
||||
datatype.startsWith("long") || datatype.startsWith("ulong") ||
|
||||
datatype.startsWith("byte")) {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -555,8 +555,8 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
public CodegenProperty fromProperty(String name, Schema p, boolean required) {
|
||||
final CodegenProperty property = super.fromProperty(name, p, required);
|
||||
|
||||
// Handle composed properties
|
||||
if (ModelUtils.isComposedSchema(p)) {
|
||||
// Handle composed properties and it's NOT allOf with a single ref only
|
||||
if (ModelUtils.isComposedSchema(p) && !(ModelUtils.isAllOf(p) && p.getAllOf().size() == 1)) {
|
||||
ComposedSchema composed = (ComposedSchema) p;
|
||||
|
||||
// Count the occurrences of allOf/anyOf/oneOf with exactly one child element
|
||||
|
||||
@@ -145,8 +145,6 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
"float32", "float64")
|
||||
);
|
||||
|
||||
importMapping = new HashMap<>();
|
||||
|
||||
cliOptions.clear();
|
||||
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Go package name (convention: lowercase).")
|
||||
.defaultValue("openapi"));
|
||||
@@ -225,7 +223,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
|
||||
@Override
|
||||
protected boolean isReservedWord(String word) {
|
||||
return word != null && reservedWords.contains(word);
|
||||
return word != null && (reservedWords.contains(word) || reservedWordsMappings().containsKey(word));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -407,7 +405,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
public String getSchemaType(Schema p) {
|
||||
String openAPIType = super.getSchemaType(p);
|
||||
String ref = p.get$ref();
|
||||
String type = null;
|
||||
String type;
|
||||
|
||||
if (ref != null && !ref.isEmpty()) {
|
||||
type = toModelName(openAPIType);
|
||||
|
||||
@@ -1051,7 +1051,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
|
||||
if (ModelUtils.isArraySchema(schema)) {
|
||||
if (schema.getDefault() == null) {
|
||||
if (cp.isNullable || containerDefaultToNull) { // nullable or containerDefaultToNull set to true
|
||||
// nullable, optional or containerDefaultToNull set to true
|
||||
if (cp.isNullable || !cp.required || containerDefaultToNull) {
|
||||
return null;
|
||||
} else {
|
||||
if (ModelUtils.isSet(schema)) {
|
||||
@@ -2286,6 +2287,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
operation.allParams.add(p);
|
||||
}
|
||||
}
|
||||
operation.hasParams = !operation.allParams.isEmpty();
|
||||
}
|
||||
|
||||
private boolean shouldBeImplicitHeader(CodegenParameter parameter) {
|
||||
|
||||
@@ -44,7 +44,7 @@ import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public abstract class AbstractKotlinCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
public static final String SERIALIZATION_LIBRARY_DESC = "What serialization library to use: 'moshi' (default), or 'gson' or 'jackson'";
|
||||
public static final String SERIALIZATION_LIBRARY_DESC = "What serialization library to use: 'moshi' (default), or 'gson' or 'jackson or 'kotlinx_serialization'";
|
||||
|
||||
public enum SERIALIZATION_LIBRARY_TYPE {moshi, gson, jackson, kotlinx_serialization}
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.CodegenConstants.ENUM_PROPERTY_NAMING_TYPE;
|
||||
import org.openapitools.codegen.CodegenConstants.MODEL_PROPERTY_NAMING_TYPE;
|
||||
import org.openapitools.codegen.CodegenConstants.PARAM_NAMING_TYPE;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.*;
|
||||
import org.openapitools.codegen.model.ModelMap;
|
||||
import org.openapitools.codegen.model.ModelsMap;
|
||||
@@ -46,7 +46,8 @@ import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen.ParameterExpander.ParamStyle.*;
|
||||
import static org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen.ParameterExpander.ParamStyle.form;
|
||||
import static org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen.ParameterExpander.ParamStyle.simple;
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
@@ -392,10 +393,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
setParamNaming((String) additionalProperties.get(CodegenConstants.PARAM_NAMING));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SUPPORTS_ES6)) {
|
||||
setSupportsES6(Boolean.valueOf(additionalProperties.get(CodegenConstants.SUPPORTS_ES6).toString()));
|
||||
additionalProperties.put("supportsES6", getSupportsES6());
|
||||
}
|
||||
setSupportsES6(convertPropertyToBooleanAndWriteBack(CodegenConstants.SUPPORTS_ES6));
|
||||
|
||||
if (additionalProperties.containsKey(NULL_SAFE_ADDITIONAL_PROPS)) {
|
||||
setNullSafeAdditionalProps(Boolean.valueOf(additionalProperties.get(NULL_SAFE_ADDITIONAL_PROPS).toString()));
|
||||
@@ -839,7 +837,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
if ("number".equals(datatype) || "boolean".equals(datatype)) {
|
||||
return value;
|
||||
} else {
|
||||
return "\'" + escapeText(value) + "\'";
|
||||
return "'" + escapeText(value) + "'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,8 +123,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
typeMapping.put("boolean", "bool");
|
||||
typeMapping.put("integer", "int");
|
||||
typeMapping.put("float", "float");
|
||||
typeMapping.put("long", "long");
|
||||
typeMapping.put("UnsignedInteger", "uint");
|
||||
typeMapping.put("UnsignedLong", "ulong");
|
||||
typeMapping.put("float", "float");
|
||||
typeMapping.put("double", "double");
|
||||
typeMapping.put("number", "decimal");
|
||||
typeMapping.put("decimal", "decimal");
|
||||
@@ -789,7 +791,8 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
}
|
||||
|
||||
// number
|
||||
if (datatype.startsWith("int") || datatype.startsWith("long") ||
|
||||
if (datatype.startsWith("int") || datatype.startsWith("uint") ||
|
||||
datatype.startsWith("ulong") || datatype.startsWith("long") ||
|
||||
datatype.startsWith("double") || datatype.startsWith("float")) {
|
||||
String varName = "NUMBER_" + value;
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
* Copyright 2018 SmartBear Software
|
||||
*
|
||||
* 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.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class CSharpDotNet2ClientCodegen extends AbstractCSharpCodegen {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(CSharpDotNet2ClientCodegen.class);
|
||||
|
||||
public static final String CLIENT_PACKAGE = "clientPackage";
|
||||
protected String clientPackage = "Org.OpenAPITools.Client";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
|
||||
public CSharpDotNet2ClientCodegen() {
|
||||
super();
|
||||
|
||||
modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme));
|
||||
|
||||
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
|
||||
.stability(Stability.DEPRECATED)
|
||||
.build();
|
||||
|
||||
// clear import mapping (from default generator) as C# (2.0) does not use it
|
||||
// at the moment
|
||||
importMapping.clear();
|
||||
|
||||
modelTemplateFiles.put("model.mustache", ".cs");
|
||||
apiTemplateFiles.put("api.mustache", ".cs");
|
||||
|
||||
setApiPackage(packageName + ".Api");
|
||||
setModelPackage(packageName + ".Model");
|
||||
setClientPackage(packageName + ".Client");
|
||||
setSourceFolder("src" + File.separator + "main" + File.separator + "CsharpDotNet2");
|
||||
|
||||
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||
|
||||
cliOptions.clear();
|
||||
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME,
|
||||
"C# package name (convention: Camel.Case).")
|
||||
.defaultValue(packageName));
|
||||
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION,
|
||||
"C# package version.")
|
||||
.defaultValue(packageVersion));
|
||||
cliOptions.add(new CliOption(CLIENT_PACKAGE,
|
||||
"C# client package name (convention: Camel.Case).")
|
||||
.defaultValue(clientPackage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
LOGGER.warn("Per Microsoft Product Lifecycle (https://support.microsoft.com/en-us/lifecycle/search?sort=PN&alpha=.NET%20Framework&Filter=FilterNO), support for .NET Framework 2.0 ended in 2011 so there may be security issues using the auto-generated C# 2.0 source code.");
|
||||
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey(CLIENT_PACKAGE)) {
|
||||
setClientPackage((String) additionalProperties.get(CLIENT_PACKAGE));
|
||||
} else {
|
||||
additionalProperties.put(CLIENT_PACKAGE, getClientPackage());
|
||||
}
|
||||
|
||||
final String clientPackage = getClientPackage();
|
||||
final String clientPackagePath = clientPackage.replace(".", java.io.File.separator);
|
||||
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
|
||||
supportingFiles.add(new SupportingFile("Configuration.mustache",
|
||||
sourceFolder + File.separator + clientPackagePath, "Configuration.cs"));
|
||||
supportingFiles.add(new SupportingFile("ApiClient.mustache",
|
||||
sourceFolder + File.separator + clientPackagePath, "ApiClient.cs"));
|
||||
supportingFiles.add(new SupportingFile("ApiException.mustache",
|
||||
sourceFolder + File.separator + clientPackagePath, "ApiException.cs"));
|
||||
supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor", "packages.config"));
|
||||
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiPackage() {
|
||||
return packageName + ".Api";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelPackage() {
|
||||
return packageName + ".Model";
|
||||
}
|
||||
|
||||
public String getClientPackage() {
|
||||
return clientPackage;
|
||||
}
|
||||
|
||||
public void setClientPackage(String clientPackage) {
|
||||
this.clientPackage = clientPackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "csharp-dotnet2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return "Generates a C# .Net 2.0 client library (beta).";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return outputFolder + File.separator + sourceFolder + File.separator + apiPackage().replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelFileFolder() {
|
||||
return outputFolder + File.separator + sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return outputFolder + File.separator + apiDocPath.replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return outputFolder + File.separator + modelDocPath.replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,6 +61,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
protected static final String RESTSHARP = "restsharp";
|
||||
protected static final String HTTPCLIENT = "httpclient";
|
||||
protected static final String GENERICHOST = "generichost";
|
||||
protected static final String UNITY_WEB_REQUEST = "unityWebRequest";
|
||||
|
||||
// Project Variable, determined from target framework. Not intended to be user-settable.
|
||||
protected static final String TARGET_FRAMEWORK_IDENTIFIER = "targetFrameworkIdentifier";
|
||||
@@ -100,6 +101,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
protected boolean supportsRetry = Boolean.TRUE;
|
||||
protected boolean supportsAsync = Boolean.TRUE;
|
||||
protected boolean netStandard = Boolean.FALSE;
|
||||
protected boolean supportsFileParameters = Boolean.TRUE;
|
||||
|
||||
protected boolean validatable = Boolean.TRUE;
|
||||
protected Map<Character, String> regexModifiers;
|
||||
@@ -115,6 +117,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
protected boolean needsCustomHttpMethod = false;
|
||||
protected boolean needsUriBuilder = false;
|
||||
|
||||
// skip generation of getter for oneOf/anyOf sub-schemas to avoid duplicate getter
|
||||
// when the subschemas are of the same type but with different constraints (e.g. array of string)
|
||||
protected boolean skipOneOfAnyOfGetter = false;
|
||||
|
||||
public CSharpNetCoreClientCodegen() {
|
||||
super();
|
||||
|
||||
@@ -151,8 +157,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
typeMapping.put("ByteArray", "byte[]");
|
||||
typeMapping.put("boolean", "bool");
|
||||
typeMapping.put("integer", "int");
|
||||
typeMapping.put("float", "float");
|
||||
typeMapping.put("long", "long");
|
||||
typeMapping.put("UnsignedInteger", "uint");
|
||||
typeMapping.put("UnsignedLong", "ulong");
|
||||
typeMapping.put("float", "float");
|
||||
typeMapping.put("double", "double");
|
||||
typeMapping.put("number", "decimal");
|
||||
typeMapping.put("decimal", "decimal");
|
||||
@@ -215,6 +223,14 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
CodegenConstants.PACKAGE_TAGS_DESC,
|
||||
this.packageTags);
|
||||
|
||||
addOption(DATE_FORMAT,
|
||||
"The default Date format (only `generichost` library supports this option).",
|
||||
this.dateFormat);
|
||||
|
||||
addOption(DATETIME_FORMAT,
|
||||
"The default DateTime format (only `generichost` library supports this option).",
|
||||
this.dateTimeFormat);
|
||||
|
||||
CliOption framework = new CliOption(
|
||||
CodegenConstants.DOTNET_FRAMEWORK,
|
||||
CodegenConstants.DOTNET_FRAMEWORK_DESC
|
||||
@@ -309,12 +325,16 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
addSwitch(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP,
|
||||
CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC,
|
||||
this.caseInsensitiveResponseHeaders);
|
||||
this.useOneOfDiscriminatorLookup);
|
||||
|
||||
addSwitch(CodegenConstants.CASE_INSENSITIVE_RESPONSE_HEADERS,
|
||||
CodegenConstants.CASE_INSENSITIVE_RESPONSE_HEADERS_DESC,
|
||||
this.caseInsensitiveResponseHeaders);
|
||||
|
||||
addSwitch(CodegenConstants.SKIP_ONEOF_ANYOF_GETTER,
|
||||
CodegenConstants.SKIP_ONEOF_ANYOF_GETTER_DESC,
|
||||
this.skipOneOfAnyOfGetter);
|
||||
|
||||
regexModifiers = new HashMap<>();
|
||||
regexModifiers.put('i', "IgnoreCase");
|
||||
regexModifiers.put('m', "Multiline");
|
||||
@@ -325,6 +345,8 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
+ "(Experimental. Subject to breaking changes without notice.)");
|
||||
supportedLibraries.put(HTTPCLIENT, "HttpClient (https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) "
|
||||
+ "(Experimental. Subject to breaking changes without notice.)");
|
||||
supportedLibraries.put(UNITY_WEB_REQUEST, "UnityWebRequest (...) "
|
||||
+ "(Experimental. Subject to breaking changes without notice.)");
|
||||
supportedLibraries.put(RESTSHARP, "RestSharp (https://github.com/restsharp/RestSharp)");
|
||||
|
||||
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "HTTP library template (sub-template) to use");
|
||||
@@ -701,6 +723,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
setLibrary(HTTPCLIENT);
|
||||
additionalProperties.put("useHttpClient", true);
|
||||
needsUriBuilder = true;
|
||||
} else if (UNITY_WEB_REQUEST.equals(getLibrary())) {
|
||||
setLibrary(UNITY_WEB_REQUEST);
|
||||
additionalProperties.put("useUnityWebRequest", true);
|
||||
needsUriBuilder = true;
|
||||
} else {
|
||||
throw new RuntimeException("Invalid HTTP library " + getLibrary() + ". Only restsharp, httpclient, and generichost are supported.");
|
||||
}
|
||||
@@ -780,6 +806,8 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
syncBooleanProperty(additionalProperties, CodegenConstants.OPTIONAL_METHOD_ARGUMENT, this::setOptionalMethodArgumentFlag, optionalMethodArgumentFlag);
|
||||
syncBooleanProperty(additionalProperties, CodegenConstants.NON_PUBLIC_API, this::setNonPublicApi, isNonPublicApi());
|
||||
syncBooleanProperty(additionalProperties, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, this::setUseOneOfDiscriminatorLookup, this.useOneOfDiscriminatorLookup);
|
||||
syncBooleanProperty(additionalProperties, CodegenConstants.SKIP_ONEOF_ANYOF_GETTER, this::setSkipOneOfAnyOfGetter, this.skipOneOfAnyOfGetter);
|
||||
syncBooleanProperty(additionalProperties, "supportsFileParameters", this::setSupportsFileParameters, this.supportsFileParameters);
|
||||
|
||||
final String testPackageName = testPackageName();
|
||||
String packageFolder = sourceFolder + File.separator + packageName;
|
||||
@@ -816,6 +844,20 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
addGenericHostSupportingFiles(clientPackageDir, packageFolder, excludeTests, testPackageFolder, testPackageName, modelPackageDir);
|
||||
additionalProperties.put("apiDocPath", apiDocPath + File.separatorChar + "apis");
|
||||
additionalProperties.put("modelDocPath", modelDocPath + File.separatorChar + "models");
|
||||
} else if (UNITY_WEB_REQUEST.equals(getLibrary())) {
|
||||
additionalProperties.put(CodegenConstants.VALIDATABLE, false);
|
||||
setValidatable(false);
|
||||
setSupportsRetry(false);
|
||||
setSupportsAsync(true);
|
||||
// Some consoles and tvOS do not support either Application.persistentDataPath or will refuse to
|
||||
// compile/link if you even reference GetTempPath as well.
|
||||
additionalProperties.put("supportsFileParameters", false);
|
||||
setSupportsFileParameters(false);
|
||||
|
||||
addSupportingFiles(clientPackageDir, packageFolder, excludeTests, testPackageFolder, testPackageName, modelPackageDir, authPackageDir);
|
||||
|
||||
supportingFiles.add(new SupportingFile("ConnectionException.mustache", clientPackageDir, "ConnectionException.cs"));
|
||||
supportingFiles.add(new SupportingFile("UnexpectedResponseException.mustache", clientPackageDir, "UnexpectedResponseException.cs"));
|
||||
} else { //restsharp
|
||||
addSupportingFiles(clientPackageDir, packageFolder, excludeTests, testPackageFolder, testPackageName, modelPackageDir, authPackageDir);
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
@@ -827,6 +869,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
supportingFiles.add(new SupportingFile("auth/OAuthFlow.mustache", authPackageDir, "OAuthFlow.cs"));
|
||||
}
|
||||
}
|
||||
|
||||
// include the spec in the output
|
||||
supportingFiles.add(new SupportingFile("openapi.mustache", "api", "openapi.yaml"));
|
||||
|
||||
}
|
||||
|
||||
public void setClientPackage(String clientPackage) {
|
||||
@@ -911,14 +957,24 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||
|
||||
if (UNITY_WEB_REQUEST.equals(getLibrary())) {
|
||||
supportingFiles.add(new SupportingFile("asmdef.mustache", packageFolder, packageName + ".asmdef"));
|
||||
} else {
|
||||
supportingFiles.add(new SupportingFile("Solution.mustache", "", packageName + ".sln"));
|
||||
supportingFiles.add(new SupportingFile("netcore_project.mustache", packageFolder, packageName + ".csproj"));
|
||||
|
||||
if (Boolean.FALSE.equals(excludeTests.get())) {
|
||||
supportingFiles.add(new SupportingFile("netcore_testproject.mustache", testPackageFolder, testPackageName + ".csproj"));
|
||||
}
|
||||
|
||||
if (Boolean.FALSE.equals(excludeTests.get())) {
|
||||
if (UNITY_WEB_REQUEST.equals(getLibrary())) {
|
||||
supportingFiles.add(new SupportingFile("asmdef_test.mustache", testPackageFolder, testPackageName + ".asmdef"));
|
||||
} else {
|
||||
supportingFiles.add(new SupportingFile("netcore_testproject.mustache", testPackageFolder, testPackageName + ".csproj"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!UNITY_WEB_REQUEST.equals(getLibrary())) {
|
||||
supportingFiles.add(new SupportingFile("appveyor.mustache", "", "appveyor.yml"));
|
||||
}
|
||||
supportingFiles.add(new SupportingFile("AbstractOpenAPISchema.mustache", modelPackageDir, "AbstractOpenAPISchema.cs"));
|
||||
}
|
||||
|
||||
@@ -1048,6 +1104,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
this.supportsAsync = supportsAsync;
|
||||
}
|
||||
|
||||
public void setSupportsFileParameters(Boolean supportsFileParameters) {
|
||||
this.supportsFileParameters = supportsFileParameters;
|
||||
}
|
||||
|
||||
public void setSupportsRetry(Boolean supportsRetry) {
|
||||
this.supportsRetry = supportsRetry;
|
||||
}
|
||||
@@ -1127,6 +1187,14 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
return this.useOneOfDiscriminatorLookup;
|
||||
}
|
||||
|
||||
public void setSkipOneOfAnyOfGetter(boolean skipOneOfAnyOfGetter) {
|
||||
this.skipOneOfAnyOfGetter = skipOneOfAnyOfGetter;
|
||||
}
|
||||
|
||||
public boolean getSkipOneOfAnyOfGetter() {
|
||||
return this.skipOneOfAnyOfGetter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumVarName(String value, String datatype) {
|
||||
if (value.length() == 0) {
|
||||
@@ -1139,7 +1207,8 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
}
|
||||
|
||||
// number
|
||||
if (datatype.startsWith("int") || datatype.startsWith("long") ||
|
||||
if (datatype.startsWith("int") || datatype.startsWith("uint") ||
|
||||
datatype.startsWith("long") || datatype.startsWith("ulong") ||
|
||||
datatype.startsWith("double") || datatype.startsWith("float")) {
|
||||
String varName = "NUMBER_" + value;
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
@@ -1593,4 +1662,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
// process 'additionalProperties'
|
||||
setAddProps(schema, m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
|
||||
generateYAMLSpecFile(objs);
|
||||
return objs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,12 +337,6 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
objs = super.postProcessModels(objs);
|
||||
List<ModelMap> models = objs.getModels();
|
||||
ProcessUtils.addIndexToProperties(models, 1);
|
||||
|
||||
for (ModelMap mo : models) {
|
||||
CodegenModel cm = mo.getModel();
|
||||
cm.imports = rewriteImports(cm.imports, true);
|
||||
cm.vendorExtensions.put("x-has-vars", !cm.vars.isEmpty());
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
@@ -583,6 +577,16 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
adaptToDartInheritance(objs);
|
||||
syncRootTypesWithInnerVars(objs);
|
||||
}
|
||||
|
||||
// loop through models to update the imports
|
||||
for (ModelsMap entry : objs.values()) {
|
||||
for (ModelMap mo : entry.getModels()) {
|
||||
CodegenModel cm = mo.getModel();
|
||||
cm.imports = rewriteImports(cm.imports, true);
|
||||
cm.vendorExtensions.put("x-has-vars", !cm.vars.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
return objs;
|
||||
}
|
||||
|
||||
@@ -730,6 +734,10 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
resultImports.add(i);
|
||||
} else if (importMapping().containsKey(modelImport)) {
|
||||
resultImports.add(importMapping().get(modelImport));
|
||||
} else if (modelImport.startsWith("dart:")) { // import dart:* directly
|
||||
resultImports.add(modelImport);
|
||||
} else if (modelImport.startsWith("package:")) { // e.g. package:openapi/src/model/child.dart
|
||||
resultImports.add(modelImport);
|
||||
} else {
|
||||
resultImports.add("package:" + pubName + "/" + sourceFolder + "/" + modelPackage() + "/" + underscore(modelImport) + ".dart");
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
.wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML))
|
||||
.securityFeatures(EnumSet.of(
|
||||
SecurityFeature.BasicAuth,
|
||||
SecurityFeature.BearerToken,
|
||||
SecurityFeature.ApiKey,
|
||||
SecurityFeature.OAuth2_Implicit
|
||||
))
|
||||
|
||||
@@ -50,6 +50,8 @@ public class JavaJAXRSCXFCDIServerCodegen extends JavaJAXRSSpecServerCodegen imp
|
||||
|
||||
// Use standard types
|
||||
typeMapping.put("DateTime", "java.util.Date");
|
||||
typeMapping.put("binary", "java.io.InputStream");
|
||||
typeMapping.put("file", "java.io.InputStream");
|
||||
|
||||
// Updated template directory
|
||||
embeddedTemplateDir = templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "cxf-cdi";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user