Compare commits

..

63 Commits

Author SHA1 Message Date
William Cheng
8f2676c5c2 Prepare v6.3.0 release (#14580)
* 6.3.0 release

* fix maven plugin test

* update samples

* update doc

* fix tests in windows
2023-02-01 20:52:29 +08:00
julien Lengrand-Lambert
6541038e13 Update PR template to contain all scripts to run (#14501)
* Update PR template to contain all scripts to run

* Makes template more precise

* Avoid requesting to run scripts that are not useful.
2023-02-01 15:51:11 +08:00
Kariem Hussein
6ddc8b3f38 Add section on type and import mappings with samples (#14576) 2023-02-01 15:47:55 +08:00
William Cheng
32499a19fc fix empty body in java apache client (#14574) 2023-02-01 15:41:55 +08:00
Sergii Baitala
8d9816e193 [cpp-qt-client] CMake build system improvements (#14210)
* checkpoint

* rename template file

* add nl

* fix build
2023-01-31 23:39:00 +08:00
Beppe Catanese
e8c739e771 Read modelFileFolderPath from additionalProperties (#12536) 2023-01-31 22:49:45 +08:00
William Cheng
a28772b08f skip website push (#14573) 2023-01-31 22:44:03 +08:00
Paul Parenko
cffe2d0259 [Kotlin-Spring] support to Spring boot3 & jakarta extension (#14369)
* [Kotlin] add spring boot 3 & jakarta extension support

* [kotlin-spring] readme update & modified imports

* use latest Spring Boot starter parent

* use same options as in [Java] generator

* new config kotlin-spring-boot-3

---------

Co-authored-by: jayandran sampath <jayandran.sampath@opencastsoftware.com>
2023-01-31 22:16:06 +08:00
julien Lengrand-Lambert
eca9ec775b Feat/jetbrains http client (#14477)
* Dummy client generated

* Adding dummy versions, my IDE crashed

* Making my first actual requests

* Creates first version of API Generator for Jetbrains Client

* Adds generated API files

* Adds more complex API definition

* Adds basic supporting files

* Adds empty environment file for variables
* Adds basic README

* Adds minimal set of values in env file`

* Adds minimal support for API Key header

* Adds Adyen API sample

* Add null checks on code

* Simplifies the generator, cleans output

* Improves README

* Fix minor issues with README

* Removes API file and config used for local testing

* Remove leftover logging file

* Disables tests as I find how to write them

* Sets generator as experimental

* Add new generator language enum value

* Adds generator doc file

* Adds generators main file

* Removes unused method. Adds my name

* Adding Jetbrains HTTP Client to the README
2023-01-31 22:03:15 +08:00
Martin Delille
fa1cbb9322 Add action for qt client (#14566)
* Add action for qt client

* Use matrix for os too
2023-01-31 21:59:38 +08:00
William Cheng
37e8cfadc7 minor imrovemets to julia generators (#14560) 2023-01-30 20:20:45 +08:00
William Cheng
fd45b74128 [Java] better default value handling (#14130)
* add test for array default value

* update null return

* minor fixes

* move default value tests to echo api spec

* add new files

* remove unused files

* fix enum array default, add tests

* better array init

* Update modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java

Co-authored-by: Leonard Brünings <lord_damokles@gmx.net>

* Update modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java

Co-authored-by: Leonard Brünings <lord_damokles@gmx.net>

* revert the fix

* improve default value handling

* update native samples, add tests

* update samples

* fix tests

* use conditional test for timezone

* add tests to apache http client echo api

* add option to default container to null

* fix map default value

* minor refactoring

* update samples

* fix javadoc

* fix pom.xml

* add tests in java native echo client

* add java apache client echo tests

* fix test

* fix test

---------

Co-authored-by: Leonard Brünings <lord_damokles@gmx.net>
2023-01-30 20:19:00 +08:00
William Cheng
b3527348f3 update doc 2023-01-30 16:58:19 +08:00
Tanmay Mohapatra
4bc16ea6bb Added a Julia client and server (#14520)
* Added a Julia client and server

This PR adds two new generators for the [Julia language](https://julialang.org/)
- `julia-client` to generate a client from specifications
- `julia-server` to generate a server with stubs that can be used to host a server conforming to the specifications

The generated code uses the Julia [OpenAPI.jl](https://github.com/JuliaComputing/OpenAPI.jl) package that includes support functions for both client and server.

* fix javadoc generation

* add changes after ensure-up-to-date run
2023-01-30 16:40:33 +08:00
Oleh Kurpiak
28493dfa95 [Spring] Spring HTTP Interface library (#14485) 2023-01-30 10:37:00 +02:00
Sebastian Cevallos
8540c82d30 Add handling for parsing optional bool params & regenerate samples (#14550) 2023-01-30 16:35:19 +08:00
devhl-labs
b538c2adf8 [csharp-netcore] Fixed serialization of nullable guids (#14556)
* fixed serialization of nullable guids

* build more csharp samples

* build all samples

* why do i have to build again?
2023-01-29 19:16:58 +08:00
devhl-labs
57546d49c2 renamed json converter variables (#14555) 2023-01-29 10:58:53 +08:00
Beppe Catanese
1c157a2847 Support examples in Response Content (#14336)
* Add examples map and overload constructor

* Create CodegenMediaType with examples

* Add test
2023-01-28 12:42:00 +08:00
Martin Delille
03299528e9 Add conan badge (#14537) 2023-01-28 12:12:20 +08:00
bgong-mdsol
47813a88a2 update imports for enum (#14546) 2023-01-28 12:10:59 +08:00
itaru2622
4ffdadfbcc [python-nextgen] fix issue on API example doc autogeneration (#14539)
* [python-nextgen] fix template to make auto-generated example runnable when spec has no auth methods

* update samples with ./bin/generate-samples.sh

* add unit test code
2023-01-28 12:03:17 +08:00
DevFlorian
6a2d8d23da #8792 [Java] [jaxrs-cxf] "useAbstractionForFiles" config option for jaxrs-cxf (#14316)
* [REQ] Add equals and hashcode to java-cxf pojo #12519

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* [Java] Use abstraction for files for jaxrs-cxf #8792

* fix sample

* fix sample

---------

Co-authored-by: FWermelskirchen <fwermelskirchen@eitco.de>
2023-01-28 11:37:08 +08:00
Oleh Kurpiak
ac5134acf3 [Java] fix JsonTypeName import (#14474) (fix #12524) 2023-01-25 14:39:58 +02:00
Michael Ramstein
5047273f1e [elixir] Properly map AnyType (#14497) 2023-01-24 07:48:49 +01:00
tjbdev
82ac92aed6 [elixir] connection.ex typo fix (#14512) 2023-01-24 07:12:32 +01:00
Michael Ramstein
ccbea26390 [elixir] Fixes issue with setting Header parameters (#14511)
* Fixes issue with request not beeing struct of Tesla.Env when setting a header parameter.
2023-01-23 22:03:05 +01:00
William Cheng
90e468b9a3 [java] Fix template logic related to supportUrlQuery (#14496)
* [java] Fix template logic related to supportUrlQuery

Generated models for arrays marked with uniqueItems: true (which end up as a Set<> in java) won't
compile because the templates are in some places using .get(i) on the sets.

Also, when the supportUrlQuery property is present in the additionalProperties map the
resulting value will be read using the key SUPPORT_STREAMING instead of 'supportUrlQuery'.

* fix NPE

Co-authored-by: Björgvin <bjorgvino@gmail.com>
2023-01-21 11:10:30 +08:00
devhl-labs
d4c8c97e19 [csharp-netcore] Pipeline fix (#14495)
* trying to fix pipeline

* forcing pipeline to run

* reverting change to wrong branch

* forcing pipeline to run

* reverting change
2023-01-21 10:46:42 +08:00
William Cheng
5e7d31a83b add a rule to keep only the first tag (#14465) 2023-01-20 15:50:31 +08:00
William Cheng
4ecb9f4186 [java][native] Fix urlQuery string method in oneOf (#14488)
* better tests, fix oneOf in urlquery string method

* update samples

* update
2023-01-20 01:57:32 +08:00
Ian Cubbon
6e780218ad [Go] Client Models using AllOf, OneOf, or AnyOf Correctly Include time and os imports (Attempt 2) (#14459)
* Currently, if a Model is an allOf the time and os imports are not correctly added to the generated file. This was introduced recently with a fix to not include those imports when the model is a composedSchema #13833. The logic in that fix was just slightly off as an allOf should be treated the same as a standard model.

If a model is an AllOf or does not have any composed schemas at all, the sub-models are in-lined defined in the struct. In this case, the standard logic of including the time and os imports apply.

If a model is a OneOf or AnyOf, the sub-models are included as pointers to the defined model. In this case, do not include those items in the logic of including time and os imports.

* Update example to include a time in an allOf

* Add back the accidentally removed nil check
2023-01-20 01:53:19 +08:00
William Cheng
6cd7989e9e [Java][native][apache-httpclient] Update toUrlQueryString to support form style for object (#14478)
* update toUrlQueryString

* add new files

* minor bug fixes

* support object in query parameter - java apache httpclient

* rename variable - java native

* update samples

* fix try catch
2023-01-19 16:13:51 +08:00
William Cheng
d1cde7febe Add 2 rules to OpenAPI Normalizer (#14463)
* add REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIIES_ONLY

* add rules to simplify anyOf

* fix rules, update docs

* remove test

* fix doc
2023-01-17 21:27:57 +08:00
Johnny Marnell
c912bae3bc [Spring] Fix bean name collisions (#14092) (fix #14094)
* Use correct Pascal case for java enum

* Uniquely name @Bean annotations

* Use existing mustache var instead, run generate files

* rebase, re-run generators

* try to undo botched rebase/merge

* Attempt to manually undo whatever is going on w/ build, oops

* Attempt to manually undo whatever is going on w/ build, oops
2023-01-17 11:24:15 +02:00
Vikrant Balyan
9f502930ea [Go] Adds a sha256 configuration option to hs2019 (#14467)
* enables configuration of sha256 with hs2019

* committing generated examples

Co-authored-by: Aanisha Mishra <aanisha.mishra05@gmail.com>
Co-authored-by: Sebastien Rosset <serosset@cisco.com>
2023-01-16 23:21:53 +08:00
Marvin Rensing
4cd080762a [Java][Spring] fix RequestPart/RequestParam handling on multipart request for arrays (#14450) (fix #14449) 2023-01-16 11:39:51 +02:00
Ian Cubbon
74073df27c [GO][Client] Use a *os.File for the API Client when uploading and downloading (#14340)
* Change the return type of a file back to a pointer

* Change the api template to handle not double pointer-ing return types of os.File

* Fix unit tests

* Couple more unit test fixes
2023-01-16 16:51:04 +08:00
Oleh Kurpiak
27137e75ce [Java][Spring] fix ParameterObject import for Spring Boot 3 (#14454)
fix #14077
2023-01-14 08:00:32 -08:00
Paul Parenko
be87382fde [Java][Spring] Fix #14398 springboot 3 schema required (#14402)
* fix depricated @Schema(required) since swagger 2.2.5

* use same swagger-annotations version which is used by swagger-core which is a dependency of springdoc

* generated java sampes
2023-01-14 06:59:33 -08:00
philkild
7958990254 Add CancellationToken to generated aspnetcore controller methods. (#14326) 2023-01-14 22:15:53 +08:00
Ian Cubbon
92775ceffc [Go] [Client] Don't Explode Query Params (#14447)
* If the collection type is csv, that means 'dont explode the query params'.

* Simplify the logic just a tad

* url.Values -> Has was added in go1.17 but there are CI tests running at 1.16
2023-01-14 00:48:27 +08:00
Bruno Coelho
d348754399 [kotlin][client] add info if endpoints requires authentication or not (#14445)
* [kotlin][client] add info if endpoints requires authentication or not

* [kotlin][client] update sample projects

* [kotlin][client] add info if endpoints requires authentication or not

* [kotlin][client] update sample projects
2023-01-13 10:29:27 +00:00
Bruno Coelho
b6ad68baca [swift5][client] - fix combine warning (#14444)
* [swift5][client] - fix combine warning

* [swift5][client] - fix combine warning

* [swift5][client] - update samples
2023-01-13 10:29:00 +00:00
William Cheng
079ad1742e update useRuntimeException description (#14452) 2023-01-13 17:38:31 +08:00
William Cheng
cf4f2c76b2 Use inline allof instead of $ref in echo test (#14429)
* use inline allof instead of $ref in echo test

* update samples

* update samples

* fix tests
2023-01-13 17:21:28 +08:00
Sebastian Saip
ed2029f863 [Java][Microprofile] fix useRuntimeException (#14409) (#14414)
Co-authored-by: Sebastian Saip <sebastian.saip@senacor.com>
2023-01-13 15:42:07 +08:00
devhl-labs
8abc750c0e [csharp-netcore] Added isNew property to CodegenProperty (#14412)
* added isNew property to CodegenModel

* build all samples
2023-01-13 14:43:33 +08:00
William Cheng
9fae221f1d [Java][okhttp-gson] add echo client test (#14442)
* add echo api tests for java okhttp client

* test okhttp gson echo client in jdk8 workflow

* update samples
2023-01-13 00:15:29 +08:00
Bruno Coelho
b1f8f976c0 [swift5][client] - enable swift unit tests (#14441) 2023-01-12 15:10:15 +00:00
William Cheng
a584f32d68 Add workflow to test java apache client with jdk8 (#14437)
* add workflow to test java apache client with jdk8

* fix url encode issue with jdk8

* update samples

* minor improvements in java native client

* minor fix
2023-01-12 22:12:08 +08:00
Paul Parenko
c2c91e2d2e [Java][Spring] Fix #14362 when useSpringBoot3=true, then useJakartaEe=true (#14373) 2023-01-12 19:54:42 +08:00
Oleh Kurpiak
076b88429e [Java][Spring] fix param docs (#14426) 2023-01-12 19:53:01 +08:00
Chao Yang
e1e291bc12 [Crystal] Skip primitive types from ModelImportMap (#14436)
* Support requiring models in crystal lang

* Return null instead of empty string
2023-01-12 19:42:33 +08:00
Bruno Coelho
e8811ecd28 [swift5][client] - simplify async await (#14430)
* [swift5][client] - simplify async await

* [swift5][client] - update sample projects

* [swift5][client] - add more tests
2023-01-12 10:55:41 +00:00
William Cheng
cffacc8023 fix deploy in travis (#14428) 2023-01-12 01:05:52 +08:00
Tino Fuhrmann
a31b5b119e Documentation of Configuration/ConfigurationParameter for consolidated TypeScript generator (#10283)
* Added additional documentation for configuration object

* Regenerate samples

* Added exemplary usage of API to README.md

* Updated README, refined wording

* Added example for calling the API

* Regenerated samples

* Updated samples
2023-01-11 15:18:53 +01:00
Oleh Kurpiak
5dbfea6ecc [Java][Spring] fix default response code (#14399) 2023-01-11 20:34:58 +08:00
William Cheng
50e295e3c6 Fix missing import in allOf query parameters (#14408)
* add test for allOf in query parameter

* fix missing import in allof query parameter

* update samples

* update samples
2023-01-11 20:29:13 +08:00
William Cheng
3f96cdb756 Fix circleci build failure (node1) and Travis build failure (#14425)
* move python fastapi test to another node

* fix travis build

* fix install

* fix install

* fix install

* skip php test

* fix

* use trusty

* test bionic

* fix install

* fix pom

* skip perl test

* skip fastapitest
2023-01-11 20:28:53 +08:00
William Cheng
e825f27b0b [java][apache-httpclient] Add deep object url query parameter support (#14417)
* add deep object url query parameter to java apache-httpclient

* update doc string
2023-01-11 11:04:14 +08:00
yosshi4486
4044e724c0 [Swift5] Add an async execute API to RequestBuilder<T> (#14416)
* Add async `execute` interface

* Update samples

Run `./bin/generate-samples.sh`

* Add an explicit `self`

I forgot to add it

* Add an availability condition
2023-01-10 17:05:52 +00:00
Maxime Dufour
c6ea564600 [Java][Client Default] Support of AWS Signature V4 (#14287)
* Add support of AWSV4 Signature in Java

* Add Petstore sample for AWSV4 Signature

* Update other sample examples

* Sync Documentation and sample

* Specify only available for okhttp-gson in doc
2023-01-10 19:29:20 +08:00
3329 changed files with 104582 additions and 12554 deletions

View File

@@ -16,5 +16,10 @@
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example `./bin/generate-samples.sh bin/configs/java*`.
For Windows users, please run the script in [Git BASH](https://gitforwindows.org/).
- [ ] In case you are adding a new generator, run the following additional script :
```
./bin/utils/ensure-up-to-date.sh
```
Commit all changed files.
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master` (6.3.0) (minor release - breaking changes with fallbacks), `7.0.x` (breaking changes without fallbacks)
- [ ] If your PR is targeting a particular programming language, @mention the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) members, so they are more likely to review the pull request.

View File

@@ -0,0 +1,34 @@
name: Samples cpp qt client
on:
push:
branches:
- 'samples/client/petstore/cpp-qt/**'
pull_request:
paths:
- 'samples/client/petstore/cpp-qt/**'
env:
GRADLE_VERSION: 6.9
jobs:
build:
name: Build cpp qt client
strategy:
matrix:
qt-version:
- '5.15.2'
- '6.4.2'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt-version }}
- name: Build
working-directory: "samples/client/petstore/cpp-qt"
run: ./build-and-test.bash

View File

@@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: 2.1.*
dotnet-version: 3.1.*
- name: Build
working-directory: ${{ matrix.sample }}
run: dotnet build Org.OpenAPITools.sln

View File

@@ -0,0 +1,48 @@
name: Java Client (Echo API) JDK8
on:
push:
paths:
- samples/client/echo_api/java/apache-httpclient/**
- samples/client/echo_api/java/feign-gson/**
- samples/client/echo_api/java/okhttp-gson/**
pull_request:
paths:
- samples/client/echo_api/java/apache-httpclient/**
- samples/client/echo_api/java/feign-gson/**
- samples/client/echo_api/java/okhttp-gson/**
jobs:
build:
name: Build Java Client JDK8
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# clients
- samples/client/echo_api/java/apache-httpclient
- samples/client/echo_api/java/feign-gson
- samples/client/echo_api/java/okhttp-gson
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v3
env:
cache-name: maven-repository
with:
path: |
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Setup node.js
uses: actions/setup-node@v3
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
(cd http-echo-server && npm install && npm start &)
- name: Build
working-directory: ${{ matrix.sample }}
run: mvn clean package

View File

@@ -6,6 +6,8 @@ on:
- samples/openapi3/client/petstore/spring-cloud-3/**
- samples/client/petstore/java-helidon-client/mp/**
- samples/client/petstore/java-helidon-client/se/**
- samples/client/petstore/spring-http-interface-reactive/**
- samples/client/petstore/spring-http-interface/**
# servers
- samples/openapi3/server/petstore/springboot-3/**
- samples/server/petstore/java-helidon-server/mp/**
@@ -16,6 +18,8 @@ on:
- samples/openapi3/client/petstore/spring-cloud-3/**
- samples/client/petstore/java-helidon-client/mp/**
- samples/client/petstore/java-helidon-client/se/**
- samples/client/petstore/spring-http-interface-reactive/**
- samples/client/petstore/spring-http-interface/**
# servers
- samples/openapi3/server/petstore/springboot-3/**
- samples/server/petstore/java-helidon-server/mp/**
@@ -32,10 +36,14 @@ jobs:
- samples/openapi3/client/petstore/spring-cloud-3
- samples/client/petstore/java-helidon-client/mp
- samples/client/petstore/java-helidon-client/se
- samples/client/petstore/spring-http-interface-reactive
- samples/client/petstore/spring-http-interface
# servers
- samples/openapi3/server/petstore/springboot-3
- samples/server/petstore/java-helidon-server/mp
- samples/server/petstore/java-helidon-server/se
- samples/client/petstore/spring-http-interface-reactive
- samples/client/petstore/spring-http-interface
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3

View File

@@ -0,0 +1,46 @@
name: Samples Kotlin server
on:
push:
branches:
- 'samples/server/petstore/kotlin-springboot-3*/**'
pull_request:
paths:
- 'samples/server/petstore/kotlin-springboot-3*/**'
env:
GRADLE_VERSION: 7.4
jobs:
build:
name: Build Kotlin server
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# server
- samples/server/petstore/kotlin-springboot-3
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Cache maven dependencies
uses: actions/cache@v3
env:
cache-name: maven-repository
with:
path: |
~/.gradle
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Install Gradle wrapper
uses: eskatos/gradle-command-action@v2
with:
gradle-version: ${{ env.GRADLE_VERSION }}
build-root-directory: ${{ matrix.sample }}
arguments: wrapper
- name: Build
working-directory: ${{ matrix.sample }}
run: ./gradlew build -x test

View File

@@ -50,15 +50,16 @@ before_install:
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
#- sudo apt-get install -qqy --no-install-recommends google-chrome-stable
#- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- mkdir -vp ~/.docker/cli-plugins/
- curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
# to run petstore server locally via docker
- echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin || true
- docker pull swaggerapi/petstore
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
- docker ps -a
#- echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin || true
#- docker pull swaggerapi/petstore
#- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
#- docker ps -a
# comment out crystal installation as the tests will run on circleci or github action instead
# install crystal
#- echo 'deb http://download.opensuse.org/repositories/devel:/languages:/crystal/xUbuntu_16.04/ /' | sudo tee /etc/apt/sources.list.d/devel:languages:crystal.list
@@ -69,11 +70,11 @@ before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22.0
- export PATH="$HOME/.yarn/bin:$PATH"
# install rust
- curl https://sh.rustup.rs -sSf | sh -s -- -y -v
# required when sudo: required for the Ruby petstore tests
- gem install bundler -v 2.3.26
# set python 3.6.3 as default
- source ~/virtualenv/python3.6/bin/activate
#- curl https://sh.rustup.rs -sSf | sh -s -- -y -v
## required when sudo: required for the Ruby petstore tests
#- gem install bundler -v 2.3.26
## set python 3.6.3 as default
#- source ~/virtualenv/python3.6/bin/activate
# -- skip bash test to shorten build time
# Add bats test framework and cURL for Bash script integration tests
#- sudo add-apt-repository ppa:duggan/bats --yes
@@ -88,18 +89,18 @@ before_install:
#- sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
#- sudo apt-get update
#- sudo apt-get install dart
# switch to php7
- sudo apt-get install libonig-dev libzip-dev
- git clone https://github.com/php-build/php-build $(phpenv root)/plugins/php-build
- git clone https://github.com/ngyuki/phpenv-composer.git $(phpenv root)/plugins/phpenv-composer
- if [ $(ls -A "$HOME/.phpenv/versions/8.1.4" | wc -l) -eq 0 ]; then
phpenv install 8.1.4;
fi;
- phpenv rehash
- phpenv versions
#- phpenv global 7.2.15
- phpenv global 8.1.4
- php -v
# switch to php8
#- sudo apt-get install -f libonig-dev libzip-dev
#- git clone https://github.com/php-build/php-build $(phpenv root)/plugins/php-build
#- git clone https://github.com/ngyuki/phpenv-composer.git $(phpenv root)/plugins/phpenv-composer
#- if [ $(ls -A "$HOME/.phpenv/versions/8.1.4" | wc -l) -eq 0 ]; then
# phpenv install 8.1.4;
# fi;
#- phpenv rehash
#- phpenv versions
##- phpenv global 7.2.15
#- phpenv global 8.1.4
#- php -v
# comment out below as installation failed in travis
# Add rebar3 build tool and recent Erlang/OTP for Erlang petstore server tests.
# - Travis CI does not support rebar3 [yet](https://github.com/travis-ci/travis-ci/issues/6506#issuecomment-275189490).
@@ -107,15 +108,15 @@ before_install:
# - . ~/otp/18.2.1/activate && erl -version
#- curl -f -L -o ./rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 && ./rebar3 version && export PATH="${TRAVIS_BUILD_DIR}:$PATH"
# install C++ tools
- sudo apt install -y --no-install-recommends valgrind cmake build-essential
- cmake --version
#- sudo apt install -y --no-install-recommends valgrind cmake build-essential
#- cmake --version
# install Qt5
#- sudo apt install -y --no-install-recommends qt5-default
# install boost
- sudo apt install -y --no-install-recommends libboost-all-dev
#- sudo apt install -y --no-install-recommends libboost-all-dev
# perl dep
- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
- cpanm --quiet --no-interactive Test::Exception Test::More Log::Any LWP::UserAgent URI::Query Module::Runtime DateTime Module::Find Moose::Role JSON || echo "Ignored failure from cpanm"
#- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
#- cpanm --quiet --no-interactive Test::Exception Test::More Log::Any LWP::UserAgent URI::Query Module::Runtime DateTime Module::Find Moose::Role JSON || echo "Ignored failure from cpanm"
# show host table to confirm petstore.swagger.io is mapped to localhost
- cat /etc/hosts
# show java version
@@ -127,8 +128,8 @@ before_install:
fi;
- pushd .; cd website; yarn install; popd
# install Deno
- sh -s v1.6.2 < ./CI/deno_install.sh
- export PATH="$HOME/.deno/bin:$PATH"
#- sh -s v1.6.2 < ./CI/deno_install.sh
#- export PATH="$HOME/.deno/bin:$PATH"
install:
# Add Godeps dependencies to GOPATH and PATH
@@ -150,7 +151,7 @@ script:
# 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
- mvn -e --no-snapshot-updates --quiet --batch-mode --show-version verify -Psamples -Dorg.slf4j.simpleLogger.defaultLogLevel=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
@@ -215,14 +216,14 @@ after_success:
fi;
fi;
## publish latest website, variables below are secure environment variables which are unavailable to PRs from forks.
- if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
cd website;
git config --global user.name "${GH_NAME}";
git config --global user.email "${GH_EMAIL}";
echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc;
yarn install;
GIT_USER="${GH_NAME}" yarn run publish-gh-pages;
fi;
#- if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
# cd website;
# git config --global user.name "${GH_NAME}";
# git config --global user.email "${GH_EMAIL}";
# echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc;
# yarn install;
# GIT_USER="${GH_NAME}" yarn run publish-gh-pages;
# fi;
env:
- DOCKER_GENERATOR_IMAGE_NAME=openapitools/openapi-generator-online DOCKER_CODEGEN_CLI_IMAGE_NAME=openapitools/openapi-generator-cli NODE_ENV=test CC=gcc-5 CXX=g++-5

View File

@@ -60,6 +60,7 @@ Code change should conform to the programming style guide of the respective lang
- Haskell: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
- Java: https://google.github.io/styleguide/javaguide.html
- JavaScript: https://github.com/airbnb/javascript/
- Julia: https://docs.julialang.org/en/v1/manual/style-guide/
- Kotlin: https://kotlinlang.org/docs/reference/coding-conventions.html
- ObjC: https://github.com/NYTimes/objective-c-style-guide
- Perl: http://perldoc.perl.org/perlstyle.html

109
README.md
View File

@@ -3,7 +3,13 @@
<div align="center">
[![Stable releases in Maven Central](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/org/openapitools/openapi-generator/maven-metadata.xml.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.openapitools%22%20AND%20a%3A%22openapi-generator%22) [![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-orange)](./LICENSE) [![Open Collective backers](https://img.shields.io/opencollective/backers/openapi_generator?color=orange&label=OpenCollective%20Backers)](https://opencollective.com/openapi_generator) [![Join the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g) [![Follow OpenAPI Generator Twitter account to get the latest update](https://img.shields.io/twitter/follow/oas_generator.svg?style=social&label=Follow)](https://twitter.com/oas_generator) [![Contribute with Gitpod](https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/OpenAPITools/openapi-generator)
[![Stable releases in Maven Central](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/org/openapitools/openapi-generator/maven-metadata.xml.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.openapitools%22%20AND%20a%3A%22openapi-generator%22)
[![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-orange)](./LICENSE)
[![Open Collective backers](https://img.shields.io/opencollective/backers/openapi_generator?color=orange&label=OpenCollective%20Backers)](https://opencollective.com/openapi_generator)
[![Join the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g)
[![Follow OpenAPI Generator Twitter account to get the latest update](https://img.shields.io/twitter/follow/oas_generator.svg?style=social&label=Follow)](https://twitter.com/oas_generator)
[![Contribute with Gitpod](https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/OpenAPITools/openapi-generator)
[![Conan Center](https://shields.io/conan/v/openapi-generator)](https://conan.io/center/openapi-generator)
</div>
@@ -71,13 +77,13 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
## Overview
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification) (both 2.0 and 3.0 are supported). Currently, the following languages/frameworks are supported:
| | Languages/Frameworks |
| -------------------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient, Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client, Helidon), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 13.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) |
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) |
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer**, **WSDL** |
| | Languages/Frameworks |
| -------------------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient, Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 13.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) |
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) |
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer**, **WSDL** |
## Table of contents
@@ -954,7 +960,9 @@ Here is a list of template creators:
* JavaScript (Apollo DataSource): @erithmetic
* JavaScript (Closure-annotated Angular) @achew22
* JavaScript (Flow types) @jaypea
* Jetbrains HTTP Client : @jlengrand
* JMeter: @davidkiss
* Julia: @tanmaykm
* Kotlin: @jimschubert [:heart:](https://www.patreon.com/jimschubert)
* Kotlin (MultiPlatform): @andrewemery
* Kotlin (Volley): @alisters
@@ -1022,6 +1030,7 @@ Here is a list of template creators:
* JAX-RS CXF: @hiveship
* JAX-RS CXF (CDI): @nickcmaynard
* JAX-RS RestEasy (JBoss EAP): @jfiala
* Julia: @tanmaykm
* Kotlin: @jimschubert [:heart:](https://www.patreon.com/jimschubert)
* Kotlin (Spring Boot): @dr4ke616
* Kotlin (Vertx): @Wooyme
@@ -1089,47 +1098,49 @@ If you want to join the committee, please kindly apply by sending an email to te
#### Members of Technical Committee
| Languages/Generators | Member (join date) |
| :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ActionScript | |
| Ada | @stcarrez (2018/02) @michelealbano (2018/02) |
| Android | @jaz-ah (2017/09) |
| Apex | |
| Bash | @frol (2017/07) @bkryza (2017/08) @kenjones-cisco (2017/09) |
| C | @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) |
| C++ | @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @martindelille (2018/03) @muttleyxd (2019/08) |
| C# | @mandrean (2017/08) @frankyjuang (2019/09) @shibayan (2020/02) @Blackclaws (2021/03) @lucamazzanti (2021/05) |
| Clojure | |
| Crystal | @cyangle (2021/01) |
| Dart | @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08) |
| Eiffel | @jvelilla (2017/09) |
| Elixir | @mrmstn (2018/12) |
| Elm | @eriktim (2018/09) |
| Erlang | @tsloughter (2017/11) @jfacorro (2018/10) @robertoaloi (2018/10) |
| F# | @nmfisher (2019/05) |
| Go | @antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) @ph4r5h4d (2021/04) |
| GraphQL | @renepardon (2018/12) |
| Groovy | |
| Haskell | |
| Java | @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) |
| Java Spring | @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) |
| JMeter | @kannkyo (2021/01) |
| Kotlin | @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) |
| Lua | @daurnimator (2017/08) |
| Nim | |
| NodeJS/Javascript | @CodeNinjai (2017/07) @frol (2017/07) @cliffano (2017/07) |
| ObjC | |
| OCaml | @cgensoul (2019/08) |
| Perl | @wing328 (2017/07) [:heart:](https://www.patreon.com/wing328) @yue9944882 (2019/06) |
| PHP | @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), [@ybelenko](https://github.com/ybelenko) (2018/07), @renepardon (2018/12) |
| PowerShell | @wing328 (2020/05) |
| Python | @spacether (2019/11) [:heart:][spacether sponsorship] |
| R | @Ramanth (2019/07) @saigiridhar21 (2019/07) |
| Ruby | @cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) |
| Rust | @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) @jacob-pro (2022/10) |
| Scala | @clasnake (2017/07), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04) |
| Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @4brunu (2019/11) |
| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) |
| Languages/Generators | Member (join date) |
|:----------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ActionScript | |
| Ada | @stcarrez (2018/02) @michelealbano (2018/02) |
| Android | @jaz-ah (2017/09) |
| Apex | |
| Bash | @frol (2017/07) @bkryza (2017/08) @kenjones-cisco (2017/09) |
| C | @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) |
| C++ | @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @martindelille (2018/03) @muttleyxd (2019/08) |
| C# | @mandrean (2017/08) @frankyjuang (2019/09) @shibayan (2020/02) @Blackclaws (2021/03) @lucamazzanti (2021/05) |
| Clojure | |
| Crystal | @cyangle (2021/01) |
| Dart | @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08) |
| Eiffel | @jvelilla (2017/09) |
| Elixir | @mrmstn (2018/12) |
| Elm | @eriktim (2018/09) |
| Erlang | @tsloughter (2017/11) @jfacorro (2018/10) @robertoaloi (2018/10) |
| F# | @nmfisher (2019/05) |
| Go | @antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) @ph4r5h4d (2021/04) |
| GraphQL | @renepardon (2018/12) |
| Groovy | |
| Haskell | |
| Java | @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) |
| Java Spring | @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) |
| JMeter | @kannkyo (2021/01) |
| Jetbrains HTTP Client | @jlengrand (2023/01) |
| Julia | @tanmaykm (2023/01) |
| Kotlin | @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) |
| Lua | @daurnimator (2017/08) |
| Nim | |
| NodeJS/Javascript | @CodeNinjai (2017/07) @frol (2017/07) @cliffano (2017/07) |
| ObjC | |
| OCaml | @cgensoul (2019/08) |
| Perl | @wing328 (2017/07) [:heart:](https://www.patreon.com/wing328) @yue9944882 (2019/06) |
| PHP | @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), [@ybelenko](https://github.com/ybelenko) (2018/07), @renepardon (2018/12) |
| PowerShell | @wing328 (2020/05) |
| Python | @spacether (2019/11) [:heart:][spacether sponsorship] |
| R | @Ramanth (2019/07) @saigiridhar21 (2019/07) |
| Ruby | @cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) |
| Rust | @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) @jacob-pro (2022/10) |
| Scala | @clasnake (2017/07), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04) |
| Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @4brunu (2019/11) |
| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) |
Past Members of Technical Committee:

View File

@@ -3,5 +3,6 @@ outputDir: samples/client/petstore/cpp-qt
inputSpec: modules/openapi-generator/src/test/resources/3_0/cpp-qt/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/cpp-qt-client
additionalProperties:
packageName: CppQtPetstoreClient
cppNamespace: test_namespace
modelNamePrefix: PFX

View File

@@ -1,7 +1,7 @@
generatorName: java
outputDir: samples/client/petstore/java/native-async
library: native
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-native

View File

@@ -1,7 +1,7 @@
generatorName: java
outputDir: samples/client/petstore/java/native
library: native
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-native

View File

@@ -0,0 +1,11 @@
generatorName: java
outputDir: samples/client/petstore/java/okhttp-gson-awsv4signature
library: okhttp-gson
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: okhttp-gson-awsv4signature
hideGenerationTimestamp: "true"
useOneOfDiscriminatorLookup: "true"
disallowAdditionalPropertiesIfNotPresent: false
withAWSV4Signature: true

View File

@@ -0,0 +1,8 @@
generatorName: java
outputDir: samples/client/echo_api/java/okhttp-gson
#library: okhttp-gson
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: echo-api-okhttp-gson
hideGenerationTimestamp: "true"

View File

@@ -7,3 +7,4 @@ additionalProperties:
artifactId: petstore-resttemplate
hideGenerationTimestamp: "true"
java8: true
containerDefaultToNull: true

View File

@@ -6,3 +6,4 @@ templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-webclient
hideGenerationTimestamp: "true"
containerDefaultToNull: "true"

View File

@@ -0,0 +1,6 @@
generatorName: jetbrains-http-client
outputDir: samples/client/petstore/jetbrains/http/client
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/jetbrains-http-client
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -0,0 +1,7 @@
generatorName: julia-client
outputDir: samples/client/petstore/julia
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/julia-client
additionalProperties:
hideGenerationTimestamp: "true"
packageName: PetStoreClient

View File

@@ -0,0 +1,7 @@
generatorName: julia-server
outputDir: samples/server/petstore/julia
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/julia-server
additionalProperties:
hideGenerationTimestamp: "true"
packageName: PetStoreServer

View File

@@ -0,0 +1,13 @@
generatorName: kotlin-spring
outputDir: samples/server/petstore/kotlin-springboot-3
library: spring-boot
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
additionalProperties:
documentationProvider: none
annotationLibrary: none
useSwaggerUI: "false"
serviceImplementation: "true"
serializableModel: "true"
beanValidations: "true"
useSpringBoot3: "true"

View File

@@ -0,0 +1,11 @@
generatorName: spring
library: spring-http-interface
outputDir: samples/client/petstore/spring-http-interface-reactive
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
artifactId: spring-http-interface-reactive
snapshotVersion: "true"
hideGenerationTimestamp: "true"
reactive: "true"

View File

@@ -0,0 +1,10 @@
generatorName: spring
library: spring-http-interface
outputDir: samples/client/petstore/spring-http-interface
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
artifactId: spring-http-interface
snapshotVersion: "true"
hideGenerationTimestamp: "true"
modelNameSuffix: 'Dto'

View File

@@ -64,6 +64,7 @@ Code change should conform to the programming style guide of the respective lang
- Haskell: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
- Java: https://google.github.io/styleguide/javaguide.html
- JavaScript: https://github.com/airbnb/javascript/
- Julia: https://docs.julialang.org/en/v1/manual/style-guide/
- Kotlin: https://kotlinlang.org/docs/reference/coding-conventions.html
- ObjC: https://github.com/NYTimes/objective-c-style-guide
- Perl: http://perldoc.perl.org/perlstyle.html

View File

@@ -456,11 +456,24 @@ Note: Only arrayItemSuffix, mapItemSuffix are supported at the moment. `SKIP_SCH
OpenAPI Normalizer (off by default) transforms the input OpenAPI doc/spec (which may not perfectly conform to the specification) to make it workable with OpenAPI Generator. Here is a list of rules supported:
- `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)
- `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/ --additional-properties hideGenerationTimestamp="true" --openapi-normalizer REF_AS_PARENT_IN_ALLOF=true
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
```
- `REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY`: when set to `true`, oneOf/anyOf schema with only required properies only in a schema with properties will be removed. [(example)](modules/openapi-generator/src/test/resources/3_0/removeAnyOfOneOfAndKeepPropertiesOnly_test.yaml)
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/removeAnyOfOneOfAndKeepPropertiesOnly_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY=true
```
- `SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING`: when set to `true`, simplify anyOf schema with string and enum of string to just `string`
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/simplifyAnyOfStringAndEnumString_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING=true
```

View File

@@ -39,7 +39,9 @@ The following generators are available:
* [javascript-closure-angular](generators/javascript-closure-angular.md)
* [javascript-flowtyped](generators/javascript-flowtyped.md)
* [jaxrs-cxf-client](generators/jaxrs-cxf-client.md)
* [jetbrains-http-client (experimental)](generators/jetbrains-http-client.md)
* [jmeter](generators/jmeter.md)
* [julia-client (beta)](generators/julia-client.md)
* [k6 (beta)](generators/k6.md)
* [kotlin](generators/kotlin.md)
* [lua (beta)](generators/lua.md)
@@ -110,6 +112,7 @@ The following generators are available:
* [jaxrs-resteasy](generators/jaxrs-resteasy.md)
* [jaxrs-resteasy-eap](generators/jaxrs-resteasy-eap.md)
* [jaxrs-spec](generators/jaxrs-spec.md)
* [julia-server (beta)](generators/julia-server.md)
* [kotlin-server](generators/kotlin-server.md)
* [kotlin-spring](generators/kotlin-spring.md)
* [kotlin-vertx (beta)](generators/kotlin-vertx.md)

View File

@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|modelNamePrefix|Prefix that will be prepended to all model names.| |OAI|
|optionalProjectFile|Generate client.pri.| |true|
|packageName|C++ package (library) name.| |QtOpenAPIClient|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|

View File

@@ -45,6 +45,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>AnyType</li>
<li>Atom</li>
<li>Boolean</li>
<li>DateTime</li>
@@ -56,6 +57,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>PID</li>
<li>String</li>
<li>Tuple</li>
<li>any()</li>
<li>map()</li>
</ul>
@@ -103,7 +105,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|Uuid|✗|
|Array|✓|OAS2,OAS3
|Null|✗|OAS3
|AnyType||OAS2,OAS3
|AnyType||OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2

View File

@@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -42,6 +42,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelUseDefaultValidationErrorProcessor|generate default validation error processor| |true|
|camelValidationErrorProcessor|validation error processor bean name| |validationErrorProcessor|
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
@@ -64,7 +65,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|invokerPackage|root package for generated code| |org.openapitools.api|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd></dl>|spring-boot|
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd><dt>**spring-http-interface**</dt><dd>Spring 6 HTTP interfaces (testing)</dd></dl>|spring-boot|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model|
@@ -95,7 +96,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|
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports).| |false|
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|useSpringController|Annotate the generated API as a Spring Controller| |false|
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|useTags|use tags for creating interface and controller classnames| |false|

View File

@@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|configKey|Config key in @RegisterRestClient. Default to none.| |null|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|

View File

@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|

View File

@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -34,6 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|build|Specify for which build tool to generate files|<dl><dt>**gradle**</dt><dd>Gradle configuration is generated for the project</dd><dt>**all**</dt><dd>Both Gradle and Maven configurations are generated</dd><dt>**maven**</dt><dd>Maven configuration is generated for the project</dd></dl>|all|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|configureAuth|Configure all the authorization methods as specified in the file| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateFormat|Specify the format pattern of date as a string| |null|
|dateLibrary|Option. Date library to use|<dl><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|datetimeFormat|Specify the format pattern of date-time as a string| |null|

View File

@@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|build|Specify for which build tool to generate files|<dl><dt>**gradle**</dt><dd>Gradle configuration is generated for the project</dd><dt>**all**</dt><dd>Both Gradle and Maven configurations are generated</dd><dt>**maven**</dt><dd>Maven configuration is generated for the project</dd></dl>|all|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|controllerPackage|The package in which controllers will be generated| |org.openapitools.api|
|dateFormat|Specify the format pattern of date as a string| |null|
|dateLibrary|Option. Date library to use|<dl><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|

View File

@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|controllerOnly|Whether to generate only API interface stubs without the server files.| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|

View File

@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -34,6 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
|configKey|Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.| |null|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
@@ -87,11 +88,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false|
|usePlayWS|Use Play! Async HTTP client (Play WS API)| |false|
|useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false|
|useRuntimeException|Use RuntimeException instead of Exception| |false|
|useRuntimeException|Use RuntimeException instead of Exception. Only jersey, jersey2, jersey3, okhttp-gson, vertx, microprofile support this option.| |false|
|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY jersey2, jersey3, okhttp-gson support this option.| |false|
|webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false|
|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
## SUPPORTED VENDOR EXTENSIONS

View File

@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
@@ -65,6 +66,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/gen/java|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk.| |false|
|useBeanValidation|Use BeanValidation API annotations| |false|
|useGenericResponse|Use generic response| |false|
|useGzipFeatureForTests|Use Gzip Feature for tests| |false|

View File

@@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
@@ -78,6 +79,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|testDataFile|JSON file to contain generated test data| |null|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|title|a title describing the application| |OpenAPI Server|
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk.| |false|
|useAnnotatedBasePath|Use @Path annotations for basePath| |false|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useBeanValidationFeature|Use BeanValidation Feature| |false|

View File

@@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
@@ -73,6 +74,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sourceFolder|source folder for generated code| |src/gen/java|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|title|a title describing the application| |OpenAPI Server|
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk.| |false|
|useAnnotatedBasePath|Use @Path annotations for basePath| |false|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useBeanValidationFeature|Use BeanValidation Feature| |false|

View File

@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|legacy|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|

View File

@@ -0,0 +1,167 @@
---
title: Documentation for the jetbrains-http-client Generator
---
## METADATA
| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | jetbrains-http-client | pass this to the generate command after -g |
| generator stability | EXPERIMENTAL | |
| generator type | CLIENT | |
| generator language | Jetbrains HTTP Client (HTTP/REST) | |
| generator default templating engine | mustache | |
| helpTxt | Generates a jetbrains-http client. See https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html | |
## CONFIG OPTIONS
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
</ul>
## RESERVED WORDS
<ul class="column-ul">
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Uuid|✗|
|Array|✓|OAS2,OAS3
|Null|✗|OAS3
|AnyType|✗|OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✗|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✓|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✓|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✗|OAS3
|allOf|✗|OAS2,OAS3
|anyOf|✗|OAS3
|oneOf|✗|OAS3
|not|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✓|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✓|OAS2,OAS3
|OAuth2_ClientCredentials|✓|OAS2,OAS3
|OAuth2_AuthorizationCode|✓|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -0,0 +1,219 @@
---
title: Documentation for the julia-client Generator
---
## METADATA
| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | julia-client | pass this to the generate command after -g |
| generator stability | BETA | |
| generator type | CLIENT | |
| generator language | Julia | |
| generator default templating engine | mustache | |
| helpTxt | Generates a julia client. | |
## CONFIG OPTIONS
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|exportModels|Whether to generate code to export model names.| |false|
|exportOperations|Whether to generate code to export operation names.| |false|
|packageName|Julia client package name.| |APIClient|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Any</li>
<li>Bool</li>
<li>Char</li>
<li>Date</li>
<li>DateTime</li>
<li>Dict</li>
<li>Float16</li>
<li>Float32</li>
<li>Float64</li>
<li>Int128</li>
<li>Int16</li>
<li>Int32</li>
<li>Int64</li>
<li>Int8</li>
<li>Integer</li>
<li>Nothing</li>
<li>String</li>
<li>UInt128</li>
<li>UInt16</li>
<li>UInt32</li>
<li>UInt64</li>
<li>UInt8</li>
<li>Vector</li>
<li>Vector{UInt8}</li>
<li>ZonedDateTime</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>Any</li>
<li>Base</li>
<li>DataType</li>
<li>Enum</li>
<li>Type</li>
<li>baremodule</li>
<li>begin</li>
<li>break</li>
<li>catch</li>
<li>ccall</li>
<li>const</li>
<li>continue</li>
<li>do</li>
<li>else</li>
<li>elseif</li>
<li>end</li>
<li>export</li>
<li>finally</li>
<li>for</li>
<li>function</li>
<li>global</li>
<li>if</li>
<li>import</li>
<li>let</li>
<li>local</li>
<li>macro</li>
<li>module</li>
<li>quote</li>
<li>return</li>
<li>try</li>
<li>using</li>
<li>while</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✓|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✓|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Uuid|✗|
|Array|✓|OAS2,OAS3
|Null|✗|OAS3
|AnyType|✗|OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✗|OAS2
|Produces|✗|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✗|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✓|OAS3
|allOf|✓|OAS2,OAS3
|anyOf|✓|OAS3
|oneOf|✓|OAS3
|not|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✓|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✗|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -0,0 +1,218 @@
---
title: Documentation for the julia-server Generator
---
## METADATA
| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | julia-server | pass this to the generate command after -g |
| generator stability | BETA | |
| generator type | SERVER | |
| generator language | Julia | |
| generator default templating engine | mustache | |
| helpTxt | Generates a julia server. | |
## CONFIG OPTIONS
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|exportModels|Whether to generate code to export model names.| |false|
|packageName|Julia server package name.| |APIServer|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Any</li>
<li>Bool</li>
<li>Char</li>
<li>Date</li>
<li>DateTime</li>
<li>Dict</li>
<li>Float16</li>
<li>Float32</li>
<li>Float64</li>
<li>Int128</li>
<li>Int16</li>
<li>Int32</li>
<li>Int64</li>
<li>Int8</li>
<li>Integer</li>
<li>Nothing</li>
<li>String</li>
<li>UInt128</li>
<li>UInt16</li>
<li>UInt32</li>
<li>UInt64</li>
<li>UInt8</li>
<li>Vector</li>
<li>Vector{UInt8}</li>
<li>ZonedDateTime</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>Any</li>
<li>Base</li>
<li>DataType</li>
<li>Enum</li>
<li>Type</li>
<li>baremodule</li>
<li>begin</li>
<li>break</li>
<li>catch</li>
<li>ccall</li>
<li>const</li>
<li>continue</li>
<li>do</li>
<li>else</li>
<li>elseif</li>
<li>end</li>
<li>export</li>
<li>finally</li>
<li>for</li>
<li>function</li>
<li>global</li>
<li>if</li>
<li>import</li>
<li>let</li>
<li>local</li>
<li>macro</li>
<li>module</li>
<li>quote</li>
<li>return</li>
<li>try</li>
<li>using</li>
<li>while</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✓|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✓|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Uuid|✗|
|Array|✓|OAS2,OAS3
|Null|✗|OAS3
|AnyType|✗|OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✗|OAS2
|Produces|✗|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✗|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✓|OAS3
|allOf|✓|OAS2,OAS3
|anyOf|✓|OAS3
|oneOf|✓|OAS3
|not|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✓|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✗|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

212
docs/generators/julia.md Normal file
View File

@@ -0,0 +1,212 @@
---
title: Documentation for the julia Generator
---
## METADATA
| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | julia | pass this to the generate command after -g |
| generator stability | STABLE | |
| generator type | CLIENT | |
| generator language | Java | |
| generator default templating engine | mustache | |
| helpTxt | Generates a julia client. | |
## CONFIG OPTIONS
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|packageName|Julia package name.| |APIClient|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Array</li>
<li>Bool</li>
<li>Char</li>
<li>Float16</li>
<li>Float32</li>
<li>Float64</li>
<li>Int128</li>
<li>Int16</li>
<li>Int32</li>
<li>Int64</li>
<li>Int8</li>
<li>Integer</li>
<li>Nothing</li>
<li>String</li>
<li>UInt128</li>
<li>UInt16</li>
<li>UInt32</li>
<li>UInt64</li>
<li>UInt8</li>
<li>Vector</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>Any</li>
<li>Base</li>
<li>DataType</li>
<li>Enum</li>
<li>Type</li>
<li>baremodule</li>
<li>begin</li>
<li>break</li>
<li>catch</li>
<li>ccall</li>
<li>const</li>
<li>continue</li>
<li>do</li>
<li>else</li>
<li>elseif</li>
<li>end</li>
<li>export</li>
<li>finally</li>
<li>for</li>
<li>function</li>
<li>global</li>
<li>if</li>
<li>import</li>
<li>let</li>
<li>local</li>
<li>macro</li>
<li>module</li>
<li>quote</li>
<li>return</li>
<li>try</li>
<li>using</li>
<li>while</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Uuid|✗|
|Array|✓|OAS2,OAS3
|Null|✗|OAS3
|AnyType|✗|OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✗|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✓|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✓|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✗|OAS3
|allOf|✗|OAS2,OAS3
|anyOf|✗|OAS3
|oneOf|✗|OAS3
|not|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✓|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✓|OAS2,OAS3
|OAuth2_ClientCredentials|✓|OAS2,OAS3
|OAuth2_AuthorizationCode|✓|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -49,6 +49,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sourceFolder|source folder for generated code| |src/main/kotlin|
|title|server title name or client service name| |OpenAPI Kotlin Spring|
|useBeanValidation|Use BeanValidation API annotations to validate data types| |true|
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|useTags|Whether to use tags for creating interface and controller class names| |false|

View File

@@ -35,6 +35,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|containerDefaultToNull|Set containers (array, set, map) default to null| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+)</dd></dl>|java8|
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
@@ -57,7 +58,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|invokerPackage|root package for generated code| |org.openapitools.api|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd></dl>|spring-boot|
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd><dt>**spring-http-interface**</dt><dd>Spring 6 HTTP interfaces (testing)</dd></dl>|spring-boot|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model|
@@ -88,7 +89,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|
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports).| |false|
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|useSpringController|Annotate the generated API as a Spring Controller| |false|
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|useTags|use tags for creating interface and controller classnames| |false|

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0-SNAPSHOT</version>
<version>6.3.0</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -6,7 +6,7 @@
<artifactId>openapi-generator-project</artifactId>
<groupId>org.openapitools</groupId>
<!-- RELEASE_VERSION -->
<version>6.3.0-SNAPSHOT</version>
<version>6.3.0</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -1,5 +1,5 @@
# RELEASE_VERSION
openApiGeneratorVersion=6.3.0-SNAPSHOT
openApiGeneratorVersion=6.3.0
# /RELEASE_VERSION
# BEGIN placeholders

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0-SNAPSHOT</version>
<version>6.3.0</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -1,3 +1,3 @@
# RELEASE_VERSION
openApiGeneratorVersion=6.3.0-SNAPSHOT
openApiGeneratorVersion=6.3.0
# /RELEASE_VERSION

View File

@@ -138,6 +138,35 @@ Notice that some of these environment variable options may overwrite or conflict
The difference here is that you may define `generateModels` and `modelsToGenerate` as properties, while `globalProperties` may only be configured as a configuration node.
### Type and import mappings
To override the mappings between OpenAPI spec types and the types used in the generated code, set `typeMappings`.
```xml
<configuration>
<typeMappings>
<!-- convert Double to BigDecimal -->
<typeMapping>Double=java.math.BigDecimal</typeMapping>
</typeMappings>
</configuration>
```
For types that are not already included in the generator configuration, you may need to add a corresponding `importMapping` too.
```xml
<configuration>
<!-- convert file/binary to JAX-RS StreamingOutput -->
<typeMappings>
<typeMapping>binary=StreamingOutput</typeMapping>
<typeMapping>file=StreamingOutput</typeMapping>
</typeMappings>
<importMappings>
<importMapping>StreamingOutput=javax.ws.rs.core.StreamingOutput</importMapping>
</importMappings>
</configuration>
```
### Custom Generator
Specifying a custom generator is a bit different. It doesn't support the classpath:/ syntax, but it does support the fully qualified name of the package. You can also specify your custom templates, which also get pulled in. Notice the dependency on a project, in the plugin scope. That would be your generator/template jar.

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0-SNAPSHOT</version>
<version>6.3.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -15,7 +15,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0-SNAPSHOT</version>
<version>6.3.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -19,7 +19,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0-SNAPSHOT</version>
<version>6.3.0</version>
<!-- /RELEASE_VERSION -->
<dependencies>
<dependency>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0-SNAPSHOT</version>
<version>6.3.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0-SNAPSHOT</version>
<version>6.3.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
<version>2.7.6</version>
</parent>
<build>
<plugins>
@@ -20,7 +20,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0-SNAPSHOT</version>
<version>6.3.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -5,7 +5,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0-SNAPSHOT</version>
<version>6.3.0</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0-SNAPSHOT</version>
<version>6.3.0</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0-SNAPSHOT</version>
<version>6.3.0</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -1,13 +1,17 @@
package org.openapitools.codegen;
import io.swagger.v3.oas.models.examples.Example;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
public class CodegenMediaType {
private CodegenProperty schema;
private LinkedHashMap<String, CodegenEncoding> encoding;
private HashMap<String, SchemaTestCase> testCases = new HashMap<>();
private Map<String, Example> examples = null;
public CodegenMediaType(CodegenProperty schema, LinkedHashMap<String, CodegenEncoding> encoding, HashMap<String, SchemaTestCase> testCases) {
this.schema = schema;
@@ -17,6 +21,11 @@ public class CodegenMediaType {
}
}
public CodegenMediaType(CodegenProperty schema, LinkedHashMap<String, CodegenEncoding> encoding, HashMap<String, SchemaTestCase> testCases, Map<String, Example> examples) {
this(schema, encoding, testCases);
this.examples = examples;
}
public CodegenProperty getSchema() {
return schema;
}
@@ -27,6 +36,10 @@ public class CodegenMediaType {
public HashMap<String, SchemaTestCase> getTestCases() { return testCases; }
public Map<String, Example> getExamples() {
return examples;
}
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenMediaType{");
sb.append("schema=").append(schema);

View File

@@ -157,6 +157,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
public boolean isSelfReference;
public boolean isCircularReference;
public boolean isDiscriminator;
public boolean isNew; // true when this property overrides an inherited property
public List<String> _enum;
public Map<String, Object> allowableValues;
// If 'additionalProperties' is not set, items is null.
@@ -1063,6 +1064,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
sb.append(", isSelfReference=").append(isSelfReference);
sb.append(", isCircularReference=").append(isCircularReference);
sb.append(", isDiscriminator=").append(isDiscriminator);
sb.append(", isNew=").append(isNew);
sb.append(", _enum=").append(_enum);
sb.append(", allowableValues=").append(allowableValues);
sb.append(", items=").append(items);
@@ -1153,6 +1155,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
isSelfReference == that.isSelfReference &&
isCircularReference == that.isCircularReference &&
isDiscriminator == that.isDiscriminator &&
isNew == that.isNew &&
hasValidation == that.hasValidation &&
isInherited == that.isInherited &&
isXmlAttribute == that.isXmlAttribute &&
@@ -1230,7 +1233,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isFile,
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject,
isArray, isMap, isEnum, isInnerEnum, isEnumRef, isAnyType, isReadOnly, isWriteOnly, isNullable, isShort,
isUnboundedInteger, isSelfReference, isCircularReference, isDiscriminator, _enum,
isUnboundedInteger, isSelfReference, isCircularReference, isDiscriminator, isNew, _enum,
allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars,
vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase,
nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName,

View File

@@ -470,6 +470,35 @@ public class DefaultCodegen implements CodegenConfig {
@Override
@SuppressWarnings("static-method")
public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs) {
for (Map.Entry<String, ModelsMap> entry : objs.entrySet()) {
CodegenModel model = ModelUtils.getModelByName(entry.getKey(), objs);
for (CodegenProperty property : model.allVars){
property.isNew = codegenPropertyIsNew(model, property);
}
for (CodegenProperty property : model.vars){
property.isNew = codegenPropertyIsNew(model, property);
}
for (CodegenProperty property : model.readWriteVars){
property.isNew = codegenPropertyIsNew(model, property);
}
for (CodegenProperty property : model.optionalVars){
property.isNew = codegenPropertyIsNew(model, property);
}
for (CodegenProperty property : model.parentVars){
property.isNew = codegenPropertyIsNew(model, property);
}
for (CodegenProperty property : model.requiredVars){
property.isNew = codegenPropertyIsNew(model, property);
}
for (CodegenProperty property : model.readOnlyVars){
property.isNew = codegenPropertyIsNew(model, property);
}
for (CodegenProperty property : model.nonNullableVars){
property.isNew = codegenPropertyIsNew(model, property);
}
}
if (this.useOneOfInterfaces) {
// First, add newly created oneOf interfaces
for (CodegenModel cm : addOneOfInterfaces) {
@@ -524,6 +553,12 @@ public class DefaultCodegen implements CodegenConfig {
return objs;
}
private boolean codegenPropertyIsNew(CodegenModel model, CodegenProperty property) {
return model.parentModel == null
? false
: model.parentModel.allVars.stream().anyMatch(p -> p.name.equals(property.name) && (p.dataType.equals(property.dataType) == false || p.datatypeWithEnum.equals(property.datatypeWithEnum) == false));
}
/**
* Return a map from model name to Schema for efficient lookup.
*
@@ -2153,6 +2188,21 @@ public class DefaultCodegen implements CodegenConfig {
return " = data." + name + ";";
}
/**
* Return the default value of the property
* <p>
* Return null if you do NOT want a default value.
* Any non-null value will cause {{#defaultValue} check to pass.
*
* @param schema Property schema
* @param codegenProperty Codegen property
* @return string presentation of the default value of the property
*/
public String toDefaultValue(CodegenProperty codegenProperty, Schema schema) {
// use toDefaultValue(schema) if generator has not overriden this method
return toDefaultValue(schema);
}
/**
* returns the OpenAPI type for the property. Use getAlias to handle $ref of primitive type
*
@@ -3751,8 +3801,7 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.debug("Exception from toExampleValue: {}", e.getMessage());
property.example = "ERROR_TO_EXAMPLE_VALUE";
}
property.defaultValue = toDefaultValue(p);
property.defaultValueWithParam = toDefaultValueWithParam(name, p);
property.jsonSchema = Json.pretty(p);
if (p.getDeprecated() != null) {
@@ -3904,6 +3953,10 @@ public class DefaultCodegen implements CodegenConfig {
property.isModel = (ModelUtils.isComposedSchema(referencedSchema) || ModelUtils.isObjectSchema(referencedSchema)) && ModelUtils.isModel(referencedSchema);
}
// set the default value
property.defaultValue = toDefaultValue(property, p);
property.defaultValueWithParam = toDefaultValueWithParam(name, p);
LOGGER.debug("debugging from property return: {}", property);
schemaCodegenPropertyCache.put(ns, property);
return property;
@@ -5031,7 +5084,7 @@ public class DefaultCodegen implements CodegenConfig {
if (parameterModelName != null) {
codegenParameter.dataType = parameterModelName;
if (ModelUtils.isObjectSchema(parameterSchema)) {
if (ModelUtils.isObjectSchema(parameterSchema) || ModelUtils.isComposedSchema(parameterSchema)) {
codegenProperty.complexType = codegenParameter.dataType;
}
} else {
@@ -7201,7 +7254,7 @@ public class DefaultCodegen implements CodegenConfig {
}
}
CodegenMediaType codegenMt = new CodegenMediaType(schemaProp, ceMap, schemaTestCases);
CodegenMediaType codegenMt = new CodegenMediaType(schemaProp, ceMap, schemaTestCases, mt.getExamples());
cmtContent.put(contentType, codegenMt);
if (schemaProp != null) {
if (addSchemaImportsFromV3SpecLocations) {

View File

@@ -28,12 +28,12 @@ public enum GeneratorLanguage {
DART("Dart"), EIFFEL("Eiffel"), ELIXIR("Elixir"), ELM("Elm"),
ERLANG("Erlang"), FLASH("Flash"), F_SHARP("F#"), GO("Go"),
JAVASCRIPT("Javascript"), GRAPH_QL("GraphQL"), GROOVY("Groovy"),
HASKELL("Haskell"), TYPESCRIPT("Typescript"), K_SIX("k6"), KOTLIN("Kotlin"),
HASKELL("Haskell"), HTTP("Jetbrains HTTP Client (HTTP/REST)"), TYPESCRIPT("Typescript"), K_SIX("k6"), KOTLIN("Kotlin"),
KTORM("Ktorm"), LUA("Lua"), MYSQL("Mysql"), NIM("Nim"),
OBJECTIVE_C("Objective-C"), OCAML("OCaml"), PERL("Perl"), PHP("PHP"),
POWERSHELL("PowerShell"), PROTOBUF("Protocol Buffers (Protobuf)"), PYTHON("Python"),
R("R"), RUBY("Ruby"), RUST("Rust"), SCALA("Scala"), SWIFT("Swift"),
WSDL("Web Services Description Language (WSDL)");
WSDL("Web Services Description Language (WSDL)"), JULIA("Julia");
private final String label;

View File

@@ -48,6 +48,21 @@ public class OpenAPINormalizer {
final String REF_AS_PARENT_IN_ALLOF = "REF_AS_PARENT_IN_ALLOF";
boolean enableRefAsParentInAllOf;
// when set to true, only keep the first tag in operation if there are more than one tag defined.
final String KEEP_ONLY_FIRST_TAG_IN_OPERATION = "KEEP_ONLY_FIRST_TAG_IN_OPERATION";
boolean enableKeepOnlyFirstTagInOperation;
// when set to true, complex composed schemas (a mix of oneOf/anyOf/anyOf and properties) with
// oneOf/anyOf containing only `required` and no properties (these are properties inter-dependency rules)
// are removed as most generators cannot handle such case at the moment
final String REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY = "REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY";
boolean removeAnyOfOneOfAndKeepPropertiesOnly;
// when set to true, oneOf/anyOf with either string or enum string as sub schemas will be simplified
// to just string
final String SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING = "SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING";
boolean simplifyAnyOfStringAndEnumString;
// ============= end of rules =============
/**
@@ -79,6 +94,18 @@ public class OpenAPINormalizer {
if (enableAll || "true".equalsIgnoreCase(rules.get(REF_AS_PARENT_IN_ALLOF))) {
enableRefAsParentInAllOf = true;
}
if (enableAll || "true".equalsIgnoreCase(rules.get(KEEP_ONLY_FIRST_TAG_IN_OPERATION))) {
enableKeepOnlyFirstTagInOperation = true;
}
if (enableAll || "true".equalsIgnoreCase(rules.get(REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY))) {
removeAnyOfOneOfAndKeepPropertiesOnly = true;
}
if (enableAll || "true".equalsIgnoreCase(rules.get(SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING))) {
simplifyAnyOfStringAndEnumString = true;
}
}
/**
@@ -127,6 +154,7 @@ public class OpenAPINormalizer {
}
for (Operation operation : operations) {
normalizeOperation(operation);
normalizeRequestBody(operation);
normalizeParameters(operation);
normalizeResponses(operation);
@@ -134,6 +162,15 @@ public class OpenAPINormalizer {
}
}
/**
* Normalizes operation
*
* @param operation Operation
*/
private void normalizeOperation(Operation operation) {
processKeepOnlyFirstTagInOperation(operation);
}
/**
* Normalizes schemas in content
*
@@ -235,7 +272,8 @@ public class OpenAPINormalizer {
if (schema == null) {
LOGGER.warn("{} not fount found in openapi/components/schemas.", schemaName);
} else {
normalizeSchema(schema, new HashSet<>());
Schema result = normalizeSchema(schema, new HashSet<>());
schemas.put(schemaName, result);
}
}
}
@@ -245,19 +283,20 @@ public class OpenAPINormalizer {
*
* @param schema Schema
* @param visitedSchemas a set of visited schemas
* @return Schema
*/
public void normalizeSchema(Schema schema, Set<Schema> visitedSchemas) {
public Schema normalizeSchema(Schema schema, Set<Schema> visitedSchemas) {
if (schema == null) {
return;
return schema;
}
if (StringUtils.isNotEmpty(schema.get$ref())) {
// not need to process $ref
return;
return schema;
}
if ((visitedSchemas.contains(schema))) {
return; // skip due to circular reference
return schema; // skip due to circular reference
} else {
visitedSchemas.add(schema);
}
@@ -267,38 +306,47 @@ public class OpenAPINormalizer {
} else if (schema.getAdditionalProperties() instanceof Schema) { // map
normalizeSchema((Schema) schema.getAdditionalProperties(), visitedSchemas);
} else if (ModelUtils.isComposedSchema(schema)) {
ComposedSchema m = (ComposedSchema) schema;
if (m.getAllOf() != null && !m.getAllOf().isEmpty()) {
normalizeAllOf(m, visitedSchemas);
ComposedSchema cs = (ComposedSchema) schema;
if (ModelUtils.isComplexComposedSchema(cs)) {
cs = (ComposedSchema) normalizeComplexComposedSchema(cs, visitedSchemas);
}
if (m.getOneOf() != null && !m.getOneOf().isEmpty()) {
normalizeOneOf(m, visitedSchemas);
if (cs.getAllOf() != null && !cs.getAllOf().isEmpty()) {
return normalizeAllOf(cs, visitedSchemas);
}
if (m.getAnyOf() != null && !m.getAnyOf().isEmpty()) {
normalizeAnyOf(m, visitedSchemas);
if (cs.getOneOf() != null && !cs.getOneOf().isEmpty()) {
return normalizeOneOf(cs, visitedSchemas);
}
if (m.getProperties() != null && !m.getProperties().isEmpty()) {
normalizeProperties(m.getProperties(), visitedSchemas);
if (cs.getAnyOf() != null && !cs.getAnyOf().isEmpty()) {
return normalizeAnyOf(cs, visitedSchemas);
}
if (m.getAdditionalProperties() != null) {
if (cs.getProperties() != null && !cs.getProperties().isEmpty()) {
normalizeProperties(cs.getProperties(), visitedSchemas);
}
if (cs.getAdditionalProperties() != null) {
// normalizeAdditionalProperties(m);
}
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 Schema) {
normalizeNonComposedSchema(schema, visitedSchemas);
normalizeSchemaWithOnlyProperties(schema, visitedSchemas);
} else {
throw new RuntimeException("Unknown schema type found in normalizer: " + schema);
}
return schema;
}
private void normalizeNonComposedSchema(Schema schema, Set<Schema> visitedSchemas) {
private void normalizeSchemaWithOnlyProperties(Schema schema, Set<Schema> visitedSchemas) {
// normalize non-composed schema (e.g. schema with only properties)
}
@@ -312,7 +360,7 @@ public class OpenAPINormalizer {
}
}
private void normalizeAllOf(Schema schema, Set<Schema> visitedSchemas) {
private Schema normalizeAllOf(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);
@@ -322,34 +370,55 @@ public class OpenAPINormalizer {
}
// process rules here
processUseAllOfRefAsParent(schema);
return schema;
}
private void normalizeOneOf(Schema schema, Set<Schema> visitedSchemas) {
for (Object item : schema.getAllOf()) {
private Schema normalizeOneOf(Schema schema, Set<Schema> visitedSchemas) {
for (Object item : schema.getOneOf()) {
if (!(item instanceof Schema)) {
throw new RuntimeException("Error! allOf schema is not of the type Schema: " + item);
}
// normalize oenOf sub schemas one by one
normalizeSchema((Schema) item, visitedSchemas);
}
// process rules here
return schema;
}
private void normalizeAnyOf(Schema schema, Set<Schema> visitedSchemas) {
for (Object item : schema.getAllOf()) {
private Schema normalizeAnyOf(Schema schema, Set<Schema> visitedSchemas) {
for (Object item : schema.getAnyOf()) {
if (!(item instanceof Schema)) {
throw new RuntimeException("Error! allOf schema is not of the type Schema: " + item);
}
// normalize anyOf sub schemas one by one
normalizeSchema((Schema) item, visitedSchemas);
}
// process rules here
// last rule to process as the schema may become String schema (not "anyOf") after the completion
return processSimplifyAnyOfStringAndEnumString(schema);
}
private Schema normalizeComplexComposedSchema(Schema schema, Set<Schema> visitedSchemas) {
processRemoveAnyOfOneOfAndKeepPropertiesOnly(schema);
return schema;
}
// ===================== a list of rules =====================
// all rules (fuctions) start with the word "process"
/**
* Child schemas in `allOf` is considered a parent if it's a `$ref` (instead of inline schema).
*
* @param schema Schema
*/
private void processUseAllOfRefAsParent(Schema schema) {
if (!enableRefAsParentInAllOf) {
if (!enableRefAsParentInAllOf && !enableAll) {
return;
}
@@ -380,5 +449,84 @@ public class OpenAPINormalizer {
}
}
}
/**
* Keep only first tag in the operation if the operation has more than
* one tag.
*
* @param operation Operation
*/
private void processKeepOnlyFirstTagInOperation(Operation operation) {
if (!enableKeepOnlyFirstTagInOperation) {
return;
}
if (operation.getTags() != null && !operation.getTags().isEmpty() && operation.getTags().size() > 1) {
// has more than 1 tag
String firstTag = operation.getTags().get(0);
operation.setTags(null);
operation.addTagsItem(firstTag);
}
}
/**
* If the schema contains anyOf/oneOf and properties, remove oneOf/anyOf as these serve as rules to
* ensure inter-dependency between properties. It's a workaround as such validation is not supported at the moment.
*
* @param schema Schema
*/
private void processRemoveAnyOfOneOfAndKeepPropertiesOnly(Schema schema) {
if (!removeAnyOfOneOfAndKeepPropertiesOnly && !enableAll) {
return;
}
if (((schema.getOneOf() != null && !schema.getOneOf().isEmpty())
|| (schema.getAnyOf() != null && !schema.getAnyOf().isEmpty())) // has anyOf or oneOf
&& (schema.getProperties() != null && !schema.getProperties().isEmpty()) // has properties
&& schema.getAllOf() == null) { // not allOf
// clear oneOf, anyOf
schema.setOneOf(null);
schema.setAnyOf(null);
}
}
/**
* If the schema is anyOf and the sub-schemas are either string or enum of string,
* then simply it to just string as many generators do not yet support anyOf.
*
* @param schema Schema
* @return Schema
*/
private Schema processSimplifyAnyOfStringAndEnumString(Schema schema) {
if (!simplifyAnyOfStringAndEnumString && !enableAll) {
return schema;
}
Schema 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));
} else {
return schema;
}
s0 = ModelUtils.getReferencedSchema(openAPI, s0);
s1 = ModelUtils.getReferencedSchema(openAPI, s1);
// find the string schema (not enum)
if (s0 instanceof StringSchema && s1 instanceof StringSchema) {
if (((StringSchema) s0).getEnum() != null) { // s0 is enum, s1 is string
return (StringSchema) s1;
} else if (((StringSchema) s1).getEnum() != null) { // s1 is enum, s0 is string
return (StringSchema) s0;
} else { // both are string
return schema;
}
} else {
return schema;
}
}
// ===================== end of rules =====================
}

View File

@@ -121,9 +121,9 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
typeMapping.put("date", "string");
typeMapping.put("DateTime", "time.Time");
typeMapping.put("password", "string");
typeMapping.put("File", "os.File");
typeMapping.put("file", "os.File");
typeMapping.put("binary", "os.File");
typeMapping.put("File", "*os.File");
typeMapping.put("file", "*os.File");
typeMapping.put("binary", "*os.File");
typeMapping.put("ByteArray", "string");
typeMapping.put("null", "nil");
// A 'type: object' OAS schema without any declared property is
@@ -505,13 +505,13 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
boolean addedReflectImport = false;
for (CodegenOperation operation : operations) {
// import "os" if the operation uses files
if (!addedOSImport && "os.File".equals(operation.returnType)) {
if (!addedOSImport && "*os.File".equals(operation.returnType)) {
imports.add(createMapping("import", "os"));
addedOSImport = true;
}
for (CodegenParameter param : operation.allParams) {
// import "os" if the operation uses files
if (!addedOSImport && "os.File".equals(param.dataType)) {
if (!addedOSImport && "*os.File".equals(param.dataType)) {
imports.add(createMapping("import", "os"));
addedOSImport = true;
}
@@ -634,9 +634,6 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
List<CodegenProperty> inheritedProperties = new ArrayList<>();
if (model.getComposedSchemas() != null) {
if (model.getComposedSchemas().getAllOf() != null) {
inheritedProperties.addAll(model.getComposedSchemas().getAllOf());
}
if (model.getComposedSchemas().getAnyOf() != null) {
inheritedProperties.addAll(model.getComposedSchemas().getAnyOf());
}
@@ -646,41 +643,31 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
}
List<CodegenProperty> codegenProperties = new ArrayList<>();
if(model.getIsModel() || model.getComposedSchemas() == null) {
// If the model is a model, use model.vars as it only
// contains properties the generated struct will own itself.
// If model is no model and it has no composed schemas use
// model.vars.
if(model.getComposedSchemas() == null || (model.getComposedSchemas() != null && model.getComposedSchemas().getAllOf() != null)) {
// If the model is an allOf or does not have any composed schemas, then we can use the model's properties.
codegenProperties.addAll(model.vars);
} else {
// If the model is no model, but is a
// allOf, anyOf or oneOf, add all first level options
// from allOf, anyOf or oneOf.
// anyOf or oneOf, add all first level options
// from anyOf or oneOf.
codegenProperties.addAll(inheritedProperties);
}
for (CodegenProperty cp : codegenProperties) {
if (!addedTimeImport && ("time.Time".equals(cp.dataType) ||
(cp.items != null && "time.Time".equals(cp.items.dataType)))) {
if (!addedTimeImport && ("time.Time".equals(cp.dataType) || (cp.items != null && "time.Time".equals(cp.items.dataType)))) {
imports.add(createMapping("import", "time"));
addedTimeImport = true;
}
if (!addedOSImport && ("os.File".equals(cp.dataType) ||
(cp.items != null && "os.File".equals(cp.items.dataType)))) {
if (!addedOSImport && ("*os.File".equals(cp.dataType) ||
(cp.items != null && "*os.File".equals(cp.items.dataType)))) {
imports.add(createMapping("import", "os"));
addedOSImport = true;
}
}
if (this instanceof GoClientCodegen && model.isEnum) {
imports.add(createMapping("import", "fmt"));
}
// if oneOf contains "time.Time" type
if (!addedTimeImport && model.oneOf != null && model.oneOf.contains("time.Time")) {
imports.add(createMapping("import", "time"));
}
// if oneOf contains "null" type
if (model.oneOf != null && !model.oneOf.isEmpty() && model.oneOf.contains("nil")) {
model.isNullable = true;

View File

@@ -85,6 +85,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
public static final String IMPLICIT_HEADERS_REGEX = "implicitHeadersRegex";
public static final String JAVAX_PACKAGE = "javaxPackage";
public static final String USE_JAKARTA_EE = "useJakartaEe";
public static final String CONTAINER_DEFAULT_TO_NULL = "containerDefaultToNull";
public static final String CAMEL_CASE_DOLLAR_SIGN = "camelCaseDollarSign";
@@ -137,9 +138,9 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
protected AnnotationLibrary annotationLibrary;
protected boolean implicitHeaders = false;
protected String implicitHeadersRegex = null;
protected boolean camelCaseDollarSign = false;
protected boolean useJakartaEe = false;
protected boolean containerDefaultToNull = false;
private Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
@@ -276,6 +277,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
cliOptions.add(CliOption.newString(IMPLICIT_HEADERS_REGEX, "Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true"));
cliOptions.add(CliOption.newBoolean(CAMEL_CASE_DOLLAR_SIGN, "Fix camelCase when starting with $ sign. when true : $Value when false : $value"));
cliOptions.add(CliOption.newBoolean(USE_JAKARTA_EE, "whether to use Jakarta EE namespace instead of javax"));
cliOptions.add(CliOption.newBoolean(CONTAINER_DEFAULT_TO_NULL, "Set containers (array, set, map) default to null"));
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC));
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC));
@@ -686,6 +688,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
} else {
applyJavaxPackage();
}
if (additionalProperties.containsKey(CONTAINER_DEFAULT_TO_NULL)) {
this.setContainerDefaultToNull(Boolean.parseBoolean(additionalProperties.get(CONTAINER_DEFAULT_TO_NULL).toString()));
}
additionalProperties.put(CONTAINER_DEFAULT_TO_NULL, containerDefaultToNull);
}
@Override
@@ -966,20 +973,84 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return name;
}
/**
* Return the default value of array property
* <p>
* Return null if there's no default value.
* Any non-null value will cause {{#defaultValue} check to pass.
*
* @param cp Codegen property
* @param schema Property schema
* @return string presentation of the default value of the property
*/
public String toArrayDefaultValue(CodegenProperty cp, Schema schema) {
if (schema.getDefault() != null) { // has default value
if (cp.isArray && !cp.getUniqueItems()) { // array
List<String> _values = new ArrayList<>();
if (schema.getDefault() instanceof ArrayNode) { // array of default values
ArrayNode _default = (ArrayNode) schema.getDefault();
if (_default.isEmpty()) {
return "null";
}
List<String> final_values = _values;
_default.elements().forEachRemaining((element) -> {
final_values.add(element.asText());
});
} else { // single value
_values = java.util.Collections.singletonList(String.valueOf(schema.getDefault()));
}
String defaultValue = "";
if (cp.items.isEnum) { // enum
List<String> defaultValues = new ArrayList<>();
for (String _value : _values) {
defaultValues.add(cp.items.datatypeWithEnum + "." + toEnumVarName(_value, cp.items.dataType));
}
defaultValue = StringUtils.join(defaultValues, ", ");
} else {
if (cp.items.isString) { // array item is string
defaultValue = String.format(Locale.ROOT, "\"%s\"", StringUtils.join(_values, "\", \""));
} else { // array item is non-string, e.g. integer
defaultValue = StringUtils.join(_values, ", ");
}
}
return String.format(Locale.ROOT, "new ArrayList<>(Arrays.asList(%s))", defaultValue);
} else if (cp.isArray && cp.getUniqueItems()) { // set
// TODO
return null;
} else if (cp.isMap) { // map
// TODO
return null;
} else {
throw new RuntimeException("Error. Codegen Property must be array/set/map: " + cp);
}
} else {
return null;
}
}
@Override
public String toDefaultValue(Schema schema) {
public String toDefaultValue(CodegenProperty cp, Schema schema) {
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
if (ModelUtils.isArraySchema(schema)) {
final String pattern;
if (ModelUtils.isSet(schema)) {
String mapInstantiationType = instantiationTypes().getOrDefault("set", "LinkedHashSet");
pattern = "new " + mapInstantiationType + "<%s>()";
} else {
String arrInstantiationType = instantiationTypes().getOrDefault("array", "ArrayList");
pattern = "new " + arrInstantiationType + "<%s>()";
if (schema.getDefault() == null) {
if (cp.isNullable || containerDefaultToNull) { // nullable or containerDefaultToNull set to true
return "null";
} else {
if (ModelUtils.isSet(schema)) {
return String.format(Locale.ROOT, "new %s<>()",
instantiationTypes().getOrDefault("set", "LinkedHashSet"));
} else {
return String.format(Locale.ROOT, "new %s<>()",
instantiationTypes().getOrDefault("array", "ArrayList"));
}
}
} else { // has default value
return toArrayDefaultValue(cp, schema);
}
return String.format(Locale.ROOT, pattern, "");
} else if (ModelUtils.isMapSchema(schema) && !(schema instanceof ComposedSchema)) {
if (schema.getProperties() != null && schema.getProperties().size() > 0) {
// object is complex object with free-form additional properties
@@ -989,14 +1060,16 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return null;
}
String mapInstantiationType = instantiationTypes().getOrDefault("map", "HashMap");
final String pattern = "new " + mapInstantiationType + "<%s>()";
if (cp.isNullable || containerDefaultToNull) { // nullable or containerDefaultToNull set to true
return "null";
}
if (getAdditionalProperties(schema) == null) {
return null;
}
return String.format(Locale.ROOT, pattern, "");
return String.format(Locale.ROOT, "new %s<>()",
instantiationTypes().getOrDefault("map", "HashMap"));
} else if (ModelUtils.isIntegerSchema(schema)) {
if (schema.getDefault() != null) {
if (SchemaTypeUtil.INTEGER64_FORMAT.equals(schema.getFormat())) {
@@ -1345,6 +1418,9 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
codegenModel.imports.add("JsonTypeInfo");
codegenModel.imports.add("JsonIgnoreProperties");
}
if (codegenModel.getIsClassnameSanitized() && additionalProperties.containsKey(JACKSON) && !codegenModel.isEnum) {
codegenModel.imports.add("JsonTypeName");
}
if (allDefinitions != null && codegenModel.parentSchema != null && codegenModel.hasEnums) {
final Schema parentModel = allDefinitions.get(codegenModel.parentSchema);
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
@@ -1370,10 +1446,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
@Override
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
if (model.getIsClassnameSanitized() && additionalProperties.containsKey(JACKSON)) {
model.imports.add("JsonTypeName");
}
if (serializeBigDecimalAsString) {
if ("decimal".equals(property.baseType) || "bigdecimal".equalsIgnoreCase(property.baseType)) {
// we serialize BigDecimal as `string` to avoid precision loss
@@ -1964,6 +2036,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
this.useJakartaEe = useJakartaEe;
}
public void setContainerDefaultToNull(boolean containerDefaultToNull) {
this.containerDefaultToNull = containerDefaultToNull;
}
@Override
public String escapeQuotationMark(String input) {
// remove " to avoid code injection

View File

@@ -0,0 +1,527 @@
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen.languages;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.ClientModificationFeature;
import org.openapitools.codegen.meta.features.ClientModificationFeature;
import org.openapitools.codegen.meta.features.DocumentationFeature;
import org.openapitools.codegen.meta.features.GlobalFeature;
import org.openapitools.codegen.meta.features.ParameterFeature;
import org.openapitools.codegen.meta.features.SchemaSupportFeature;
import org.openapitools.codegen.meta.features.SecurityFeature;
import org.openapitools.codegen.meta.features.WireFormatFeature;
import java.io.File;
import java.util.*;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.servers.Server;
import org.apache.commons.lang3.StringUtils;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import org.openapitools.codegen.utils.CamelizeOption;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.CaseFormat;
import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache.Lambda;
import org.openapitools.codegen.templating.mustache.EscapeChar;
public abstract class AbstractJuliaCodegen extends DefaultCodegen {
protected final Logger LOGGER = LoggerFactory.getLogger(AbstractJuliaCodegen.class);
protected String srcPath = "src";
protected String apiSrcPath = srcPath + "/apis/";
protected String modelSrcPath = srcPath + "/models/";
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
protected String packageName;
protected Boolean exportModels;
protected Boolean exportOperations;
public AbstractJuliaCodegen() {
super();
modifyFeatureSet(features -> features
.includeDocumentationFeatures(DocumentationFeature.Readme)
.includeSchemaSupportFeatures(
SchemaSupportFeature.Union, SchemaSupportFeature.allOf,
SchemaSupportFeature.anyOf, SchemaSupportFeature.oneOf
)
.excludeWireFormatFeatures(
WireFormatFeature.XML
)
.excludeSecurityFeatures(
SecurityFeature.OAuth2_Implicit, SecurityFeature.OAuth2_Password,
SecurityFeature.OAuth2_ClientCredentials, SecurityFeature.OAuth2_AuthorizationCode
)
.excludeParameterFeatures(
ParameterFeature.Cookie
)
.excludeGlobalFeatures(
GlobalFeature.Callbacks, GlobalFeature.Examples,
GlobalFeature.Produces, GlobalFeature.Consumes
)
.includeClientModificationFeatures(
ClientModificationFeature.BasePath, ClientModificationFeature.UserAgent
)
);
reservedWords = new HashSet<String>(
Arrays.asList(
"if", "else", "elseif", "while", "for", "begin", "end", "quote",
"try", "catch", "return", "local", "function", "macro", "ccall", "finally", "break", "continue",
"global", "module", "using", "import", "export", "const", "let", "do", "baremodule",
"Type", "Enum", "Any", "DataType", "Base"
)
);
// Language Specific Primitives. These types will not trigger imports by the client generator
languageSpecificPrimitives = new HashSet<String>(
Arrays.asList("Integer", "Int128", "Int64", "Int32", "Int16", "Int8", "UInt128", "UInt64", "UInt32", "UInt16", "UInt8", "Float64", "Float32", "Float16", "Char", "Vector", "Dict", "Vector{UInt8}", "Bool", "String", "Date", "DateTime", "ZonedDateTime", "Nothing", "Any")
);
typeMapping.clear();
typeMapping.put("int", "Int64");
typeMapping.put("integer", "Int64");
typeMapping.put("long", "Int64");
typeMapping.put("short", "Int32");
typeMapping.put("byte", "UInt8");
typeMapping.put("float", "Float32");
typeMapping.put("double", "Float64");
typeMapping.put("string", "String");
typeMapping.put("char", "String");
typeMapping.put("binary", "Vector{UInt8}");
typeMapping.put("boolean", "Bool");
typeMapping.put("number", "Float64");
typeMapping.put("decimal", "Float64");
typeMapping.put("array", "Vector");
typeMapping.put("set", "Vector");
typeMapping.put("map", "Dict");
typeMapping.put("date", "Date");
typeMapping.put("DateTime", "ZonedDateTime");
typeMapping.put("File", "String");
typeMapping.put("file", "String");
typeMapping.put("UUID", "String");
typeMapping.put("URI", "String");
typeMapping.put("ByteArray", "Vector{UInt8}");
typeMapping.put("object", "Any");
typeMapping.put("Object", "Any");
typeMapping.put("AnyType", "Any");
}
@Override
public GeneratorLanguage generatorLanguage() {
return GeneratorLanguage.JULIA;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public void setExportModels(Boolean exportModels) {
this.exportModels = exportModels;
}
public void setExportOperations(Boolean exportOperations) {
this.exportOperations = exportOperations;
}
protected static String dropDots(String str) {
return str.replaceAll("\\.", "_");
}
/**
* Escapes a reserved word as defined in the `reservedWords` array. Handle escaping
* those terms here. This logic is only called if a variable matches the reseved words
*
* @return the escaped term
*/
@Override
public String escapeReservedWord(String name) {
if (reservedWords.contains(name)) {
return "__" + name + "__"; // add underscores to reserved words, and also to obscure it to lessen chances of clashing with any other names
} else {
return name;
}
}
/**
* Location to write model files.
*/
@Override
public String modelFileFolder() {
return (outputFolder + "/" + modelSrcPath).replace('/', File.separatorChar);
}
/**
* Location to write api files.
*/
@Override
public String apiFileFolder() {
return (outputFolder + "/" + apiSrcPath).replace('/', File.separatorChar);
}
@Override
public String apiDocFileFolder() {
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
}
@Override
public String modelDocFileFolder() {
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
}
@Override
public String toModelFilename(String name) {
return "model_" + toModelName(name);
}
@Override
public String toApiFilename(String name) {
name = name.replaceAll("-", "_");
return "api_" + camelize(name) + "Api";
}
@Override
public String toApiName(String name) {
if (name.length() == 0) {
return "DefaultApi";
}
// e.g. phone_number_api => PhoneNumberApi
return camelize(name) + "Api";
}
@Override
public String toParamName(String name) {
CamelizeOption camelizeOption = CamelizeOption.UPPERCASE_FIRST_CHAR;
name = camelize(sanitizeName(name), camelizeOption);
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
return escapeReservedWord(name);
}
@Override
public String toApiVarName(String name) {
CamelizeOption camelizeOption = CamelizeOption.UPPERCASE_FIRST_CHAR;
name = camelize(sanitizeName(name), camelizeOption);
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
return escapeReservedWord(name);
}
@Override
public String toVarName(String name) {
return name;
}
/**
* Sanitize name (parameter, property, method, etc)
*
* @param name string to be sanitize
* @return sanitized string
*/
@Override
@SuppressWarnings("static-method")
public String sanitizeName(String name) {
if (name == null) {
LOGGER.error("String to be sanitized is null. Default to ERROR_UNKNOWN");
return "ERROR_UNKNOWN";
}
// if the name is just '$', map it to 'value', as that's sometimes used in the spec
if ("$".equals(name)) {
return "value";
}
name = name.replaceAll("\\[\\]", "");
name = name.replaceAll("\\[", "_");
name = name.replaceAll("\\]", "");
name = name.replaceAll("\\(", "_");
name = name.replaceAll("\\)", "");
name = name.replaceAll("\\.", "_");
name = name.replaceAll("-", "_");
name = name.replaceAll(" ", "_");
name = name.replaceAll("/", "_");
return name.replaceAll("[^a-zA-Z0-9_{}]", "");
}
protected boolean needsVarEscape(String name) {
return (!name.matches("[a-zA-Z0-9_]*") && !name.matches("var\".*\"")) || reservedWords.contains(name);
}
/**
* Output the proper Julia model name.
*
* @param name the name of the model
* @return Julia model name
*/
@Override
public String toModelName(final String name) {
String result = sanitizeName(name);
// remove dollar sign
result = result.replaceAll("$", "");
// model name cannot use reserved keyword, e.g. return
if (isReservedWord(result)) {
LOGGER.warn(result + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + result));
result = "model_" + result; // e.g. return => ModelReturn (after camelize)
}
// model name starts with number
if (result.matches("^\\d.*")) {
LOGGER.warn(result + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + result));
result = "model_" + result; // e.g. 200Response => Model200Response (after camelize)
}
if (!StringUtils.isEmpty(modelNamePrefix)) {
result = modelNamePrefix + "_" + result;
}
if (!StringUtils.isEmpty(modelNameSuffix)) {
result = result + "_" + modelNameSuffix;
}
result = dropDots(result);
// camelize the model name
// phone_number => PhoneNumber
result = camelize(result);
return result;
}
@Override
public String getTypeDeclaration(Schema schema) {
if (ModelUtils.isArraySchema(schema)) {
ArraySchema ap = (ArraySchema) schema;
Schema inner = ap.getItems();
return getSchemaType(schema) + "{" + getTypeDeclaration(inner) + "}";
} else if (ModelUtils.isSet(schema)) {
Schema inner = getAdditionalProperties(schema);
return getSchemaType(schema) + "{" + getTypeDeclaration(inner) + "}";
} else if (ModelUtils.isMapSchema(schema)) {
Schema inner = getAdditionalProperties(schema);
return getSchemaType(schema) + "{String, " + getTypeDeclaration(inner) + "}";
}
return super.getTypeDeclaration(schema);
}
/**
* Return the type declaration for a given schema
*
* @param schema the schema
* @return the type declaration
*/
@Override
public String getSchemaType(Schema schema) {
String openAPIType = super.getSchemaType(schema);
String type = null;
if (openAPIType == null) {
LOGGER.error("OpenAPI Type for {} is null. Default to Object instead.", schema.getName());
openAPIType = "Object";
}
if (typeMapping.containsKey(openAPIType)) {
type = typeMapping.get(openAPIType);
if (languageSpecificPrimitives.contains(type)) {
return type;
}
} else {
type = openAPIType;
}
return toModelName(type);
}
/**
* Return the default value of the property
*
* @param schema OpenAPI property object
* @return string presentation of the default value of the property
*/
@Override
public String toDefaultValue(Schema schema) {
if (ModelUtils.isBooleanSchema(schema)) {
if (schema.getDefault() != null) {
return schema.getDefault().toString();
}
} else if (ModelUtils.isDateSchema(schema)) {
// TODO
} else if (ModelUtils.isDateTimeSchema(schema)) {
// TODO
} else if (ModelUtils.isIntegerSchema(schema) || ModelUtils.isLongSchema(schema) || ModelUtils.isNumberSchema(schema)) {
if (schema.getDefault() != null) {
return schema.getDefault().toString();
}
} else if (ModelUtils.isStringSchema(schema)) {
if (schema.getDefault() != null) {
String _default = (String) schema.getDefault();
if (schema.getEnum() == null) {
return "\"" + _default + "\"";
} else {
// convert to enum var name later in postProcessModels
return _default;
}
}
}
return "nothing";
}
@Override
public String escapeUnsafeCharacters(String input) {
return input.replace("#=", "#_=").replace("=#", "=_#");
}
/**
* Escape single and/or double quote to avoid code injection
*
* @param input String to be cleaned up
* @return string with quotation mark removed or escaped
*/
public String escapeQuotationMark(String input) {
return input.replace("\"", "\\\"");
}
protected String escapeRegex(String pattern) {
pattern = pattern.replaceAll("\\\\\\\\", "\\\\");
pattern = pattern.replaceAll("^/", "");
pattern = pattern.replaceAll("/$", "");
return pattern;
}
/**
* Convert OpenAPI Parameter object to Codegen Parameter object
*
* @param imports set of imports for library/package/module
* @param param OpenAPI parameter object
* @return Codegen Parameter object
*/
@Override
public CodegenParameter fromParameter(Parameter param, Set<String> imports) {
CodegenParameter parameter = super.fromParameter(param, imports);
if (parameter.pattern != null) {
parameter.pattern = escapeRegex(parameter.pattern);
}
return parameter;
}
/**
* Convert OAS Property schema to Codegen Property object.
* <p>
* The return value is cached. An internal cache is looked up to determine
* if the CodegenProperty return value has already been instantiated for
* the (String name, Schema schema) arguments.
* Any subsequent processing of the CodegenModel return value must be idempotent
* for a given (String name, Schema schema).
*
* @param name name of the property
* @param schema OAS property schema
* @param required true if the property is required in the next higher object schema, false otherwise
* @return Codegen Property object
*/
@Override
public CodegenProperty fromProperty(String name, Schema schema, boolean required) {
CodegenProperty property = super.fromProperty(name, schema, required);
// if the name needs any escaping, we set it to var"name"
if (needsVarEscape(property.name)) {
property.name = "var\"" + property.name + "\"";
}
if (property.pattern != null) {
property.pattern = escapeRegex(property.pattern);
}
return property;
}
/**
* Return the operation ID (method name)
*
* @param operationId operation ID
* @return the sanitized method name
*/
@SuppressWarnings("static-method")
public String toOperationId(String operationId) {
CamelizeOption camelizeOption = CamelizeOption.UPPERCASE_FIRST_CHAR;
operationId = camelize(super.toOperationId(operationId), camelizeOption);
operationId = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, operationId);
return sanitizeName(operationId);
}
private void changeParamNames(List<CodegenParameter> paramsList, HashSet<String> reservedNames) {
// check if any param name clashes with type name and rename it
for (CodegenParameter param : paramsList) {
if (reservedNames.contains(param.paramName)) {
do {
param.paramName = param.paramName + "_";
} while (reservedNames.contains(param.paramName + "param"));
param.paramName = param.paramName + "param";
}
}
}
/**
* Convert OAS Operation object to Codegen Operation object
*
* @param httpMethod HTTP method
* @param operation OAS operation object
* @param path the path of the operation
* @param servers list of servers
* @return Codegen Operation object
*/
@Override
public CodegenOperation fromOperation(String path,
String httpMethod,
Operation operation,
List<Server> servers) {
CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers);
// collect all reserved names
HashSet<String> reservedNames = new HashSet<String>();
reservedNames.add(op.returnType);
reservedNames.add(op.operationId);
for (CodegenParameter param : op.allParams) {
reservedNames.add(param.dataType);
}
changeParamNames(op.allParams, reservedNames);
changeParamNames(op.bodyParams, reservedNames);
changeParamNames(op.headerParams, reservedNames);
changeParamNames(op.pathParams, reservedNames);
changeParamNames(op.queryParams, reservedNames);
changeParamNames(op.formParams, reservedNames);
return op;
}
@Override
protected ImmutableMap.Builder<String, Lambda> addMustacheLambdas() {
return super.addMustacheLambdas()
.put("escapeDollar", new EscapeChar("(?<!\\\\)\\$", "\\\\\\$"));
}
}

View File

@@ -52,6 +52,9 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
public static final String MODEL_MUTABLE_DESC = "Create mutable models";
public static final String ADDITIONAL_MODEL_TYPE_ANNOTATIONS = "additionalModelTypeAnnotations";
public static final String JAVAX_PACKAGE = "javaxPackage";
public static final String USE_JAKARTA_EE = "useJakartaEe";
private final Logger LOGGER = LoggerFactory.getLogger(AbstractKotlinCodegen.class);
protected String artifactId;
@@ -69,6 +72,8 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
protected boolean parcelizeModels = false;
protected boolean serializableModel = false;
protected boolean useJakartaEe = false;
protected boolean nonPublicApi = false;
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase;
@@ -544,6 +549,17 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
typeMapping.put("set", "kotlin.collections.MutableSet");
typeMapping.put("map", "kotlin.collections.MutableMap");
}
if (additionalProperties.containsKey(USE_JAKARTA_EE)) {
setUseJakartaEe(Boolean.TRUE.equals(additionalProperties.get(USE_JAKARTA_EE)));
}
additionalProperties.put(USE_JAKARTA_EE, useJakartaEe);
if (useJakartaEe) {
applyJakartaPackage();
} else {
applyJavaxPackage();
}
}
protected boolean isModelMutable() {
@@ -594,6 +610,10 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
this.serializableModel = serializableModel;
}
public void setUseJakartaEe(boolean useJakartaEe) {
this.useJakartaEe = useJakartaEe;
}
public boolean nonPublicApi() {
return nonPublicApi;
}
@@ -842,6 +862,14 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
return input.substring(0, 1).toUpperCase(Locale.ROOT) + input.substring(1);
}
protected void applyJavaxPackage() {
writePropertyBack(JAVAX_PACKAGE, "javax");
}
protected void applyJakartaPackage() {
writePropertyBack(JAVAX_PACKAGE, "jakarta");
}
@Override
protected boolean isReservedWord(String word) {
// We want case-sensitive escaping, to avoid unnecessary backtick-escaping.

View File

@@ -31,6 +31,8 @@ import static org.openapitools.codegen.utils.StringUtils.*;
public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenConfig {
public static final String OPTIONAL_PROJECT_FILE_DESC = "Generate client.pri.";
public static final String DEFAULT_PACKAGE_NAME = "QtOpenAPIClient";
protected String packageName = "";
// source folder where to write the files
protected String sourceFolder = "client";
protected boolean optionalProjectFileFlag = true;
@@ -89,7 +91,10 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
*/
embeddedTemplateDir = templateDir = "cpp-qt-client";
// CLI options
addOption(CodegenConstants.PACKAGE_NAME, "C++ package (library) name.", DEFAULT_PACKAGE_NAME);
addSwitch(CodegenConstants.OPTIONAL_PROJECT_FILE, OPTIONAL_PROJECT_FILE_DESC, this.optionalProjectFileFlag);
supportingFiles.add(new SupportingFile("helpers-header.mustache", sourceFolder, PREFIX + "Helpers.h"));
supportingFiles.add(new SupportingFile("helpers-body.mustache", sourceFolder, PREFIX + "Helpers.cpp"));
supportingFiles.add(new SupportingFile("HttpRequest.h.mustache", sourceFolder, PREFIX + "HttpRequest.h"));
@@ -103,6 +108,7 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
supportingFiles.add(new SupportingFile("oauth.cpp.mustache", sourceFolder, PREFIX + "Oauth.cpp"));
supportingFiles.add(new SupportingFile("oauth.h.mustache", sourceFolder, PREFIX + "Oauth.h"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("CMakeConfig.mustache", sourceFolder, "Config.cmake.in"));
supportingFiles.add(new SupportingFile("CMakeLists.txt.mustache", sourceFolder, "CMakeLists.txt"));
if (optionalProjectFileFlag) {
supportingFiles.add(new SupportingFile("Project.mustache", sourceFolder, "client.pri"));
@@ -117,12 +123,16 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
public void processOpts() {
super.processOpts();
packageName = (String) additionalProperties.getOrDefault(CodegenConstants.PACKAGE_NAME, DEFAULT_PACKAGE_NAME);
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_FILE)) {
setOptionalProjectFileFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_PROJECT_FILE));
} else {
additionalProperties.put(CodegenConstants.OPTIONAL_PROJECT_FILE, optionalProjectFileFlag);
}
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
if (additionalProperties.containsKey("modelNamePrefix")) {
supportingFiles.clear();
supportingFiles.add(new SupportingFile("helpers-header.mustache", sourceFolder, modelNamePrefix + "Helpers.h"));
@@ -138,6 +148,7 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
supportingFiles.add(new SupportingFile("oauth.cpp.mustache", sourceFolder, modelNamePrefix + "Oauth.cpp"));
supportingFiles.add(new SupportingFile("oauth.h.mustache", sourceFolder, modelNamePrefix + "Oauth.h"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("CMakeConfig.mustache", sourceFolder, "Config.cmake.in"));
supportingFiles.add(new SupportingFile("CMakeLists.txt.mustache", sourceFolder, "CMakeLists.txt"));

View File

@@ -63,6 +63,7 @@ public class CrystalClientCodegen extends DefaultCodegen {
protected String shardAuthorEmail = "";
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
protected List<String> primitiveTypes = new ArrayList<String>();
public static final String SHARD_NAME = "shardName";
public static final String MODULE_NAME = "moduleName";
@@ -184,6 +185,7 @@ public class CrystalClientCodegen extends DefaultCodegen {
instantiationTypes.put("map", "Hash");
instantiationTypes.put("array", "Array");
instantiationTypes.put("set", "Set");
primitiveTypes = new ArrayList<String>(typeMapping.values());
// remove modelPackage and apiPackage added by default
cliOptions.removeIf(opt -> CodegenConstants.MODEL_PACKAGE.equals(opt.getOpt()) ||
@@ -355,6 +357,15 @@ public class CrystalClientCodegen extends DefaultCodegen {
return toModelName(type);
}
@Override
public String toModelImport(String name) {
if (primitiveTypes.contains(name)) {
return null;
} else {
return toModelFilename(name);
}
}
@Override
public String toModelName(final String name) {
String modelName;

View File

@@ -88,6 +88,9 @@ public class ElixirClientCodegen extends DefaultCodegen {
.includeClientModificationFeatures(
ClientModificationFeature.BasePath
)
.includeDataTypeFeatures(
DataTypeFeature.AnyType
)
);
// set the output folder here
@@ -188,10 +191,12 @@ public class ElixirClientCodegen extends DefaultCodegen {
"List",
"Atom",
"Map",
"AnyType",
"Tuple",
"PID",
"DateTime",
"map()" // This is a workaround, since the DefaultCodeGen uses our elixir TypeSpec datetype to evaluate the primitive
"map()", // This is a workaround, since the DefaultCodeGen uses our elixir TypeSpec datetype to evaluate the primitive
"any()"
)
);
@@ -575,6 +580,8 @@ public class ElixirClientCodegen extends DefaultCodegen {
return "String.t";
} else if (ModelUtils.isStringSchema(p)) {
return "String.t";
} else if (p.getType() == null) {
return "any()";
}
return super.getTypeDeclaration(p);
}
@@ -785,8 +792,13 @@ public class ElixirClientCodegen extends DefaultCodegen {
returnEntry.append(moduleName);
returnEntry.append(".Model.");
}
returnEntry.append(exResponse.baseType);
returnEntry.append(".t");
if (exResponse.baseType.equals("AnyType")) {
returnEntry.append("any()");
}else {
returnEntry.append(exResponse.baseType);
returnEntry.append(".t");
}
} else {
if (exResponse.containerType.equals("array") ||
exResponse.containerType.equals("set")) {
@@ -795,8 +807,13 @@ public class ElixirClientCodegen extends DefaultCodegen {
returnEntry.append(moduleName);
returnEntry.append(".Model.");
}
returnEntry.append(exResponse.baseType);
returnEntry.append(".t)");
if (exResponse.baseType.equals("AnyType")) {
returnEntry.append("any())");
}else {
returnEntry.append(exResponse.baseType);
returnEntry.append(".t)");
}
} else if (exResponse.containerType.equals("map")) {
returnEntry.append("map()");
}

View File

@@ -50,10 +50,12 @@ public class GoClientCodegen extends AbstractGoCodegen {
protected String packageVersion = "1.0.0";
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
protected String modelFileFolder = null;
public static final String WITH_XML = "withXml";
public static final String STRUCT_PREFIX = "structPrefix";
public static final String WITH_AWSV4_SIGNATURE = "withAWSV4Signature";
public static final String GENERATE_INTERFACES = "generateInterfaces";
public static final String MODEL_FILE_FOLDER = "modelFileFolder";
protected String goImportAlias = "openapiclient";
protected boolean isGoSubmodule = false;
protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
@@ -255,6 +257,10 @@ public class GoClientCodegen extends AbstractGoCodegen {
.get(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT).toString()));
}
if (additionalProperties.containsKey(MODEL_FILE_FOLDER)) {
modelFileFolder = additionalProperties.get(MODEL_FILE_FOLDER).toString();
}
// add lambda for mustache templates to handle oneOf/anyOf naming
// e.g. []string => ArrayOfString
additionalProperties.put("lambda.type-to-name", (Mustache.Lambda) (fragment, writer) -> writer.write(typeToName(fragment.execute())));
@@ -301,9 +307,17 @@ public class GoClientCodegen extends AbstractGoCodegen {
return outputFolder + File.separator;
}
/**
* Location of created model files (it can be overriden using --additional-properties in openapi-generator-cli
*/
@Override
public String modelFileFolder() {
return outputFolder + File.separator;
String modelFileFolderPath = outputFolder + File.separator;
if(modelFileFolder != null) {
modelFileFolderPath = modelFileFolderPath + modelFileFolder + File.separator;
}
return modelFileFolderPath.replace("/", File.separator);
}
@Override

View File

@@ -305,7 +305,7 @@ public class GoServerCodegen extends AbstractGoCodegen {
for (CodegenOperation operation : operations) {
for (CodegenParameter param : operation.allParams) {
// import "os" if the operation uses files
if (!addedOSImport && ("os.File".equals(param.dataType) || ("[]os.File".equals(param.dataType)))) {
if (!addedOSImport && ("*os.File".equals(param.dataType) || ("[]*os.File".equals(param.dataType)))) {
imports.add(createMapping("import", "os"));
addedOSImport = true;
}

View File

@@ -43,6 +43,8 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
*/
protected static final String JAXRS_TEMPLATE_DIRECTORY_NAME = "JavaJaxRS";
public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles";
protected boolean useBeanValidation = false;
protected boolean useGenericResponse = false;
@@ -53,6 +55,8 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
private boolean useJackson = false;
protected boolean useAbstractionForFiles = false;
public JavaCXFClientCodegen() {
super();
@@ -90,6 +94,7 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE_FOR_TESTS, "Use Gzip Feature for tests"));
cliOptions.add(CliOption.newBoolean(USE_LOGGING_FEATURE_FOR_TESTS, "Use Logging Feature for tests"));
cliOptions.add(CliOption.newBoolean(USE_GENERIC_RESPONSE, "Use generic response"));
cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk."));
}
@Override
@@ -116,6 +121,10 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
useJackson = convertPropertyToBooleanAndWriteBack(JACKSON);
}
if (additionalProperties.containsKey(USE_ABSTRACTION_FOR_FILES)) {
this.setUseAbstractionForFiles(convertPropertyToBooleanAndWriteBack(USE_ABSTRACTION_FOR_FILES));
}
supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")
@@ -218,4 +227,8 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
public boolean isUseJackson() {
return useJackson;
}
public void setUseAbstractionForFiles(boolean useAbstractionForFiles) {
this.useAbstractionForFiles = useAbstractionForFiles;
}
}

View File

@@ -36,6 +36,8 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
implements CXFServerFeatures, GzipTestFeatures, LoggingTestFeatures, UseGenericResponseFeatures {
private final Logger LOGGER = LoggerFactory.getLogger(JavaCXFServerCodegen.class);
public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles";
protected boolean addConsumesProducesJson = true;
protected boolean generateSpringApplication = false;
@@ -70,6 +72,8 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
protected boolean useGenericResponse = false;
protected boolean useAbstractionForFiles = false;
public JavaCXFServerCodegen() {
super();
@@ -126,6 +130,7 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
cliOptions.add(CliOption.newBoolean(GENERATE_NON_SPRING_APPLICATION, "Generate non-Spring application"));
cliOptions.add(CliOption.newBoolean(USE_GENERIC_RESPONSE, "Use generic response"));
cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk."));
}
@@ -184,6 +189,10 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
this.setGenerateNonSpringApplication(generateNonSpringApplication);
}
if (additionalProperties.containsKey(USE_ABSTRACTION_FOR_FILES)) {
this.setUseAbstractionForFiles(convertPropertyToBooleanAndWriteBack(USE_ABSTRACTION_FOR_FILES));
}
supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen
supportingFiles.add(new SupportingFile("server/pom.mustache", "", "pom.xml")
@@ -332,6 +341,10 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
this.useGenericResponse = useGenericResponse;
}
public void setUseAbstractionForFiles(boolean useAbstractionForFiles) {
this.useAbstractionForFiles = useAbstractionForFiles;
}
@Override
protected void updateModelForObject(CodegenModel m, Schema schema) {
/**

View File

@@ -68,6 +68,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles";
public static final String DYNAMIC_OPERATIONS = "dynamicOperations";
public static final String SUPPORT_STREAMING = "supportStreaming";
public static final String SUPPORT_URL_QUERY = "supportUrlQuery";
public static final String GRADLE_PROPERTIES = "gradleProperties";
public static final String ERROR_OBJECT_TYPE = "errorObjectType";
@@ -119,6 +120,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
protected boolean useAbstractionForFiles = false;
protected boolean dynamicOperations = false;
protected boolean supportStreaming = false;
protected boolean withAWSV4Signature = false;
protected String gradleProperties;
protected String errorObjectType;
protected String authFolder;
@@ -192,7 +194,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations"));
cliOptions.add(CliOption.newBoolean(PERFORM_BEANVALIDATION, "Perform BeanValidation"));
cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE, "Send gzip-encoded requests"));
cliOptions.add(CliOption.newBoolean(USE_RUNTIME_EXCEPTION, "Use RuntimeException instead of Exception"));
cliOptions.add(CliOption.newBoolean(USE_RUNTIME_EXCEPTION, "Use RuntimeException instead of Exception. Only jersey, jersey2, jersey3, okhttp-gson, vertx, microprofile support this option."));
cliOptions.add(CliOption.newBoolean(ASYNC_NATIVE, "If true, async handlers will be used, instead of the sync version"));
cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact."));
cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries"));
@@ -200,6 +202,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries"));
cliOptions.add(CliOption.newBoolean(DYNAMIC_OPERATIONS, "Generate operations dynamically at runtime from an OAS", this.dynamicOperations));
cliOptions.add(CliOption.newBoolean(SUPPORT_STREAMING, "Support streaming endpoint (beta)", this.supportStreaming));
cliOptions.add(CliOption.newBoolean(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT, CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT_DESC + " (only available for okhttp-gson library)", this.withAWSV4Signature));
cliOptions.add(CliOption.newString(GRADLE_PROPERTIES, "Append additional Gradle properties to the gradle.properties file"));
cliOptions.add(CliOption.newString(ERROR_OBJECT_TYPE, "Error Object type. (This option is for okhttp-gson-next-gen only)"));
cliOptions.add(CliOption.newString(CONFIG_KEY, "Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option."));
@@ -407,6 +410,11 @@ public class JavaClientCodegen extends AbstractJavaCodegen
}
additionalProperties.put(SUPPORT_STREAMING, supportStreaming);
if (additionalProperties.containsKey(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT)) {
this.setWithAWSV4Signature(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT).toString()));
}
additionalProperties.put(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT, withAWSV4Signature);
if (additionalProperties.containsKey(GRADLE_PROPERTIES)) {
this.setGradleProperties(additionalProperties.get(GRADLE_PROPERTIES).toString());
}
@@ -420,6 +428,16 @@ public class JavaClientCodegen extends AbstractJavaCodegen
this.webclientBlockingOperations = Boolean.parseBoolean(additionalProperties.get(WEBCLIENT_BLOCKING_OPERATIONS).toString());
}
// add URL query deepObject support to native, apache-httpclient by default
if (!additionalProperties.containsKey(SUPPORT_URL_QUERY)) {
if (isLibrary(NATIVE) || isLibrary(APACHE)) {
// default to true for native and apache-httpclient
additionalProperties.put(SUPPORT_URL_QUERY, true);
}
} else {
additionalProperties.put(SUPPORT_URL_QUERY, Boolean.parseBoolean(additionalProperties.get(SUPPORT_URL_QUERY).toString()));
}
final String invokerFolder = (sourceFolder + '/' + invokerPackage).replace(".", "/");
final String apiFolder = (sourceFolder + '/' + apiPackage).replace(".", "/");
final String modelsFolder = (sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar);
@@ -459,6 +477,9 @@ public class JavaClientCodegen extends AbstractJavaCodegen
supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.mustache", authFolder, "HttpBasicAuth.java"));
supportingFiles.add(new SupportingFile("auth/HttpBearerAuth.mustache", authFolder, "HttpBearerAuth.java"));
supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java"));
if (OKHTTP_GSON.equals(getLibrary()) && withAWSV4Signature) {
supportingFiles.add(new SupportingFile("auth/AWS4Auth.mustache", authFolder, "AWS4Auth.java"));
}
}
supportingFiles.add(new SupportingFile("gradlew.mustache", "", "gradlew"));
@@ -1146,6 +1167,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
this.supportStreaming = supportStreaming;
}
public void setWithAWSV4Signature(boolean withAWSV4Signature) {
this.withAWSV4Signature = withAWSV4Signature;
}
public void setGradleProperties(final String gradleProperties) {
this.gradleProperties = gradleProperties;
}

View File

@@ -0,0 +1,118 @@
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen.languages;
import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Template;
import org.openapitools.codegen.*;
import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.model.ApiInfoMap;
import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JetbrainsHttpClientClientCodegen extends DefaultCodegen implements CodegenConfig {
public static final String PROJECT_NAME = "Jetbrains HTTP Client";
public CodegenType getTag() {
return CodegenType.CLIENT;
}
public String getName() {
return "jetbrains-http-client";
}
public String getHelp() {
return "Generates a jetbrains-http client. See https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html";
}
@Override
public GeneratorLanguage generatorLanguage() {
return GeneratorLanguage.HTTP;
}
public JetbrainsHttpClientClientCodegen() {
super();
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
.stability(Stability.EXPERIMENTAL)
.build();
outputFolder = "generated-code" + File.separator + "jetbrains-http-client";
apiTemplateFiles.put("api.mustache", ".http");
embeddedTemplateDir = templateDir = "jetbrains-http-client";
apiPackage = "Apis";
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
}
@Override
protected ImmutableMap.Builder<String, Mustache.Lambda> addMustacheLambdas() {
return super.addMustacheLambdas()
.put("doubleMustache", new DoubleMustacheLambda());
}
public static class DoubleMustacheLambda implements Mustache.Lambda {
@Override
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
String text = fragment.execute();
writer.write(text
.replaceAll("\\{", "{{")
.replaceAll("}", "}}")
);
}
}
@Override
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> bundle) {
return bundle;
}
@Override
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) {
return super.postProcessOperationsWithModels(objs, allModels);
}
@Override
public void postProcess() {
System.out.println("################################################################################");
System.out.println("# Thanks for using OpenAPI Generator. #");
System.out.println("# Please consider donation to help us maintain this project \uD83D\uDE4F #");
System.out.println("# https://opencollective.com/openapi_generator/donate #");
System.out.println("# #");
System.out.println("# This generator was written by Julien Lengrand-Lambert (https://github.com/jlengrand) #");
System.out.println("################################################################################");
}
}

View File

@@ -0,0 +1,106 @@
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen.languages;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import java.io.File;
public class JuliaClientCodegen extends AbstractJuliaCodegen {
/**
* Configures the type of generator.
*
* @return the CodegenType for this generator
* @see org.openapitools.codegen.CodegenType
*/
public CodegenType getTag() {
return CodegenType.CLIENT;
}
/**
* Configures the name of the generator.
* This will be used to refer to the generator when configuration is read from config files.
*
* @return the name of the generator
*/
public String getName() {
return "julia-client";
}
/**
* Configures a help message for the generator.
* TODO: add parameters, tips here
*
* @return the help message for the generator
*/
public String getHelp() {
return "Generates a julia client.";
}
public JuliaClientCodegen() {
super();
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
.stability(Stability.BETA)
.build();
outputFolder = "generated-code" + File.separator + "julia-client";
modelTemplateFiles.put("model.mustache", ".jl");
apiTemplateFiles.put("api.mustache", ".jl");
embeddedTemplateDir = templateDir = "julia-client";
modelDocTemplateFiles.put("model_doc.mustache", ".md");
apiDocTemplateFiles.put("api_doc.mustache", ".md");
// apiPackage = "Apis";
// modelPackage = "Models";
supportingFiles.clear();
supportingFiles.add(new SupportingFile("README.mustache", "README.md"));
cliOptions.clear();
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Julia client package name.").defaultValue("APIClient"));
cliOptions.add(new CliOption("exportModels", "Whether to generate code to export model names.").defaultValue("false"));
cliOptions.add(new CliOption("exportOperations", "Whether to generate code to export operation names.").defaultValue("false"));
}
@Override
public void processOpts() {
super.processOpts();
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {
setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));
} else {
setPackageName("APIClient");
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
}
if (additionalProperties.containsKey("exportModels")) {
setExportModels(Boolean.parseBoolean((String) additionalProperties.get("exportModels")));
}
additionalProperties.put("exportModels", exportModels);
if (additionalProperties.containsKey("exportOperations")) {
setExportModels(Boolean.parseBoolean((String) additionalProperties.get("exportOperations")));
}
additionalProperties.put("exportOperations", exportModels);
additionalProperties.put("apiDocPath", apiDocPath);
additionalProperties.put("modelDocPath", modelDocPath);
supportingFiles.add(new SupportingFile("client.mustache", srcPath, packageName + ".jl"));
supportingFiles.add(new SupportingFile("modelincludes.mustache", srcPath, "modelincludes.jl"));
}
}

View File

@@ -0,0 +1,98 @@
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen.languages;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import java.io.File;
public class JuliaServerCodegen extends AbstractJuliaCodegen {
/**
* Configures the type of generator.
*
* @return the CodegenType for this generator
* @see org.openapitools.codegen.CodegenType
*/
public CodegenType getTag() {
return CodegenType.SERVER;
}
/**
* Configures the name of the generator.
* This will be used to refer to the generator when configuration is read from config files.
*
* @return the name of the generator
*/
public String getName() {
return "julia-server";
}
/**
* Configures a help message for the generator.
* TODO: add parameters, tips here
*
* @return the help message for the generator
*/
public String getHelp() {
return "Generates a julia server.";
}
public JuliaServerCodegen() {
super();
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
.stability(Stability.BETA)
.build();
outputFolder = "generated-code" + File.separator + "julia-server";
modelTemplateFiles.put("model.mustache", ".jl");
apiTemplateFiles.put("api.mustache", ".jl");
embeddedTemplateDir = templateDir = "julia-server";
modelDocTemplateFiles.put("model_doc.mustache", ".md");
apiDocTemplateFiles.put("api_doc.mustache", ".md");
supportingFiles.clear();
supportingFiles.add(new SupportingFile("README.mustache", "README.md"));
cliOptions.clear();
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Julia server package name.").defaultValue("APIServer"));
cliOptions.add(new CliOption("exportModels", "Whether to generate code to export model names.").defaultValue("false"));
}
@Override
public void processOpts() {
super.processOpts();
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {
setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));
} else {
setPackageName("APIServer");
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
}
if (additionalProperties.containsKey("exportModels")) {
setExportModels(Boolean.parseBoolean((String) additionalProperties.get("exportModels")));
}
additionalProperties.put("exportModels", exportModels);
additionalProperties.put("apiDocPath", apiDocPath);
additionalProperties.put("modelDocPath", modelDocPath);
supportingFiles.add(new SupportingFile("server.mustache", srcPath, packageName + ".jl"));
supportingFiles.add(new SupportingFile("modelincludes.mustache", srcPath, "modelincludes.jl"));
}
}

View File

@@ -72,6 +72,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
public static final String USE_TAGS = "useTags";
public static final String BEAN_QUALIFIERS = "beanQualifiers";
public static final String USE_SPRING_BOOT3 = "useSpringBoot3";
private String basePackage;
private String invokerPackage;
private String serverPort = "8080";
@@ -87,6 +89,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
private boolean delegatePattern = false;
protected boolean useTags = false;
private boolean beanQualifiers = false;
protected boolean useSpringBoot3 = false;
private DocumentationProvider documentationProvider;
private AnnotationLibrary annotationLibrary;
@@ -156,6 +160,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
addSwitch(BEAN_QUALIFIERS, "Whether to add fully-qualifier class names as bean qualifiers in @Component and " +
"@RestController annotations. May be used to prevent bean names clash if multiple generated libraries" +
" (contexts) added to single project.", beanQualifiers);
addSwitch(USE_SPRING_BOOT3, "Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.", useSpringBoot3);
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
setLibrary(SPRING_BOOT);
@@ -180,6 +185,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
cliOptions.add(annotationLibraryCliOption);
}
}
@Override
public DocumentationProvider getDocumentationProvider() {
return documentationProvider;
@@ -230,7 +236,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
* @return true if the selected DocumentationProvider requires us to bootstrap swagger-ui.
*/
private boolean selectedDocumentationProviderRequiresSwaggerUiBootstrap() {
return getDocumentationProvider().equals(DocumentationProvider.SPRINGFOX) ||
return getDocumentationProvider().equals(DocumentationProvider.SPRINGFOX) ||
getDocumentationProvider().equals(DocumentationProvider.SOURCE);
}
@@ -315,6 +321,14 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
this.useTags = useTags;
}
public void setUseSpringBoot3(boolean isSpringBoot3) {
this.useSpringBoot3 = isSpringBoot3;
}
public boolean isUseSpringBoot3() {
return useSpringBoot3;
}
@Override
public void setUseBeanValidation(boolean useBeanValidation) {
this.useBeanValidation = useBeanValidation;
@@ -357,11 +371,11 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
if (null != defaultDocumentationProvider()) {
documentationProvider = DocumentationProvider.ofCliOption(
(String)additionalProperties.getOrDefault(DOCUMENTATION_PROVIDER,
(String) additionalProperties.getOrDefault(DOCUMENTATION_PROVIDER,
defaultDocumentationProvider().toCliOptValue())
);
if (! supportedDocumentationProvider().contains(documentationProvider)) {
if (!supportedDocumentationProvider().contains(documentationProvider)) {
String msg = String.format(Locale.ROOT,
"The [%s] Documentation Provider is not supported by this generator",
documentationProvider.toCliOptValue());
@@ -373,13 +387,13 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
documentationProvider.getPreferredAnnotationLibrary().toCliOptValue())
);
if (! supportedAnnotationLibraries().contains(annotationLibrary)) {
if (!supportedAnnotationLibraries().contains(annotationLibrary)) {
String msg = String.format(Locale.ROOT, "The Annotation Library [%s] is not supported by this generator",
annotationLibrary.toCliOptValue());
throw new IllegalArgumentException(msg);
}
if (! documentationProvider.supportedAnnotationLibraries().contains(annotationLibrary)) {
if (!documentationProvider.supportedAnnotationLibraries().contains(annotationLibrary)) {
String msg = String.format(Locale.ROOT,
"The [%s] documentation provider does not support [%s] as complementary annotation library",
documentationProvider.toCliOptValue(), annotationLibrary.toCliOptValue());
@@ -503,6 +517,22 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
this.setUseTags(Boolean.parseBoolean(additionalProperties.get(USE_TAGS).toString()));
}
if (additionalProperties.containsKey(USE_SPRING_BOOT3)) {
this.setUseSpringBoot3(convertPropertyToBoolean(USE_SPRING_BOOT3));
}
if (isUseSpringBoot3()) {
if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) {
throw new IllegalArgumentException(DocumentationProvider.SPRINGFOX.getPropertyName() + " is not supported with Spring Boot > 3.x");
}
if (AnnotationLibrary.SWAGGER1.equals(getAnnotationLibrary())) {
throw new IllegalArgumentException(AnnotationLibrary.SWAGGER1.getPropertyName() + " is not supported with Spring Boot > 3.x");
}
useJakartaEe=true;
additionalProperties.put(USE_JAKARTA_EE, useJakartaEe);
applyJakartaPackage();
}
writePropertyBack(USE_SPRING_BOOT3, isUseSpringBoot3());
modelTemplateFiles.put("model.mustache", ".kt");
if (!this.interfaceOnly && this.delegatePattern) {
@@ -544,10 +574,18 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
if (library.equals(SPRING_BOOT)) {
LOGGER.info("Setup code generator for Kotlin Spring Boot");
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
if (isUseSpringBoot3()) {
supportingFiles.add(new SupportingFile("pom-sb3.mustache", "", "pom.xml"));
} else {
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
}
if (this.gradleBuildFile) {
supportingFiles.add(new SupportingFile("buildGradleKts.mustache", "", "build.gradle.kts"));
if (isUseSpringBoot3()) {
supportingFiles.add(new SupportingFile("buildGradle-sb3-Kts.mustache", "", "build.gradle.kts"));
} else {
supportingFiles.add(new SupportingFile("buildGradleKts.mustache", "", "build.gradle.kts"));
}
supportingFiles.add(new SupportingFile("settingsGradle.mustache", "", "settings.gradle"));
}

View File

@@ -79,6 +79,8 @@ public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements Code
protected boolean renderJavadoc = true;
protected boolean removeOAuthSecurities = true;
Map<String, ModelsMap> enumRefs = new HashMap<>();
public ScalaSttpClientCodegen() {
super();
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
@@ -261,14 +263,8 @@ public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements Code
@SuppressWarnings("unchecked")
private void postProcessUpdateImports(final Map<String, ModelsMap> models) {
final String prefix = modelPackage() + ".";
Map<String, ModelsMap> enumRefs = new HashMap<>();
for (String key : models.keySet()) {
CodegenModel model = ModelUtils.getModelByName(key, models);
if (model.isEnum) {
ModelsMap objs = models.get(key);
enumRefs.put(key, objs);
}
}
enumRefs = getEnumRefs(models);
for (String openAPIName : models.keySet()) {
CodegenModel model = ModelUtils.getModelByName(openAPIName, models);
@@ -276,6 +272,7 @@ public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements Code
LOGGER.warn("Expected to retrieve model {} by name, but no model was found. Check your -Dmodels inclusions.", openAPIName);
continue;
}
ModelsMap objs = models.get(openAPIName);
List<Map<String, String>> imports = objs.getImports();
if (imports == null || imports.isEmpty()) {
@@ -285,25 +282,35 @@ public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements Code
Iterator<Map<String, String>> iterator = imports.iterator();
while (iterator.hasNext()) {
String importPath = iterator.next().get("import");
Map<String, String> item = new HashMap<>();
if (importPath.startsWith(prefix)) {
if (isEnumClass(importPath, enumRefs)) {
Map<String, String> item = new HashMap<>();
item.put("import", importPath.concat("._"));
newImports.add(item);
}
}
else {
Map<String, String> item = new HashMap<>();
item.put("import", importPath);
newImports.add(item);
}
if (isEnumClass(importPath, enumRefs)) {
item.put("import", importPath.concat("._"));
newImports.add(item);
}
}
else {
item.put("import", importPath);
newImports.add(item);
}
}
// reset imports
objs.setImports(newImports);
}
}
private Map<String, ModelsMap> getEnumRefs(final Map<String, ModelsMap> models) {
Map<String, ModelsMap> enums = new HashMap<>();
for (String key : models.keySet()) {
CodegenModel model = ModelUtils.getModelByName(key, models);
if (model.isEnum) {
ModelsMap objs = models.get(key);
enums.put(key, objs);
}
}
return enums;
}
private boolean isEnumClass(final String importPath, final Map<String, ModelsMap> enumModels) {
if (enumModels == null || enumModels.isEmpty()) {
return false;
@@ -351,6 +358,26 @@ public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements Code
LOGGER.error("Unable to find operations List", e);
}
}
// update imports for enum class
List<Map<String, String>> newImports = new ArrayList<>();
List<Map<String, String>> imports = objs.getImports();
if (imports != null && !imports.isEmpty()) {
Iterator<Map<String, String>> iterator = imports.iterator();
while (iterator.hasNext()) {
String importPath = iterator.next().get("import");
Map<String, String> item = new HashMap<>();
if (isEnumClass(importPath, enumRefs)) {
item.put("import", importPath.concat("._"));
}
else {
item.put("import", importPath);
}
newImports.add(item);
}
}
objs.setImports(newImports);
return super.postProcessOperationsWithModels(objs, allModels);
}

View File

@@ -99,6 +99,7 @@ public class SpringCodegen extends AbstractJavaCodegen
public static final String USE_TAGS = "useTags";
public static final String SPRING_BOOT = "spring-boot";
public static final String SPRING_CLOUD_LIBRARY = "spring-cloud";
public static final String SPRING_HTTP_INTERFACE = "spring-http-interface";
public static final String API_FIRST = "apiFirst";
public static final String SPRING_CONTROLLER = "useSpringController";
public static final String HATEOAS = "hateoas";
@@ -241,12 +242,13 @@ public class SpringCodegen extends AbstractJavaCodegen
"Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies",
useSwaggerUI));
cliOptions.add(CliOption.newBoolean(USE_SPRING_BOOT3,
"Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports).",
"Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.",
useSpringBoot3));
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
supportedLibraries.put(SPRING_CLOUD_LIBRARY,
"Spring-Cloud-Feign client with Spring-Boot auto-configured settings.");
supportedLibraries.put(SPRING_HTTP_INTERFACE, "Spring 6 HTTP interfaces (testing)");
setLibrary(SPRING_BOOT);
final CliOption library = new CliOption(CodegenConstants.LIBRARY, CodegenConstants.LIBRARY_DESC)
.defaultValue(SPRING_BOOT);
@@ -272,7 +274,7 @@ public class SpringCodegen extends AbstractJavaCodegen
@Override
public DocumentationProvider defaultDocumentationProvider() {
return DocumentationProvider.SPRINGDOC;
return SPRING_HTTP_INTERFACE.equals(library) ? DocumentationProvider.NONE : DocumentationProvider.SPRINGDOC;
}
public List<DocumentationProvider> supportedDocumentationProvider() {
@@ -343,6 +345,14 @@ public class SpringCodegen extends AbstractJavaCodegen
// Please refrain from updating values of Config Options after super.ProcessOpts() is called
super.processOpts();
if (SPRING_HTTP_INTERFACE.equals(library)) {
documentationProvider = DocumentationProvider.NONE;
annotationLibrary = AnnotationLibrary.NONE;
useJakartaEe=true;
additionalProperties.put(USE_JAKARTA_EE, useJakartaEe);
applyJakartaPackage();
}
if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) {
LOGGER.warn("The springfox documentation provider is deprecated for removal. Use the springdoc provider instead.");
}
@@ -402,8 +412,8 @@ public class SpringCodegen extends AbstractJavaCodegen
}
if (additionalProperties.containsKey(REACTIVE)) {
if (!SPRING_BOOT.equals(library)) {
throw new IllegalArgumentException("Currently, reactive option is only supported with Spring-boot");
if (SPRING_CLOUD_LIBRARY.equals(library)) {
throw new IllegalArgumentException("Currently, reactive option doesn't supported by Spring Cloud");
}
this.setReactive(Boolean.parseBoolean(additionalProperties.get(REACTIVE).toString()));
}
@@ -473,6 +483,8 @@ public class SpringCodegen extends AbstractJavaCodegen
if (AnnotationLibrary.SWAGGER1.equals(getAnnotationLibrary())) {
throw new IllegalArgumentException(AnnotationLibrary.SWAGGER1.getPropertyName() + " is not supported with Spring Boot > 3.x");
}
useJakartaEe=true;
additionalProperties.put(USE_JAKARTA_EE, useJakartaEe);
applyJakartaPackage();
}
writePropertyBack(USE_SPRING_BOOT3, isUseSpringBoot3());
@@ -483,6 +495,9 @@ public class SpringCodegen extends AbstractJavaCodegen
importMapping.put("DateTimeFormat", "org.springframework.format.annotation.DateTimeFormat");
importMapping.put("ApiIgnore", "springfox.documentation.annotations.ApiIgnore");
importMapping.put("ParameterObject", "org.springdoc.api.annotations.ParameterObject");
if (isUseSpringBoot3()) {
importMapping.put("ParameterObject", "org.springdoc.core.annotations.ParameterObject");
}
if (useOptional) {
writePropertyBack(USE_OPTIONAL, useOptional);
@@ -532,7 +547,7 @@ public class SpringCodegen extends AbstractJavaCodegen
// @RequestMapping not supported with spring cloud openfeign.
setRequestMappingMode(RequestMappingMode.none);
additionalProperties.put(USE_FEIGN_CLIENT, "true");
} else {
} else if (SPRING_BOOT.equals(library)) {
apiTemplateFiles.put("apiController.mustache", "Controller.java");
if (containsEnums()) {
supportingFiles.add(new SupportingFile("converter.mustache",
@@ -556,10 +571,14 @@ public class SpringCodegen extends AbstractJavaCodegen
"SpringFoxConfiguration.java"));
}
}
} else if (SPRING_HTTP_INTERFACE.equals(library)) {
supportingFiles.add(new SupportingFile("httpInterfacesConfiguration.mustache",
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "HttpInterfacesAbstractConfigurator.java"));
writePropertyBack(USE_BEANVALIDATION, false);
}
}
if (!SPRING_CLOUD_LIBRARY.equals(library)) {
if (SPRING_BOOT.equals(library)) {
supportingFiles.add(new SupportingFile("apiUtil.mustache",
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiUtil.java"));
}

View File

@@ -0,0 +1,56 @@
/*
* 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.templating.mustache;
import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Template;
import java.io.IOException;
import java.io.Writer;
/**
* Escapes the desired character if not escaped already, e.g. {@code $ => \$}.
*
* Register:
* {@code additionalProperties.put("escapeDollar", new EscapeChar("(?<!\\\\)\\$", "\\\\\\$")); }
*
* Use:
* {@code {{#lambda.escapeDollar}}{{name}}{{/lambda.escapeDollar}} }
*/
public class EscapeChar implements Mustache.Lambda {
private String matchPattern;
private String replacement;
/**
* Constructs a new instance of {@link EscapeChar}, with the desired character to escape
*
* @param matchPattern the character to escape
* @param replacement the escaped character
*/
public EscapeChar(String matchPattern, String replacement) {
this.matchPattern = matchPattern;
this.replacement = replacement;
}
@Override
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
String text = fragment.execute();
text = text.replaceAll(matchPattern, replacement);
writer.write(text);
}
}

View File

@@ -476,6 +476,43 @@ public class ModelUtils {
return false;
}
/**
* Return true if the specified schema is composed with more than one of the following:
* 'oneOf', 'anyOf' or 'allOf'.
*
* @param schema the OAS schema
* @return true if the specified schema is a Composed schema.
*/
public static boolean isComplexComposedSchema(Schema schema) {
if (!(schema instanceof ComposedSchema)) {
return false;
}
int count = 0;
if (schema.getAllOf() != null && !schema.getAllOf().isEmpty()) {
count++;
}
if (schema.getOneOf() != null && !schema.getOneOf().isEmpty()) {
count++;
}
if (schema.getAnyOf() != null && !schema.getAnyOf().isEmpty()) {
count++;
}
if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
count++;
}
if (count > 1) {
return true;
}
return false;
}
/**
* Return true if the specified 'schema' is an object that can be extended with additional properties.
* Additional properties means a Schema should support all explicitly defined properties plus any

View File

@@ -830,7 +830,15 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
String mimeType = getResponseMimeType(response);
if (mimeType == null || isJsonMime(mimeType)) {
// Assume json if no mime type
return objectMapper.readValue(entity.getContent(), valueType);
// convert input stream to string
java.util.Scanner s = new java.util.Scanner(entity.getContent()).useDelimiter("\\A");
String content = (String) (s.hasNext() ? s.next() : "");
if ("".equals(content)) { // returns null for empty body
return null;
}
return objectMapper.readValue(content, valueType);
} else if ("text/plain".equalsIgnoreCase(mimeType)) {
// convert input stream to string
java.util.Scanner s = new java.util.Scanner(entity.getContent()).useDelimiter("\\A");
@@ -893,9 +901,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
* @param path The sub path
* @param queryParams The query parameters
* @param collectionQueryParams The collection query parameters
* @param urlQueryDeepObject URL query string of the deep object parameters
* @return The full URL
*/
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams) {
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams, String urlQueryDeepObject) {
String baseURL;
if (serverIndex != null) {
if (serverIndex < 0 || serverIndex >= servers.size()) {
@@ -946,6 +955,11 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
}
}
if (urlQueryDeepObject != null && urlQueryDeepObject.length() > 0) {
url.append(url.toString().contains("?") ? "&" : "?");
url.append(urlQueryDeepObject);
}
return url.toString();
}
@@ -987,6 +1001,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
* @param method The request method, one of "GET", "POST", "PUT", and "DELETE"
* @param queryParams The query parameters
* @param collectionQueryParams The collection query parameters
* @param urlQueryDeepObject A URL query string for deep object parameters
* @param body The request body object - if it is not binary, otherwise null
* @param headerParams The header parameters
* @param cookieParams The cookie parameters
@@ -1003,6 +1018,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
String method,
List<Pair> queryParams,
List<Pair> collectionQueryParams,
String urlQueryDeepObject,
Object body,
Map<String, String> headerParams,
Map<String, String> cookieParams,
@@ -1016,7 +1032,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
}
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
final String url = buildUrl(path, queryParams, collectionQueryParams);
final String url = buildUrl(path, queryParams, collectionQueryParams, urlQueryDeepObject);
RequestBuilder builder = RequestBuilder.create(method);
builder.setUri(url);
@@ -1061,7 +1077,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
}
} else {
// for empty body
builder.setEntity(serialize(null, null, contentTypeObj));
builder.setEntity(new StringEntity("", contentTypeObj));
}
try (CloseableHttpResponse response = httpClient.execute(builder.build(), context)) {

View File

@@ -18,6 +18,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
{{/fullJavaUtil}}
{{>generatedAnnotation}}
@@ -75,7 +76,8 @@ public class {{classname}} {
String localVarPath = "{{{path}}}"{{#pathParams}}
.replaceAll("\\{" + "{{baseName}}" + "\\}", apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}};
// query params
{{javaUtilPrefix}}StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
{{javaUtilPrefix}}List<Pair> localVarQueryParams = new {{javaUtilPrefix}}ArrayList<Pair>();
{{javaUtilPrefix}}List<Pair> localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList<Pair>();
{{javaUtilPrefix}}Map<String, String> localVarHeaderParams = new {{javaUtilPrefix}}HashMap<String, String>();
@@ -84,7 +86,15 @@ public class {{classname}} {
{{#queryParams}}
{{#isDeepObject}}
{{#collectionFormat}}localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}}));
localVarQueryParameterBaseName = "{{{baseName}}}";
{{#isArray}}
for (int i=0; i < {{paramName}}.size(); i++) {
localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format("{{baseName}}[%d]", i)));
}
{{/isArray}}
{{^isArray}}
localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString("{{baseName}}"));
{{/isArray}}
{{/isDeepObject}}
{{^isDeepObject}}
{{#isExplode}}
@@ -99,7 +109,12 @@ public class {{classname}} {
{{/vars}}
{{/hasVars}}
{{^hasVars}}
{{#isModel}}
localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString());
{{/isModel}}
{{^isModel}}
{{#collectionFormat}}localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}}));
{{/isModel}}
{{/hasVars}}
{{/isExplode}}
{{^isExplode}}
@@ -142,6 +157,7 @@ public class {{classname}} {
"{{httpMethod}}",
localVarQueryParams,
localVarCollectionQueryParams,
localVarQueryStringJoiner.toString(),
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,

View File

@@ -3,7 +3,7 @@ package {{apiPackage}};
import {{rootJavaEEPackage}}.ws.rs.core.Response;
public class ApiException extends Exception {
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
private static final long serialVersionUID = 1L;
private Response response;

View File

@@ -338,7 +338,7 @@ public class {{classname}} {
{{#hasQueryParams}}
{{javaUtilPrefix}}List<Pair> localVarQueryParams = new {{javaUtilPrefix}}ArrayList<>();
StringJoiner localVarQueryDeepObjectStringJoiner = new StringJoiner("&");
{{javaUtilPrefix}}StringJoiner localVarQueryStringJoiner = new {{javaUtilPrefix}}StringJoiner("&");
String localVarQueryParameterBaseName;
{{#queryParams}}
localVarQueryParameterBaseName = "{{{baseName}}}";
@@ -350,11 +350,11 @@ public class {{classname}} {
if ({{paramName}} != null) {
{{#isArray}}
for (int i=0; i < {{paramName}}.size(); i++) {
localVarQueryDeepObjectStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format("{{baseName}}[%d]", i)));
localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format("{{baseName}}[%d]", i)));
}
{{/isArray}}
{{^isArray}}
localVarQueryDeepObjectStringJoiner.add({{paramName}}.toUrlQueryString("{{baseName}}"));
localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString("{{baseName}}"));
{{/isArray}}
}
{{/isDeepObject}}
@@ -371,7 +371,12 @@ public class {{classname}} {
{{/vars}}
{{/hasVars}}
{{^hasVars}}
{{#isModel}}
localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString());
{{/isModel}}
{{^isModel}}
localVarQueryParams.addAll(ApiClient.parameterToPairs("{{baseName}}", {{paramName}}));
{{/isModel}}
{{/hasVars}}
{{/isExplode}}
{{^isExplode}}
@@ -381,11 +386,11 @@ public class {{classname}} {
{{/collectionFormat}}
{{/queryParams}}
if (!localVarQueryParams.isEmpty() || localVarQueryDeepObjectStringJoiner.length() != 0) {
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
{{javaUtilPrefix}}StringJoiner queryJoiner = new {{javaUtilPrefix}}StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
if (localVarQueryDeepObjectStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryDeepObjectStringJoiner.toString());
if (localVarQueryStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryStringJoiner.toString());
}
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {

View File

@@ -16,13 +16,15 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
{{/additionalPropertiesType}}
{{/model}}
{{/models}}
{{#supportUrlQuery}}
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
{{/supportUrlQuery}}
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import java.util.StringJoiner;
{{#imports}}
import {{import}};
{{/imports}}

Some files were not shown because too many files have changed in this diff Show More