Compare commits

...

71 Commits

Author SHA1 Message Date
William Cheng
3d25263e32 use localhost 2025-09-27 16:33:24 +08:00
William Cheng
9a2d997398 skip host table update 2025-09-27 16:19:59 +08:00
William Cheng
d920f72020 test with ruby 3.4 2025-09-27 16:17:40 +08:00
William Cheng
152c87ee18 Revert "test with mac"
This reverts commit 3acc76a48b.
2025-09-27 15:53:48 +08:00
William Cheng
3acc76a48b test with mac 2025-09-27 15:32:08 +08:00
William Cheng
efd2fe60ad Merge remote-tracking branch 'origin/master' into ruby-github-test 2025-09-24 16:24:15 +08:00
fwermelskirchen
f02acaf27e [cxf] add support for Swagger2 (#22010)
* [cxf] add support for Swagger2

Closes #3668

* regen samples

* regen docs

* unconditionally include parameter imports

* Add swagger2 update samples

---------

Co-authored-by: Jens Kleine-Herzbruch <jensgr@gmx.net>
2025-09-24 15:18:37 +08:00
Tilman Holube
75804e4e31 Bump Jackson to 2.19.2 and databind-nullable to 0.2.7 (#22017) 2025-09-24 13:49:19 +08:00
Artem Shubovych
fe6da71327 [java] Fix annotationLibrary option being ignored (#21992)
* Only register the Swagger annotation imports for the corresponding annotationLibrary

* Fix the issue in a specific generator

* Add unit test
2025-09-23 16:31:01 +08:00
William Cheng
2f69ad9f26 update java samples 2025-09-22 15:43:37 +08:00
William Cheng
e5437e06a3 Update Ruby faraday to use ruby fake petstore test spec (#22008)
* update ruby faraday to use ruby fake petstore test spec

* clean up, regenerate samples

* update test
2025-09-21 23:33:40 +08:00
jpfinne
7e9b9615db [Java] [Spring] Use deduction configOptions for oneOfInterfaces (#20919)
* fix(java): x-discriminator-value should not produce @JsonTypeName

* fix(java): Remove unused getDiscriminatorValue()

* build at Fednot

* build at Fednot

* build at Fednot: skip sonar

* scm for release at fednot

* build fednot not 7.5.0-FEDNOT-SNAPSHOT

* build fednot not 7.5.0-FEDNOT-SNAPSHOT

* test all vars

* rollback custom pom.xml

* commit master

* commit test

* Samples for deduction

* add files  for deduction

* small improvements

* Merge changes from martin-mfg
Merge master

* Merge changes from martin-mfg
Merge master

* Merge changes from martin-mfg
Add comment to force rebuild

* Merge master

* regenerate doc

* regenerate client

* regenerate client

---------

Co-authored-by: Jean-Paul Finne <jean-paul.finne@fednot.be>
Co-authored-by: martin-mfg <2026226+martin-mfg@users.noreply.github.com>
2025-09-21 23:22:39 +08:00
William Cheng
731668b199 remove travis, appveyor from project (#22007) 2025-09-21 22:26:55 +08:00
William Cheng
43c78856f5 add new files 2025-09-21 17:51:01 +08:00
William Cheng
564f4e023d cat hosts 2025-09-21 17:34:07 +08:00
William Cheng
117773f14c update samples 2025-09-21 17:29:03 +08:00
William Cheng
260787b0a1 update 2025-09-21 17:07:40 +08:00
William Cheng
ef0aef28d7 use 127.0.0.1 2025-09-21 17:02:14 +08:00
William Cheng
324d773123 update tests 2025-09-21 16:56:52 +08:00
William Cheng
2760903274 update config to use ruby petstore fake spec 2025-09-21 16:48:43 +08:00
William Cheng
9d29eb98bc localhost 2025-09-21 16:44:59 +08:00
William Cheng
c2a8e11b45 add petstore, update host table 2025-09-21 16:39:50 +08:00
William Cheng
2b3947ea1a fix workflow 2025-09-21 16:38:06 +08:00
William Cheng
33fdad9554 add echo client tests 2025-09-21 16:35:55 +08:00
William Cheng
dceb03a8f0 migrate ruby tests to github workflow 2025-09-21 16:33:18 +08:00
William Cheng
24d7c3e904 Refactor Scala client, server Github workflow for testing (#22005)
* refactor scala client server workflow for testing

* fix

* migrate circleci scala tests

* add service, update host table

* java 8

* add distribution

* java 17

* 2.13.x

* update

* clean up circleci config
2025-09-21 16:27:03 +08:00
William Cheng
71a6901d1e Add GitHub workflow to test Clojure client (#22004)
* add workflow to test clojure client;

* add file

* run tests

* remove server

* Revert "remove server"

This reverts commit bda9143219.

* clean up circleci
2025-09-21 00:32:44 +08:00
William Cheng
f1a273de16 Test Java clients with Petstore server in Github workflow (#22003)
* test java clients with petstore in github workflow

* update

* clean up
2025-09-21 00:00:52 +08:00
William Cheng
3a63c2f7d2 Migrate Go petstore tests from circleci to github workflow (#21997)
* migrate go tests from circleci to github workflow

* update samples

* update samples

* update workflow

* update samples

* update samples

* update test

* update tests

* update tests

* fix

* fix

* update host table

* update tests

* update spec

* new spec
2025-09-19 17:10:31 +08:00
Mattias Sehlstedt
73c8728343 [Java] [Spring-client] Exclude discriminator from nullable annotation (#21981)
* Exclude the discriminator from getting a nullable-annotation

* Update samples
2025-09-19 14:50:58 +08:00
William Cheng
ac3c37095d [C#][httpclient] Add tests for nonPublicApi option (#21996)
* add samples to test nonPublicApi option

* add option to test nonPublicApi

* update test

* update tests
2025-09-19 14:49:26 +08:00
William Cheng
a55525c634 update php samples 2025-09-19 14:28:41 +08:00
Kevin
ec0edf433a Issue 21958 php-slim4 throws exception (#21962)
authenticatorConfig was being overwritten instead of having additional fields added.
Changed the reqex from requiring leading whitespace to having it optional.
2025-09-19 14:25:41 +08:00
ferenc-a
1c950018c8 Fix visibility for enum in C# generator (#21984) 2025-09-18 18:11:52 +08:00
Bruno Coelho
7a5d0d1a71 [kotlin][client] remove old deprecated apis (#21988) 2025-09-18 17:28:42 +08:00
Jason Frey
327599996d [bash] Fix issue where paste command doesn't work on Mac (#21986) 2025-09-18 17:27:51 +08:00
Jason Frey
5bdb691fb6 [bash] Drop old client.sh from petstore sample (#21987)
The bash config is configured to generate with a scriptName of
petstore-cli. As such, it will never generate client.sh and related
files. This seems to be a leftover from before the bash config was
introduced, and is not needed.
2025-09-18 17:27:10 +08:00
William Cheng
fec88b3e88 Migrate tests from AppVeyor to GitHub workflow (#21982)
* migrate tests from appveyor to github workflow

* test with dotnet 7

* test on windows

* set dotnet version

* Revert "set dotnet version"

This reverts commit 87af6a63ad.

* use localhost

* update

* update

* update tets

* update

* remove appveyor
2025-09-17 16:03:02 +08:00
William Cheng
0e1cba6eb6 update commons deps to newer versions (#21980) 2025-09-16 17:40:27 +08:00
William Cheng
45e4fa1633 Add workflow for PowerShell clients (#21979)
* add workflow for powershell client

* update

* fix container

* import, test

* combine

* use localhost

* update tests

* remove powershell tests from appveyor.yml
2025-09-16 15:24:22 +08:00
William Cheng
46de9c8c16 separate workflow to test java with sbt (#21978) 2025-09-16 14:24:58 +08:00
William Cheng
ab6c827098 Mark scala-lagom-server as deprecated (#21977)
* mark scala-lagom-server as deprecated

* update workflow
2025-09-16 13:59:00 +08:00
William Cheng
e68e3e88b3 More dart dio tests, update samples (#21975)
* more dart dio tests, update samples

* update

* update

* more tests

* update

* update
2025-09-16 11:46:52 +08:00
William Cheng
8b01ebb5c2 [dart-dio][timemachine] Bugfix: saving offset_date_serializer instead of local_date_serialize (#21974)
* Bugfix: saving offset_date_serializer instead of local_date_serializer.dart

* New config for dart-dio (timemachine)

* test samples in github workflow

* update workflow, samples

* rename

---------

Co-authored-by: Enric Pou <enricpou@gmail.com>
2025-09-16 10:40:07 +08:00
William Cheng
7dcef20355 update java samples 2025-09-16 10:05:15 +08:00
Simon
6e48cf4247 [BUG][JAVA] RestTemplate uses hardcoded User-Agent Java-SDK #21972 (#21973)
Co-authored-by: Simon Baranov <simon.baranov@zahlungswerk.de>
2025-09-16 10:01:18 +08:00
Jachym Metlicka
6278512122 [kotlin-spring][server] Feat: Allow implementation of arbitrary interface in DTOs (similar to x-implements from java-spring) (#21950)
* add basic implementation and tests

* improve test a bit

* modify kotlin-spring.md

* add x-kotlin-implements also to enum

* update samples & properly define implemented vendor extension

* use enum.getName() instead of hardcoded string as key in vendor extension map

* fix docs

* fix test openapi spec and test

* add samples for x-kotlin-implements

* add samples for x-kotlin-implements to proper output folder

* fix

* revert unwanted changes

* move to correct place

* fix mustache template

* add to samples-kotlin-server.yaml

* reuse 1 open api schema for everything. Add also case where interface extends interface.

* add warn logs when x-kotlin-implements-fields is used without x-kotlin-implements to improve usability

* remove unnecessary generated files

* remove unnecessary generated files

* remove "status" inner enum from Pet as it fails to properly import as Pet.Status in implementations. This is a separate bug - not caused by x-kotlin-implements
2025-09-16 02:13:08 +08:00
Csaba Kozák
5c04b754ab [kotlin-client] update Kotlin and libraries versions (#21866) 2025-09-16 02:01:29 +08:00
William Cheng
b7749712b8 feat: Add Java Dubbo code generator for Apache Dubbo microservices (#21968)
* feat: add Apache Dubbo code generator with multi-registry support

- Add comprehensive Dubbo microservice code generator
- Support Zookeeper and Nacos registries with auto-dependency selection
- Implement version-aware dependency management (Dubbo 3.2 vs 3.3+)
- Generate service interfaces, implementations, and Spring Boot REST controllers
- Include complete Spring Boot application structure with configuration
- Add detailed documentation and usage examples
- Support async operations and generic response wrappers
- Provide flexible configuration options for packages, versions, and features

* feat: Add dubbo sample with CI validation

Adds a new sample generator configuration for dubbo.

The existing GitHub workflow for Java samples is updated to build and test this new sample automatically.

* fix: fix Dubbo protocol extension issue in test environment

- Set registry address to N/A to avoid ZooKeeper dependency
- Change protocol from 'triple' to 'tri' to resolve extension loading error

* various fix to java dubbo server generator

* update doc

* update readme

---------

Co-authored-by: redoom <gyklcy@iCloud.com>
2025-09-16 01:51:12 +08:00
Rodrigo de Almeida - RMA3
c30fb413bb issue 21965 - [REQ] MergedSpecBuilder load servers urls from input specs (#21966)
Co-authored-by: Rodrigo Maciel de Almeida <rodrigo.almeida@wefin.com.br>
2025-09-16 01:50:32 +08:00
Jean-Marc Le Roux
6b692739e8 [Rust] Add support for native-tls and rustls-tls Cargo features for the reqwest library (#21925)
* feat(rust): add the native-tls (default) and rustls Cargo features for `reqwest`

* refactor(rust): rename the `rustls` Cargo feature to follow the ecosystem naming convention
2025-09-14 17:22:11 +08:00
Christophe Moine
ee4cb9ac22 [jaxrs-spec][quarkus] Feat: Add an option to use "org.jboss.resteasy.reactive.RestResponse" (#21877)
* replace Response by RestResponse

* fix rest response for Async

* update documentation

* Add option "returnJBossResponse"

* Add tests + fixes

* Polish

* Add dependency "io.quarkus.resteasy.reactive:resteasy-reactive" when returnJBossResponse=true

* fix JavaJAXRSSpecServerCodegenTest

* generate samples & docs
2025-09-14 17:11:06 +08:00
GregDThomas
ec28d6261c Fix #21921 by marking required path parameters as @NotNull (#21951) 2025-09-13 17:48:47 +08:00
Leon Linhart
0edcc9d204 Correctly annotate Gradle task in- & outputs and enable stricter plugin validation (#21957)
* Correctly apply Gradle task input & output annotations to accessors

Gradle's task input and output annotations should be applied to the accessors instead of the properties. No adhering to this can cause funky behavior in the generated stubs. Examples of this can be found in the docs: https://docs.gradle.org/current/userguide/implementing_custom_tasks.html

Also adds missing annotations so that validation passes

* Enable strict Gradle plugin validation
2025-09-13 16:49:06 +08:00
MarcoZurich
59eac42b0f Fix "defaultToEmptyContainer" not properly implemented for non-nullable, required Map (#21953)
* Issue 21890: Fixed flag to use for check of required, non-nullable map

* Issue 21890: added test (first draft)

* Issue 21890: Added Test

---------

Co-authored-by: Marco <chorizoparatodos@gmail.com>
2025-09-13 16:47:45 +08:00
William Cheng
5efe16c66b [java] Update rest-assured dependencies to newer versions (#21961)
* update rest-assured dep to newer versions

* update build
2025-09-13 16:32:31 +08:00
Adam Drakeford
8a061acc7c Remove myself from Kotlin technical committee (#21959)
Unfortunately i have not had time to engage in this project in recent years, and as such feel its best for myself and the community if i remove myself from the Kotlin technical committe. 

Thanks for all the great work done by all contributors.
2025-09-12 23:50:09 +08:00
William Cheng
177b94b1b4 Add tests for numeric form data (kotlin - jvm-ktor) (#21952)
* add tests for numeric form data (kotlin)

* remove null check as its done already
2025-09-12 15:28:57 +08:00
Jef LeCompte
58fde20e2c fix: parameter appending for number types (#21947)
* fix: parameter appending for number types

Updated string and number parameter handling to ensure proper conversion to string before appending.

* Update api.mustache
2025-09-12 13:10:40 +08:00
William Cheng
8300794c5e update python samples 2025-09-11 20:56:37 +08:00
Maik Dijkstra
9b692e5ef7 fix(ruby-client): Fix incorrect boolean parsing in OneOf/AnyOf (#21943)
Changes the logic of parsing of OneOf/AnyOf to fix incorrect type coercion
in OneOf/AnyOf contexts. The guard which checks whether typed_data is true-ish
fails for booleans. If the oneOf includes a boolean type and the data is false then
it will correctly parse this value as a boolean. However, the guard class will determine
that false is not true-ish and therefore returns nil. So the result of the type coercion
of false will be nil. This can result in problems when dealing with default true.

For example how a false can turn into a true with defaults:
1. The API returns false
2. The type coercion determines false becomes nil
3. When storing this retrieved record with a default of true for this column the stored value is suddenly true
while the API specifically returned false

This fix removes this guard and will rely on the exception raised to return nil when type coercion fails.
2025-09-11 20:46:06 +08:00
Knut Erik Langdahl
d523903827 fix(kotlin): set isVoid to true for Unit datatypes (#21940) 2025-09-11 20:17:05 +08:00
Artem ILIN
5f647b8477 [python] fixes #21936, api client type checks (#21935) 2025-09-11 00:04:48 +08:00
Pascal Bachor
6825d9ccaa python: feature flag for lazy imports (#21885)
* python: feature flag for lazy imports

* python: update samples

* python: add python-lazyImports to test job

* python: reuse tests in lazyImports sample

* python: avoid using non-imported submodules

* add normalizer option

---------

Co-authored-by: Pascal Bachor <bachorp@users.noreply.github.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2025-09-10 17:22:41 +08:00
keepConcentration
0e42edc95b [#21619] fix(python): update pyproject.toml license format with poetry1 fallback (#21931)
* Add support for both string and object license formats in `pyproject.toml` for Python and Python-Pydantic generators. (#21619)

* Generate the samples (#21698)

* Generate the samples (#21698)

* Remove Python-Pydantic-v1 license format tests (#21619)

* Revert license format to string in Python-Pydantic-v1 samples (#21619)
2025-09-10 15:35:10 +08:00
Ruben Hönle
278d7ae4c9 java-client: fix some javadoc comments (#21932)
* java-client: fix some javadoc comments

* update samples
2025-09-10 01:44:36 +08:00
William Cheng
7b3de8dbce [python] fix default value when enum is a reference (#21923)
* fix default value when enum is ref (python)

* update spec
2025-09-09 09:21:09 +08:00
William Cheng
bdfbb32cdd Improve Go client tests (#21919)
* test withXml option

* fix path

* update go code (withXml: true)

* test one more go client
2025-09-08 16:45:46 +08:00
William Cheng
6e089f5f03 Support normalizing anyof/oneof enum constraints to a single enum (#21917)
* Support normalizing anyof/oneof enum constraints to a single enum

* Add SIMPLIFY_ONEOF_ANYOF_ENUM to the documentation

* Process referenced schemas with oneof/enum as well

* Implement referenced enum merging from oneof/anyof

* Implement retaining the enum description as x-enum-desriptions for oneof enum

* Update samples and docs with oneOf enum normalization

* update samples to fix python tests

* fix test file name

* fix incorrect filename

---------

Co-authored-by: Pieter Bos <pieter.bos@nedap.com>
2025-09-07 17:36:02 +08:00
William Cheng
e62908e30e Add tests for withXml option in Go client generator (#21913)
* test withXml option

* fix path
2025-09-06 22:48:32 +08:00
William Cheng
6164836b57 update workflow to use jdk 11 (#21912) 2025-09-06 22:35:54 +08:00
2202 changed files with 90975 additions and 13691 deletions

51
.github/workflows/samples-clojure.yaml vendored Normal file
View File

@@ -0,0 +1,51 @@
name: Samples Clojure Client
on:
push:
paths:
- samples/client/petstore/clojure/**
pull_request:
paths:
- samples/client/petstore/clojure/**
jobs:
build:
name: Build Clojure Client (JDK11)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
- samples/client/petstore/clojure/
services:
petstore-api:
image: swaggerapi/petstore
ports:
- 80:8080
env:
SWAGGER_HOST: http://petstore.swagger.io
SWAGGER_BASE_PATH: /v2
steps:
- uses: actions/checkout@v5
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 11
- name: Cache maven dependencies
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
path: |
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Install Leiningen (if using Leiningen)
run: |
curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > lein
chmod +x lein
sudo mv lein /usr/local/bin/
- name: Run tests (Leiningen)
working-directory: ${{ matrix.sample }}
run: lein test

View File

@@ -4,20 +4,24 @@ on:
push:
branches:
paths:
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/**
#- samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/**
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/**
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/**
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/**
- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/**
- samples/openapi3/client/petstore/dart-dio/oneof/**
- samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/**
- samples/openapi3/client/petstore/dart-dio/binary_response/**
- samples/openapi3/client/petstore/dart-dio/petstore-timemachine/**
pull_request:
paths:
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/**
#- samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/**
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/**
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/**
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/**
- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/**
- samples/openapi3/client/petstore/dart-dio/oneof/**
- samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/**
- samples/openapi3/client/petstore/dart-dio/binary_response/**
- samples/openapi3/client/petstore/dart-dio/petstore-timemachine/**
jobs:
test:
@@ -27,12 +31,14 @@ jobs:
os: [ubuntu-latest, windows-latest]
sdk: ["3.9.0"]
sample:
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/
#- samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/
- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/
- samples/openapi3/client/petstore/dart-dio/oneof/
- samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/
- samples/openapi3/client/petstore/dart-dio/binary_response/
- samples/openapi3/client/petstore/dart-dio/petstore-timemachine/
steps:
- uses: actions/checkout@v5

View File

@@ -0,0 +1,37 @@
name: Samples C# .Net Client (Petstore)
on:
push:
paths:
- samples/client/petstore/csharp/restsharp/standard2.0/Petstore/**
pull_request:
paths:
- samples/client/petstore/csharp/restsharp/standard2.0/Petstore/**
jobs:
build:
name: Build clients
runs-on: ubuntu-latest
services:
petstore-api:
image: swaggerapi/petstore
ports:
- 80:8080
env:
SWAGGER_HOST: http://petstore.swagger.io
SWAGGER_BASE_PATH: /v2
strategy:
fail-fast: false
matrix:
sample:
- samples/client/petstore/csharp/restsharp/standard2.0/Petstore/
steps:
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v5.0.0
with:
dotnet-version: '7.0.x'
- name: Build
working-directory: ${{ matrix.sample }}
run: dotnet build Org.OpenAPITools.sln
- name: Test
working-directory: ${{ matrix.sample }}
run: dotnet test Org.OpenAPITools.sln

View File

@@ -0,0 +1,54 @@
name: Samples C# .Net 7 Client
on:
push:
paths:
# the .NET Core 3.0 runtime is no longer supported as it reached its end-of-life on March 3, 2020
#- samples/client/petstore/csharp/httpclient/standard2.0/Petstore/**
- samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/**
- samples/client/petstore/csharp/restsharp/net4.7/Petstore/**
- samples/client/petstore/csharp/restsharp/net4.8/Petstore/**
- samples/client/petstore/csharp/restsharp/net8/ParameterMappings/**
- samples/client/petstore/csharp/restsharp/net8/EnumMappings/**
- samples/client/petstore/csharp/restsharp/net8/Petstore/**
- samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/**
- samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/**
pull_request:
paths:
#- samples/client/petstore/csharp/httpclient/standard2.0/Petstore/**
- samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/**
- samples/client/petstore/csharp/restsharp/net4.7/Petstore/**
- samples/client/petstore/csharp/restsharp/net4.8/Petstore/**
- samples/client/petstore/csharp/restsharp/net8/ParameterMappings/**
- samples/client/petstore/csharp/restsharp/net8/EnumMappings/**
- samples/client/petstore/csharp/restsharp/net8/Petstore/**
- samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/**
- samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/**
jobs:
build:
name: Build clients
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
sample:
#- samples/client/petstore/csharp/httpclient/standard2.0/Petstore/
- samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/
- samples/client/petstore/csharp/restsharp/net4.7/Petstore/
- samples/client/petstore/csharp/restsharp/net4.8/Petstore/
- samples/client/petstore/csharp/restsharp/net8/ParameterMappings/
- samples/client/petstore/csharp/restsharp/net8/EnumMappings/
- samples/client/petstore/csharp/restsharp/net8/Petstore/
- samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/
- samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/
steps:
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v5.0.0
with:
dotnet-version: '7.0.x'
- name: Build
working-directory: ${{ matrix.sample }}
run: dotnet build Org.OpenAPITools.sln
- name: Test
working-directory: ${{ matrix.sample }}
run: dotnet test Org.OpenAPITools.sln

View File

@@ -43,6 +43,7 @@ jobs:
- samples/client/petstore/csharp/restsharp/net9/EnumMappings
# httpclient
- samples/client/petstore/csharp/httpclient/net9/Petstore
- samples/client/petstore/csharp/httpclient/net9/Petstore-nonPublicApi
# unity
#- samples/client/petstore/csharp/unityWebRequest/net9/Petstore
steps:

View File

@@ -0,0 +1,45 @@
name: Samples Go Clients (Petstore)
on:
push:
paths:
- samples/client/petstore/go/**
- samples/openapi3/client/petstore/go/**
pull_request:
paths:
- samples/client/petstore/go/**
- samples/openapi3/client/petstore/go/**
jobs:
build:
name: Build Go
runs-on: ubuntu-latest
services:
petstore-api:
image: swaggerapi/petstore
ports:
- 80:8080
env:
SWAGGER_HOST: http://petstore.swagger.io
SWAGGER_BASE_PATH: /v2
strategy:
fail-fast: false
matrix:
sample:
- samples/client/petstore/go/
- samples/openapi3/client/petstore/go/
steps:
- uses: actions/checkout@v5
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
- uses: actions/setup-go@v6
- run: go version
- name: Install Dependencies
working-directory: ${{ matrix.sample }}
run: |
go mod tidy
- name: Run test
working-directory: ${{ matrix.sample }}
run: go test -mod=mod -v

View File

@@ -4,10 +4,19 @@ on:
push:
paths:
- 'samples/openapi3/client/petstore/go/go-petstore-aws-signature/**'
- 'samples/openapi3/client/petstore/go-petstore-withXml/**'
- samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/**
- samples/client/others/go/allof_multiple_ref_and_discriminator/**
- samples/client/others/go/oneof-anyof-required/**
- samples/client/others/go/oneof-discriminator-lookup/**
pull_request:
paths:
- 'samples/openapi3/client/petstore/go/go-petstore-aws-signature/**'
- 'samples/openapi3/client/petstore/go-petstore-withXml/**'
- samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/**
- samples/client/others/go/allof_multiple_ref_and_discriminator/**
- samples/client/others/go/oneof-anyof-required/**
- samples/client/others/go/oneof-discriminator-lookup/**
jobs:
build:
name: Build Go
@@ -17,6 +26,11 @@ jobs:
matrix:
sample:
- 'samples/openapi3/client/petstore/go/go-petstore-aws-signature/'
- 'samples/openapi3/client/petstore/go-petstore-withXml/'
- samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/
- samples/client/others/go/allof_multiple_ref_and_discriminator/
- samples/client/others/go/oneof-anyof-required/
- samples/client/others/go/oneof-discriminator-lookup/
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6

View File

@@ -17,6 +17,10 @@ on:
- samples/client/petstore/java/webclient-useSingleRequestParameter/**
- samples/client/others/java/jersey2-oneOf-duplicates/**
- samples/client/others/java/jersey2-oneOf-Mixed/**
- samples/client/petstore/java/jersey3-oneOf/**
- samples/client/others/java/okhttp-gson-streaming/**
- samples/client/others/java/resteasy/**
- samples/client/others/java/apache-httpclient/**
- samples/client/others/java/resttemplate-list-schema-validation/**
- samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/**
pull_request:
@@ -35,6 +39,10 @@ on:
- samples/client/petstore/java/webclient-useSingleRequestParameter/**
- samples/client/others/java/jersey2-oneOf-duplicates/**
- samples/client/others/java/jersey2-oneOf-Mixed/**
- samples/client/petstore/java/jersey3-oneOf/**
- samples/client/others/java/okhttp-gson-streaming/**
- samples/client/others/java/resteasy/**
- samples/client/others/java/apache-httpclient/**
- samples/client/others/java/resttemplate-list-schema-validation/**
- samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/**
jobs:
@@ -97,6 +105,10 @@ jobs:
- samples/client/others/java/jersey2-oneOf-Mixed/
- samples/client/others/java/resttemplate-list-schema-validation/
- samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/
- samples/client/petstore/java/jersey3-oneOf/
- samples/client/others/java/okhttp-gson-streaming/
- samples/client/petstore/java/resteasy/
- samples/client/petstore/java/apache-httpclient/
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5

View File

@@ -0,0 +1,39 @@
name: Samples Java Dubbo
on:
push:
paths:
- 'samples/server/petstore/java-dubbo/**'
pull_request:
paths:
- 'samples/server/petstore/java-dubbo/**'
jobs:
build:
name: Build Java Dubbo
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# servers
- samples/server/petstore/java-dubbo
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
- name: Cache maven dependencies
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
path: |
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Build
working-directory: ${{ matrix.sample }}
run: mvn clean package --no-transfer-progress -DskipTests
# add -DskipTests as the app compiles but fails to start
#run: mvn clean package --no-transfer-progress

View File

@@ -0,0 +1,65 @@
# run java client tests with petstore server
name: Samples Java Petsore Client JDK11
on:
push:
paths:
- samples/client/petstore/java/jersey2-java8/**
- samples/openapi3/client/petstore/java/jersey2-java8/**
- samples/client/petstore/java/jersey3/**
- samples/client/petstore/java/okhttp-gson/**
- samples/client/petstore/java/okhttp-gson-3.1/**
- samples/client/petstore/java/okhttp-gson-dynamicOperations/**
- samples/client/petstore/java-micronaut-client/**
pull_request:
paths:
- samples/client/petstore/java/jersey2-java8/**
- samples/openapi3/client/petstore/java/jersey2-java8/**
- samples/client/petstore/java/jersey3/**
- samples/client/petstore/java/okhttp-gson/**
- samples/client/petstore/java/okhttp-gson-3.1/**
- samples/client/petstore/java/okhttp-gson-dynamicOperations/**
- samples/client/petstore/java-micronaut-client/**
jobs:
build:
name: Build Java Client JDK11
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
- samples/client/petstore/java/jersey2-java8
- samples/openapi3/client/petstore/java/jersey2-java8
- samples/client/petstore/java/jersey3
- samples/client/petstore/java/okhttp-gson
- samples/client/petstore/java/okhttp-gson-3.1
- samples/client/petstore/java/okhttp-gson-dynamicOperations
- samples/client/petstore/java-micronaut-client
services:
petstore-api:
image: swaggerapi/petstore
ports:
- 80:8080
env:
SWAGGER_HOST: http://petstore.swagger.io
SWAGGER_BASE_PATH: /v2
steps:
- uses: actions/checkout@v5
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 11
- name: Cache maven dependencies
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
path: |
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Build with Maven
working-directory: ${{ matrix.sample }}
run: mvn clean package --no-transfer-progress

38
.github/workflows/samples-java-sbt.yaml vendored Normal file
View File

@@ -0,0 +1,38 @@
name: Samples Java (sbt)
on:
push:
paths:
- 'samples/client/petstore/java/okhttp-gson/**'
pull_request:
paths:
- 'samples/client/petstore/java/okhttp-gson/**'
jobs:
build:
name: Build sbt/Java client, servers
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# clients
- samples/client/petstore/java/okhttp-gson
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 11
- name: Setup sbt launcher
uses: sbt/setup-sbt@v1
- name: Cache maven dependencies
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
path: |
~/.ivy2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/build.sbt') }}
- name: Build and test
working-directory: ${{ matrix.sample }}
run: sbt -v +test

View File

@@ -42,7 +42,7 @@ jobs:
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 8
java-version: 11
- name: Cache maven dependencies
uses: actions/cache@v4
env:

View File

@@ -38,6 +38,7 @@ jobs:
- samples/server/petstore/kotlin-springboot-source-swagger1
- samples/server/petstore/kotlin-springboot-source-swagger2
- samples/server/petstore/kotlin-springboot-springfox
- samples/server/petstore/kotlin-springboot-x-kotlin-implements
- samples/server/petstore/kotlin-server/ktor
- samples/server/petstore/kotlin-server/ktor2
- samples/server/petstore/kotlin-server/jaxrs-spec

View File

@@ -0,0 +1,40 @@
name: Samples PowerShell
on:
push:
paths:
- samples/client/petstore/powershell/**
pull_request:
paths:
- samples/client/petstore/powershell/**
jobs:
build:
runs-on: ubuntu-latest
name: Test Powershell Clients
strategy:
matrix:
sample:
- samples/client/petstore/powershell/
services:
petstore-api:
image: swaggerapi/petstore
ports:
- 80:8080
env:
SWAGGER_HOST: http://petstore.swagger.io
SWAGGER_BASE_PATH: /v2
steps:
- uses: actions/checkout@v5
- name: Build the client
working-directory: ${{ matrix.sample }}
shell: pwsh
run: |
./Build.ps1
- name: Test
working-directory: ${{ matrix.sample }}
shell: pwsh
run: |
Import-Module -Name './src/PSPetstore'
Invoke-Pester -PassThru

View File

@@ -35,6 +35,7 @@ jobs:
sample:
- samples/openapi3/client/petstore/python-aiohttp
- samples/openapi3/client/petstore/python
- samples/openapi3/client/petstore/python-lazyImports
services:
petstore-api:
image: swaggerapi/petstore

View File

@@ -0,0 +1,43 @@
name: Samples Ruby
on:
push:
paths:
- 'samples/client/echo_api/ruby-httpx/**'
- 'samples/client/echo_api/ruby-faraday/**'
- 'samples/client/echo_api/ruby-typhoeus/**'
pull_request:
paths:
- 'samples/client/echo_api/ruby-httpx/**'
- 'samples/client/echo_api/ruby-faraday/**'
- 'samples/client/echo_api/ruby-typhoeus/**'
jobs:
build:
name: Build Ruby
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
- 'samples/client/echo_api/ruby-httpx/'
- 'samples/client/echo_api/ruby-faraday/'
- 'samples/client/echo_api/ruby-typhoeus/'
steps:
- uses: actions/checkout@v5
- name: Setup node.js
uses: actions/setup-node@v5
- 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 &)
- uses: actions/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Install bundle
working-directory: ${{ matrix.sample }}
run: bundle install
- name: Run rspec
working-directory: ${{ matrix.sample }}
run: rspec

View File

@@ -1,16 +1,18 @@
name: Samples Ruby
name: Samples Ruby
on:
push:
paths:
- 'samples/client/echo_api/ruby-httpx/**'
- 'samples/client/echo_api/ruby-faraday/**'
- 'samples/client/echo_api/ruby-typhoeus/**'
- samples/client/petstore/ruby/**
- samples/client/petstore/ruby-faraday/**
- samples/client/petstore/ruby-httpx/**
- samples/client/petstore/ruby-autoload/**
pull_request:
paths:
- 'samples/client/echo_api/ruby-httpx/**'
- 'samples/client/echo_api/ruby-faraday/**'
- 'samples/client/echo_api/ruby-typhoeus/**'
- samples/client/petstore/ruby/**
- samples/client/petstore/ruby-faraday/**
- samples/client/petstore/ruby-httpx/**
- samples/client/petstore/ruby-autoload/**
jobs:
build:
@@ -20,21 +22,28 @@ jobs:
fail-fast: false
matrix:
sample:
- 'samples/client/echo_api/ruby-httpx/'
- 'samples/client/echo_api/ruby-faraday/'
- 'samples/client/echo_api/ruby-typhoeus/'
- samples/client/petstore/ruby/
#- samples/client/petstore/ruby-faraday/
#- samples/client/petstore/ruby-httpx/
#- samples/client/petstore/ruby-autoload/
services:
petstore-api:
image: swaggerapi/petstore
ports:
- 80:8080
env:
SWAGGER_HOST: http://petstore.swagger.io
SWAGGER_BASE_PATH: /v2
steps:
- uses: actions/checkout@v5
- name: Setup node.js
uses: actions/setup-node@v5
- 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 &)
- uses: actions/setup-ruby@v1
#- name: Add hosts to /etc/hosts
# run: |
# sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
# cat /etc/hosts
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
bundler-cache: true
ruby-version: '3.4' # Not needed with a .ruby-version, .tool-versions or mise.toml
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Install bundle
working-directory: ${{ matrix.sample }}
run: bundle install

View File

@@ -0,0 +1,70 @@
name: Samples Scala/sbt client
on:
push:
paths:
- samples/client/petstore/scalaz/**
- samples/client/petstore/scala-pekko/**
- samples/client/petstore/scala-http4s/**
- samples/client/petstore/scala-sttp4-jsoniter/**
- samples/client/petstore/scala-akka/**
- samples/client/petstore/scala-sttp/**
- samples/client/petstore/scala-sttp-circe/**
- samples/client/petstore/scala-sttp4/**
pull_request:
paths:
- samples/client/petstore/scalaz/**
- samples/client/petstore/scala-pekko/**
- samples/client/petstore/scala-http4s/**
- samples/client/petstore/scala-sttp4-jsoniter/**
- samples/client/petstore/scala-akka/**
- samples/client/petstore/scala-sttp/**
- samples/client/petstore/scala-sttp-circe/**
- samples/client/petstore/scala-sttp4/**
jobs:
build:
name: Build sbt/Scala
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# clients
- samples/client/petstore/scalaz
- samples/client/petstore/scala-pekko
- samples/client/petstore/scala-http4s
- samples/client/petstore/scala-sttp4-jsoniter
- samples/client/petstore/scala-akka
- samples/client/petstore/scala-sttp
- samples/client/petstore/scala-sttp-circe
- samples/client/petstore/scala-sttp4
services:
petstore-api:
image: swaggerapi/petstore
ports:
- 80:8080
env:
SWAGGER_HOST: http://petstore.swagger.io
SWAGGER_BASE_PATH: /v2
steps:
- uses: actions/checkout@v5
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 11
- name: Setup sbt launcher
uses: sbt/setup-sbt@v1
- name: Cache maven dependencies
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
path: |
~/.ivy2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/build.sbt') }}
- name: Build and test
working-directory: ${{ matrix.sample }}
run: sbt -v test

View File

@@ -1,34 +1,21 @@
name: Samples Scala/sbt
name: Samples Scala/sbt server
on:
push:
paths:
- 'samples/client/petstore/scala**'
- 'samples/server/petstore/scala**'
- 'samples/client/petstore/java/okhttp-gson/**'
pull_request:
paths:
- 'samples/client/petstore/scala**'
- 'samples/server/petstore/scala**'
- 'samples/client/petstore/java/okhttp-gson/**'
jobs:
build:
name: Build sbt/Scala client, servers
name: Build sbt/Scala
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# clients
- samples/client/petstore/java/okhttp-gson
- samples/client/petstore/scalaz
- samples/client/petstore/scala-pekko
- samples/client/petstore/scala-http4s
- samples/client/petstore/scala-sttp4-jsoniter
#- samples/client/petstore/scala-sttp
#- samples/client/petstore/scala-sttp-circe
# servers
- samples/server/petstore/scala-lagom-server
- samples/server/petstore/scala-play-server
- samples/server/petstore/scala-akka-http-server
- samples/server/petstore/scala-pekko-http-server

View File

@@ -11,6 +11,7 @@ on:
- samples/server/petstore/springboot-file-delegate-optional
- samples/server/petstore/springboot-petstore-with-api-response-examples
- samples/server/petstore/spring-boot-oneof-sealed
- samples/openapi3/server/petstore/spring-boot-oneof-interface
pull_request:
paths:
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
@@ -21,6 +22,7 @@ on:
- samples/server/petstore/springboot-file-delegate-optional
- samples/server/petstore/springboot-petstore-with-api-response-examples
- samples/server/petstore/spring-boot-oneof-sealed
- samples/openapi3/server/petstore/spring-boot-oneof-interface
jobs:
build:
name: Build Java Spring (JDK17)
@@ -39,6 +41,7 @@ jobs:
- samples/server/petstore/springboot-file-delegate-optional
- samples/server/petstore/springboot-petstore-with-api-response-examples
- samples/server/petstore/spring-boot-oneof-sealed
- samples/openapi3/server/petstore/spring-boot-oneof-interface
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5

View File

@@ -60,6 +60,7 @@ jobs:
- samples/server/petstore/springboot-spring-provide-args
- samples/server/petstore/springboot-useoptional
- samples/server/petstore/springboot-virtualan
- samples/openapi3/server/petstore/spring-boot-oneof-interface
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5

1
.gitignore vendored
View File

@@ -16,6 +16,7 @@ modules/openapi-generator-gradle-plugin/bin/
.classpath
lib/*
build/*
.kotlin
generated-files/*
generated-sources/*
generated-code/*

View File

@@ -1,37 +0,0 @@
sudo: required
language: java
jdk:
- openjdk8
cache:
directories:
- $HOME/.m2
- $HOME/.ivy2
services:
- docker
addons:
hosts:
- petstore.swagger.io
before_install:
# to run petstore server locally via docker
- 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
# Add bats test framework and cURL for Bash script integration tests
- sudo add-apt-repository ppa:duggan/bats --yes
- sudo apt-get update -qq
- sudo apt-get install -qq bats
- sudo apt-get install -qq curl
# show host table to confirm petstore.swagger.io is mapped to localhost
- cat /etc/hosts
script:
# fail fast
- set -e
# run integration tests defined in maven pom.xml
- cp pom.xml.bash pom.xml
- mvn --no-snapshot-updates --batch-mode verify -Psamples

View File

@@ -56,11 +56,6 @@ elif [ "$NODE_INDEX" = "2" ]; then
sudo ./setup-cpp-x64-linux --compiler llvm --cmake true --ninja true
source ~/.cpprc # activate cpp environment variables
# run go integration tests
(cd samples/client/petstore/go && mvn integration-test)
(cd samples/openapi3/client/petstore/go && mvn integration-test)
(cd samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false && mvn integration-test)
(cd samples/client/others/go/allof_multiple_ref_and_discriminator && mvn integration-test)
(cd samples/client/petstore/cpp-restsdk/client && mvn integration-test)
elif [ "$NODE_INDEX" = "3" ]; then
@@ -121,22 +116,4 @@ else
echo "Running node $NODE_INDEX ..."
java -version
(cd samples/client/petstore/scala-akka && mvn integration-test)
(cd samples/client/petstore/scala-sttp && mvn integration-test)
(cd samples/client/petstore/scala-sttp-circe && mvn integration-test)
(cd samples/client/petstore/scala-sttp4 && mvn integration-test)
(cd samples/client/petstore/clojure && mvn integration-test)
(cd samples/client/petstore/java/jersey2-java8 && mvn integration-test)
(cd samples/openapi3/client/petstore/java/jersey2-java8 && mvn integration-test)
(cd samples/client/petstore/java/jersey3 && mvn integration-test)
(cd samples/client/petstore/java/jersey3-oneOf && mvn integration-test)
(cd samples/client/others/java/okhttp-gson-streaming && mvn integration-test)
(cd samples/client/petstore/java/okhttp-gson && mvn integration-test)
(cd samples/client/petstore/java/okhttp-gson-3.1 && mvn integration-test)
(cd samples/client/petstore/java/okhttp-gson-dynamicOperations && mvn integration-test)
(cd samples/client/petstore/java/resteasy && mvn integration-test)
(cd samples/client/petstore/java-micronaut-client && mvn integration-test)
(cd samples/client/petstore/java/apache-httpclient && mvn integration-test)
(cd samples/client/petstore/java/resttemplate-jakarta && mvn integration-test)
fi

View File

@@ -16,9 +16,7 @@
<div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.16.0`):
[![Build Status](https://api.travis-ci.com/OpenAPITools/openapi-generator.svg?branch=master&status=passed)](https://app.travis-ci.com/github/OpenAPITools/openapi-generator/builds)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
[![Bitrise](https://img.shields.io/bitrise/4a2b10a819d12b67/master?label=bitrise%3A%20Swift+4,5&token=859FMDR8QHwabCzwvZK6vQ)](https://app.bitrise.io/app/4a2b10a819d12b67)
</div>
@@ -1143,6 +1141,7 @@ Here is a list of template creators:
* Haskell Servant: @algas
* Haskell Yesod: @yotsuya
* Java Camel: @carnevalegiacomo
* Java Dubbo: @redoom
* Java MSF4J: @sanjeewa-malalgoda
* Java Spring Boot: @diyfr
* Java Undertow: @stevehu
@@ -1259,7 +1258,7 @@ If you want to join the committee, please kindly apply by sending an email to te
| JMeter | @kannkyo (2021/01) |
| Jetbrains HTTP Client | @jlengrand (2023/01) |
| Julia | @tanmaykm (2023/01) |
| Kotlin | @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) @stefankoppier (2022/06) @e5l (2024/10) |
| Kotlin | @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) @stefankoppier (2022/06) @e5l (2024/10) |
| Lua | @daurnimator (2017/08) |
| N4JS | @mmews-n4 (2023/03) |
| Nim | |

View File

@@ -1,119 +0,0 @@
version: '{branch}-{build}'
image: Visual Studio 2022
hosts:
petstore.swagger.io: 127.0.0.1
install:
- cmd: SET PATH=C:\maven\apache-maven-3.8.3\bin;C:\gradle\gradle-7.6\bin;%JAVA_HOME%\bin;%PATH%
- cmd: SET MAVEN_OPTS=-Xmx4g
- cmd: SET JAVA_OPTS=-Xmx4g
- cmd: SET M2_HOME=C:\maven\apache-maven-3.8.3
- cmd: java -version
- cmd: dir/w
- cmd: docker pull swaggerapi/petstore
- cmd: docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
- ps: Start-Sleep -s 120
- ps: $PSVersionTable.PSVersion
- ps: Install-Module -Name Pester -Force -Scope CurrentUser -SkipPublisherCheck
build_script:
- dotnet --info
# build C# aspnetcore 5.0 server
#- dotnet build samples\server\petstore\aspnetcore-5.0\Org.OpenAPITools.sln
## build C# aspnetcore 3.1 server
#- dotnet build samples\server\petstore\aspnetcore-3.1\Org.OpenAPITools.sln
## build C# aspnetcore 3.0 server
#- dotnet build samples\server\petstore\aspnetcore-3.0\Org.OpenAPITools.sln
## build C# aspnetcore 2.2 server
#- dotnet build samples\server\petstore\aspnetcore\Org.OpenAPITools.sln
## build C# API client (multiple frameworks)
#- dotnet build samples\client\petstore\csharp\OpenAPIClientCoreAndNet47\Org.OpenAPITools.sln
## build C# API client (httpclient)
#- dotnet build samples\client\petstore\csharp\OpenAPIClient-httpclient\Org.OpenAPITools.sln
## build C# API client (generichost)
#- dotnet build samples\client\petstore\csharp\OpenAPIClient-generichost-netstandard2.0\Org.OpenAPITools.sln
## build C# API client (netcore)
#- dotnet build samples\client\petstore\csharp\OpenAPIClient\Org.OpenAPITools.sln
#- dotnet build samples\client\petstore\csharp\OpenAPIClientCore\Org.OpenAPITools.sln
## build C# API client (.net framework 4.7)
#- dotnet build samples\client\petstore\csharp\OpenAPIClient-net47\Org.OpenAPITools.sln
## build C# API client (.net framework 4.8)
#- dotnet build samples\client\petstore\csharp\OpenAPIClient-net48\Org.OpenAPITools.sln
## build C# API client (.net 5.0)
#- dotnet build samples\client\petstore\csharp\OpenAPIClient-net5.0\Org.OpenAPITools.sln
## build C# API client (.net 5.0 with ConditionalSerialization)
#- dotnet build samples\client\petstore\csharp\OpenAPIClient-ConditionalSerialization\Org.OpenAPITools.sln
test_script:
- dotnet test samples\client\petstore\csharp\generichost\latest\ComposedEnum\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\latest\InlineEnumAnyOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\latest\Tags\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\latest\HelloWorld\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\latest\OneOfList\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net9\AllOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net9\AnyOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net9\AnyOfNoCompare\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net9\FormModels\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
# - dotnet test samples\client\petstore\csharp\generichost\net9\ManualSourceGenerationTests\ManualTests.Latest.UseSourceGeneration\ManualTests.Latest.UseSourceGeneration.csproj
# - dotnet test samples\client\petstore\csharp\generichost\net9\ManualPetstoreTests\OpenAPIClient-generichost-manual-tests\OpenAPIClient-generichost-manual-tests.csproj
- dotnet test samples\client\petstore\csharp\generichost\net9\NullReferenceTypes\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net9\OneOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net9\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net9\SourceGeneration\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net9\UseDateTimeForDate\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net8\AllOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net8\AnyOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net8\AnyOfNoCompare\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net8\FormModels\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net8\ManualSourceGenerationTests\ManualTests.Latest.UseSourceGeneration\ManualTests.Latest.UseSourceGeneration.csproj
- dotnet test samples\client\petstore\csharp\generichost\net8\ManualPetstoreTests\OpenAPIClient-generichost-manual-tests\OpenAPIClient-generichost-manual-tests.csproj
- dotnet test samples\client\petstore\csharp\generichost\net8\NullReferenceTypes\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net8\OneOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net8\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net8\SourceGeneration\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net8\UseDateTimeForDate\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\standard2.0\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.8\AllOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.8\AnyOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.8\AnyOfNoCompare\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.8\FormModels\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.8\OneOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.8\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.8\UseDateTimeForDate\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.7\AllOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.7\AnyOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.7\AnyOfNoCompare\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.7\FormModels\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.7\OneOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.7\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\generichost\net4.7\UseDateTimeForDate\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\httpclient\standard2.0\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\restsharp\net4.7\MultipleFrameworks\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\restsharp\net4.7\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\restsharp\net4.8\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\restsharp\net8\ParameterMappings\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\restsharp\net8\EnumMappings\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\restsharp\net8\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\restsharp\net8\UseDateTimeForDate\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\restsharp\standard2.0\ConditionalSerialization\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\restsharp\standard2.0\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
### TODO: Execute all generators via powershell or other
# generate all petstore clients
# - .\bin\windows\run-all-petstore.cmd
# generate all petstore clients (openapi3)
# - .\bin\openapi3\windows\run-all-petstore.cmd
# test ps petstore
- ps: |
cd samples\client\petstore\powershell\
.\CIRunTest.ps1
cache:
- C:\maven\
- C:\gradle\
- C:\Users\appveyor\.m2

View File

@@ -0,0 +1,14 @@
# for .net standard httpclient
generatorName: csharp
outputDir: samples/client/petstore/csharp/httpclient/net9/Petstore-nonPublicApi
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-addpet-only.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
library: httpclient
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
useCompareNetObjects: true
disallowAdditionalPropertiesIfNotPresent: false
useOneOfDiscriminatorLookup: true
targetFramework: net9.0
equatable: true
nonPublicApi: true

View File

@@ -2,7 +2,7 @@
generatorName: csharp
library: restsharp
outputDir: samples/client/petstore/csharp/restsharp/standard2.0/Petstore
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-oneof-primitive-types.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-oneof-primitive-types-localhost.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'

View File

@@ -0,0 +1,14 @@
generatorName: dart-dio
outputDir: samples/openapi3/client/petstore/dart-dio/petstore-timemachine
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
typeMappings:
Client: "ModelClient"
File: "ModelFile"
EnumClass: "ModelEnumClass"
additionalProperties:
hideGenerationTimestamp: "true"
enumUnknownDefaultCase: "true"
dateLibrary: "timemachine"
reservedWordsMappings:
class: "classField"

View File

@@ -1,6 +1,6 @@
generatorName: go
outputDir: samples/client/petstore/go/go-petstore
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-localhost.yaml
templateDir: modules/openapi-generator/src/main/resources/go
additionalProperties:
packageName: petstore

View File

@@ -0,0 +1,9 @@
generatorName: go
outputDir: samples/openapi3/client/petstore/go-petstore-withXml
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-addpet-only.yaml
templateDir: modules/openapi-generator/src/main/resources/go
additionalProperties:
enumClassPrefix: "true"
packageName: petstore
disallowAdditionalPropertiesIfNotPresent: false
withXml: true

View File

@@ -0,0 +1,15 @@
generatorName: java-dubbo
outputDir: samples/server/petstore/java-dubbo
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/java-dubbo
additionalProperties:
hideGenerationTimestamp: "true"
artifactId: openapi-dubbo-server-petstore
basePackage: "org.openapitools.example"
title: "OpenAPI Petstore"
serviceInterface: true
serviceImplementation: true
useTags: true
dubboVersion: "3.2.18"
javaVersion: "17"
registryAddress: "zookeeper://127.0.0.1:2181"

View File

@@ -1,7 +1,7 @@
generatorName: kotlin
outputDir: samples/client/petstore/kotlin-jvm-ktor-gson
library: jvm-ktor
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
additionalProperties:
artifactId: kotlin-petstore-jvm-ktor-gson

View File

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

View File

@@ -0,0 +1,18 @@
generatorName: python
outputDir: samples/openapi3/client/petstore/python-lazyImports
inputSpec: modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/python
additionalProperties:
packageName: petstore_api
useOneOfDiscriminatorLookup: "true"
disallowAdditionalPropertiesIfNotPresent: false
mapNumberTo: StrictFloat
lazyImports: 'true'
nameMappings:
_type: underscore_type
type_: type_with_underscore
modelNameMappings:
# The OpenAPI spec ApiResponse conflicts with the internal ApiResponse
ApiResponse: ModelApiResponse
openapiNormalizer:
SIMPLIFY_ONEOF_ANYOF_ENUM: false

View File

@@ -13,3 +13,5 @@ additionalProperties:
nameMappings:
_type: underscore_type
type_: type_with_underscore
openapiNormalizer:
SIMPLIFY_ONEOF_ANYOF_ENUM: false

View File

@@ -13,3 +13,5 @@ nameMappings:
modelNameMappings:
# The OpenAPI spec ApiResponse conflicts with the internal ApiResponse
ApiResponse: ModelApiResponse
openapiNormalizer:
SIMPLIFY_ONEOF_ANYOF_ENUM: false

View File

@@ -1,7 +1,7 @@
generatorName: ruby
outputDir: samples/client/petstore/ruby-faraday
library: faraday
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/ruby/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/ruby-client
additionalProperties:
gemVersion: 1.0.0

View File

@@ -0,0 +1,12 @@
generatorName: spring
outputDir: samples/openapi3/server/petstore/spring-boot-oneof-interface
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
groupId: org.openapitools.openapi3
documentationProvider: springdoc
artifactId: springboot-oneof
snapshotVersion: "true"
hideGenerationTimestamp: "true"
useOneOfInterfaces: "true"
useDeductionForOneOfInterfaces: "true"

View File

@@ -1,6 +0,0 @@
systemProperties:
skipFormModel: "true"
generatorName: scala-lagom-server
outputDir: samples/server/petstore/scala-lagom-server
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/scala-lagom-server

View File

@@ -564,6 +564,15 @@ Example:
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/simplifyAnyOfStringAndEnumString_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING=true
```
- `SIMPLIFY_ONEOF_ANYOF_ENUM`: when set to true, oneOf/anyOf with only enum sub-schemas all containing enum values will be converted to a single enum
This is enabled by default
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/simplifyOneOfWithEnums_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer SIMPLIFY_ONEOF_ANYOF_ENUM=true
```
- `SIMPLIFY_BOOLEAN_ENUM`: when set to `true`, convert boolean enum to just enum.
Example:

View File

@@ -106,6 +106,7 @@ The following generators are available:
* [haskell](generators/haskell.md)
* [haskell-yesod (beta)](generators/haskell-yesod.md)
* [java-camel](generators/java-camel.md)
* [java-dubbo (beta)](generators/java-dubbo.md)
* [java-helidon-server (beta)](generators/java-helidon-server.md)
* [java-inflector](generators/java-inflector.md)
* [java-micronaut-server (beta)](generators/java-micronaut-server.md)
@@ -150,7 +151,7 @@ The following generators are available:
* [scala-cask](generators/scala-cask.md)
* [scala-finch](generators/scala-finch.md)
* [scala-http4s-server](generators/scala-http4s-server.md)
* [scala-lagom-server](generators/scala-lagom-server.md)
* [scala-lagom-server-deprecated (deprecated)](generators/scala-lagom-server-deprecated.md)
* [scala-play-server](generators/scala-play-server.md)
* [scalatra](generators/scalatra.md)
* [spring](generators/spring.md)

View File

@@ -99,6 +99,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|title|server title name or client service name| |OpenAPI Spring|
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useDeductionForOneOfInterfaces|whether to use deduction for generated oneOf interfaces| |false|
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
|useFeignClientContextId|Whether to generate Feign client with contextId parameter.| |true|
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|

View File

@@ -0,0 +1,351 @@
---
title: Documentation for the java-dubbo Generator
---
## METADATA
| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | java-dubbo | pass this to the generate command after -g |
| generator stability | BETA | |
| generator type | SERVER | |
| generator language | Java | |
| generator default templating engine | mustache | |
| helpTxt | Generates a Java Apache Dubbo server application. | |
## 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 |
| ------ | ----------- | ------ | ------- |
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|additionalOneOfTypeAnnotations|Additional annotations for oneOf interfaces(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |org.openapitools.api|
|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-dubbo|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename. If not provided, uses the version from the OpenAPI specification file. If that's also not present, uses the default value of the artifactVersion option.| |1.0.0|
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|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|
|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|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
|developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org|
|disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
|dubboVersion|Dubbo version| |3.2.18|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE|
|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|
|generateBuilders|Whether to generate builders for models| |false|
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
|groupId|groupId in generated pom.xml| |org.openapitools|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
|implicitHeaders|Skip header parameters in the generated API methods using @ApiImplicitParams annotation.| |false|
|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|invokerPackage|root package for generated code| |org.openapitools|
|javaVersion|Java version| |17|
|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|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model|
|openApiNullable|Enable OpenAPI Jackson Nullable library. Not supported by `microprofile` library.| |true|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|registry-address|Registry address (e.g., zookeeper://127.0.0.1:2181 or nacos://127.0.0.1:8848)| |zookeeper://127.0.0.1:2181|
|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|serializableModel|boolean - toggle &quot;implements Serializable&quot; for generated models| |false|
|serviceImplementation|Generate service implementation| |true|
|serviceInterface|Generate service interface| |true|
|snapshotVersion|Uses a SNAPSHOT version.|<dl><dt>**true**</dt><dd>Use a SnapShot Version</dd><dt>**false**</dt><dd>Use a Release Version</dd></dl>|null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/main/java|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|title|API title name| |null|
|useGenericResponse|Use generic response wrapper| |false|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false|
|useTags|use tags for creating interface and controller classnames| |true|
|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
| Extension name | Description | Applicable for | Default value |
| -------------- | ----------- | -------------- | ------------- |
|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL|
|x-implements|Ability to specify interfaces that model must implements|MODEL|empty array
|x-setter-extra-annotation|Custom annotation that can be specified over java setter for specific field|FIELD|When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value
|x-tags|Specify multiple swagger tags for operation|OPERATION|null
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
|Array|java.util.List|
|ArrayList|java.util.ArrayList|
|Arrays|java.util.Arrays|
|BigDecimal|java.math.BigDecimal|
|BigInteger|java.math.BigInteger|
|Date|java.util.Date|
|DateTime|org.joda.time.*|
|File|java.io.File|
|HashMap|java.util.HashMap|
|HashSet|java.util.HashSet|
|LinkedHashSet|java.util.LinkedHashSet|
|List|java.util.List|
|LocalDate|java.time.LocalDate|
|LocalDateTime|java.time.LocalDateTime|
|LocalTime|java.time.LocalTime|
|Map|java.util.Map|
|MultipartFile|org.springframework.web.multipart.MultipartFile|
|OffsetDateTime|java.time.OffsetDateTime|
|Set|java.util.Set|
|Timestamp|java.sql.Timestamp|
|URI|java.net.URI|
|UUID|java.util.UUID|
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|ArrayList|
|map|HashMap|
|set|LinkedHashSet|
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Boolean</li>
<li>Double</li>
<li>Float</li>
<li>Integer</li>
<li>List</li>
<li>Long</li>
<li>Map</li>
<li>Object</li>
<li>Set</li>
<li>String</li>
<li>boolean</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>_</li>
<li>abstract</li>
<li>apiclient</li>
<li>apiexception</li>
<li>apiresponse</li>
<li>assert</li>
<li>boolean</li>
<li>break</li>
<li>byte</li>
<li>case</li>
<li>catch</li>
<li>char</li>
<li>class</li>
<li>configuration</li>
<li>const</li>
<li>continue</li>
<li>default</li>
<li>do</li>
<li>double</li>
<li>else</li>
<li>enum</li>
<li>extends</li>
<li>file</li>
<li>final</li>
<li>finally</li>
<li>float</li>
<li>for</li>
<li>goto</li>
<li>if</li>
<li>implements</li>
<li>import</li>
<li>instanceof</li>
<li>int</li>
<li>interface</li>
<li>list</li>
<li>localdate</li>
<li>localreturntype</li>
<li>localtime</li>
<li>localvaraccept</li>
<li>localvaraccepts</li>
<li>localvarauthnames</li>
<li>localvarcollectionqueryparams</li>
<li>localvarcontenttype</li>
<li>localvarcontenttypes</li>
<li>localvarcookieparams</li>
<li>localvarformparams</li>
<li>localvarheaderparams</li>
<li>localvarpath</li>
<li>localvarpostbody</li>
<li>localvarqueryparams</li>
<li>long</li>
<li>native</li>
<li>new</li>
<li>null</li>
<li>object</li>
<li>offsetdatetime</li>
<li>package</li>
<li>private</li>
<li>protected</li>
<li>public</li>
<li>return</li>
<li>short</li>
<li>static</li>
<li>strictfp</li>
<li>stringutil</li>
<li>super</li>
<li>switch</li>
<li>synchronized</li>
<li>this</li>
<li>throw</li>
<li>throws</li>
<li>transient</li>
<li>try</li>
<li>void</li>
<li>volatile</li>
<li>while</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✓|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Uuid|✗|
|Array|✓|OAS2,OAS3
|Null|✗|OAS3
|AnyType|✗|OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✗|OAS3
|allOf|✗|OAS2,OAS3
|anyOf|✗|OAS3
|oneOf|✗|OAS3
|not|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✓|OAS2,OAS3
|OAuth2_ClientCredentials|✓|OAS2,OAS3
|OAuth2_AuthorizationCode|✓|OAS2,OAS3
|SignatureAuth|✗|OAS3
|AWSV4Signature|✗|ToolingExtension
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✓|OAS2,OAS3

View File

@@ -64,6 +64,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|returnJBossResponse|Whether generate API interface should return `org.jboss.resteasy.reactive.RestResponse` instead of a deserialized entity. This flag cannot be combined with `returnResponse` flag. It requires the flag `interfaceOnly` and `useJakartaEE` set to true, because `org.jboss.resteasy.reactive.RestResponse` was introduced in Quarkus 2.x| |false|
|returnResponse|Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.| |false|
|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|

View File

@@ -22,6 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|additionalOneOfTypeAnnotations|Additional annotations for oneOf interfaces(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|annotationLibrary|Select the complementary documentation annotation library.|<dl><dt>**none**</dt><dd>Do not annotate Model and Api with complementary annotations.</dd><dt>**swagger1**</dt><dd>Annotate Model and Api using the Swagger Annotations 1.x library.</dd><dt>**swagger2**</dt><dd>Annotate Model and Api using the Swagger Annotations 2.x library.</dd></dl>|swagger1|
|apiPackage|package for generated api classes| |org.openapitools.api|
|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-client|
@@ -39,6 +40,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
|documentationProvider|Select the OpenAPI documentation provider.|<dl><dt>**none**</dt><dd>Do not publish an OpenAPI specification.</dd><dt>**swagger1**</dt><dd>Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using Swagger-Core 1.x.</dd><dt>**swagger2**</dt><dd>Generate an OpenAPI 3 specification using Swagger-Core 2.x.</dd></dl>|swagger1|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE|
|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|

View File

@@ -23,6 +23,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|additionalOneOfTypeAnnotations|Additional annotations for oneOf interfaces(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|annotationLibrary|Select the complementary documentation annotation library.|<dl><dt>**none**</dt><dd>Do not annotate Model and Api with complementary annotations.</dd><dt>**swagger1**</dt><dd>Annotate Model and Api using the Swagger Annotations 1.x library.</dd><dt>**swagger2**</dt><dd>Annotate Model and Api using the Swagger Annotations 2.x library.</dd></dl>|swagger1|
|apiPackage|package for generated api classes| |org.openapitools.api|
|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-cxf-server|
@@ -40,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
|documentationProvider|Select the OpenAPI documentation provider.|<dl><dt>**none**</dt><dd>Do not publish an OpenAPI specification.</dd><dt>**swagger1**</dt><dd>Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using Swagger-Core 1.x.</dd><dt>**swagger2**</dt><dd>Generate an OpenAPI 3 specification using Swagger-Core 2.x.</dd></dl>|swagger1|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE|
|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|

View File

@@ -23,6 +23,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|additionalOneOfTypeAnnotations|Additional annotations for oneOf interfaces(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|annotationLibrary|Select the complementary documentation annotation library.|<dl><dt>**none**</dt><dd>Do not annotate Model and Api with complementary annotations.</dd><dt>**swagger1**</dt><dd>Annotate Model and Api using the Swagger Annotations 1.x library.</dd><dt>**swagger2**</dt><dd>Annotate Model and Api using the Swagger Annotations 2.x library.</dd></dl>|swagger1|
|apiPackage|package for generated api classes| |org.openapitools.api|
|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-cxf-server|
@@ -40,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
|documentationProvider|Select the OpenAPI documentation provider.|<dl><dt>**none**</dt><dd>Do not publish an OpenAPI specification.</dd><dt>**swagger1**</dt><dd>Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using Swagger-Core 1.x.</dd><dt>**swagger2**</dt><dd>Generate an OpenAPI 3 specification using Swagger-Core 2.x.</dd></dl>|swagger1|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE|
|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|

View File

@@ -65,6 +65,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|returnJBossResponse|Whether generate API interface should return `org.jboss.resteasy.reactive.RestResponse` instead of a deserialized entity. This flag cannot be combined with `returnResponse` flag. It requires the flag `interfaceOnly` and `useJakartaEE` set to true, because `org.jboss.resteasy.reactive.RestResponse` was introduced in Quarkus 2.x| |false|
|returnResponse|Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.| |false|
|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|

View File

@@ -67,6 +67,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL|
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|x-kotlin-implements|Ability to specify interfaces that model must implement|MODEL|empty array
|x-kotlin-implements-fields|Specify attributes that are implemented by the interface(s) added via `x-kotlin-implements`|MODEL|empty array
## IMPORT MAPPING

View File

@@ -24,6 +24,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|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|
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|lazyImports|Enable lazy imports.| |false|
|library|library template (sub-template) to use: asyncio, tornado (deprecated), urllib3| |urllib3|
|mapNumberTo|Map number to Union[StrictFloat, StrictInt], StrictStr or float.| |Union[StrictFloat, StrictInt]|
|packageName|python package name (convention: snake_case).| |openapi_client|

View File

@@ -1,17 +1,17 @@
---
title: Documentation for the scala-lagom-server Generator
title: Documentation for the scala-lagom-server-deprecated Generator
---
## METADATA
| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | scala-lagom-server | pass this to the generate command after -g |
| generator stability | STABLE | |
| generator name | scala-lagom-server-deprecated | pass this to the generate command after -g |
| generator stability | DEPRECATED | |
| generator type | SERVER | |
| generator language | Scala | |
| generator default templating engine | mustache | |
| helpTxt | Generates a Lagom API server (Beta) in scala | |
| helpTxt | Generates a Lagom API server (Beta) in scala. IMPORTANT: this generator has been deprecated | |
## 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.

View File

@@ -92,6 +92,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|title|server title name or client service name| |OpenAPI Spring|
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useDeductionForOneOfInterfaces|whether to use deduction for generated oneOf interfaces| |false|
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
|useFeignClientContextId|Whether to generate Feign client with contextId parameter.| |true|
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|

View File

@@ -81,6 +81,10 @@ tasks.withType(ReleaseNexusStagingRepository).configureEach {
onlyIf { nexusPublishing.useStaging.get() }
}
tasks.named("validatePlugins").configure {
enableStricterValidation = true
}
gradlePlugin {
website = "https://openapi-generator.tech/"
vcsUrl = "https://github.com/OpenAPITools/openapi-generator"

View File

@@ -62,43 +62,43 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
/**
* The verbosity of generation
*/
@Optional
@Input
@get:Optional
@get:Input
val verbose = project.objects.property<Boolean>()
/**
* Whether an input specification should be validated upon generation.
*/
@Optional
@Input
@get:Optional
@get:Input
val validateSpec = project.objects.property<Boolean>()
/**
* The name of the generator which will handle codegen. (see "openApiGenerators" task)
*/
@Optional
@Input
@get:Optional
@get:Input
val generatorName = project.objects.property<String>()
/**
* This is the configuration for reference paths where schemas for openapi generation are stored
* The directory which contains the additional schema files
*/
@Optional
@InputDirectory
@PathSensitive(PathSensitivity.ABSOLUTE)
@get:Optional
@get:InputDirectory
@get:PathSensitive(PathSensitivity.ABSOLUTE)
val schemaLocation = project.objects.property<String>()
/**
* The output target directory into which code will be generated.
*/
@Optional
@get:Optional
@get:OutputDirectory
val outputDir = project.objects.property<String>()
@Suppress("unused")
@set:Option(option = "input", description = "The input specification.")
@Internal
@get:Internal
var input: String? = null
set(value) {
inputSpec.set(value)
@@ -111,9 +111,9 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
* changes to any $ref referenced files. Use the `inputSpecRootDirectory` property to have Gradle track changes to
* an entire directory of spec files.
*/
@Optional
@get:Optional
@get:InputFile
@PathSensitive(PathSensitivity.RELATIVE)
@get:PathSensitive(PathSensitivity.RELATIVE)
val inputSpec = project.objects.property<String>()
/**
@@ -122,60 +122,60 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
* By default, a merged spec file will be generated based on the contents of the directory. To disable this, set the
* `inputSpecRootDirectorySkipMerge` property.
*/
@Optional
@get:Optional
@get:InputDirectory
@PathSensitive(PathSensitivity.RELATIVE)
@get:PathSensitive(PathSensitivity.RELATIVE)
val inputSpecRootDirectory = project.objects.property<String>();
/**
* Skip bundling all spec files into a merged spec file, if true.
*/
@Input
@Optional
@get:Input
@get:Optional
val inputSpecRootDirectorySkipMerge = project.objects.property<Boolean>()
/**
* Name of the file that will contain all merged specs
*/
@Input
@Optional
@get:Input
@get:Optional
val mergedFileName = project.objects.property<String>();
/**
* The remote Open API 2.0/3.x specification URL location.
*/
@Input
@Optional
@get:Input
@get:Optional
val remoteInputSpec = project.objects.property<String>()
/**
* The template directory holding a custom template.
*/
@Optional
@InputDirectory
@PathSensitive(PathSensitivity.RELATIVE)
@get:Optional
@get:InputDirectory
@get:PathSensitive(PathSensitivity.RELATIVE)
val templateDir = project.objects.property<String?>()
/**
* Resource path containing template files.
*/
@Optional
@Input
@get:Optional
@get:Input
val templateResourcePath = project.objects.property<String?>()
/**
* Adds authorization headers when fetching the OpenAPI definitions remotely.
* Pass in a URL-encoded string of name:header with a comma separating multiple values
*/
@Optional
@Input
@get:Optional
@get:Input
val auth = project.objects.property<String>()
/**
* Sets specified global properties.
*/
@Optional
@Input
@get:Optional
@get:Input
val globalProperties = project.objects.mapProperty<String, String>()
/**
@@ -183,271 +183,271 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
* File content should be in a json format { "optionKey":"optionValue", "optionKey1":"optionValue1"...}
* Supported options can be different for each language. Run config-help -g {generator name} command for language specific config options.
*/
@Optional
@InputFile
@PathSensitive(PathSensitivity.RELATIVE)
@get:Optional
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
val configFile = project.objects.property<String>()
/**
* Specifies if the existing files should be overwritten during the generation.
*/
@Optional
@Input
@get:Optional
@get:Input
val skipOverwrite = project.objects.property<Boolean?>()
/**
* Package for generated classes (where supported)
*/
@Optional
@Input
@get:Optional
@get:Input
val packageName = project.objects.property<String>()
/**
* Package for generated api classes
*/
@Optional
@Input
@get:Optional
@get:Input
val apiPackage = project.objects.property<String>()
/**
* Package for generated models
*/
@Optional
@Input
@get:Optional
@get:Input
val modelPackage = project.objects.property<String>()
/**
* Prefix that will be prepended to all model names. Default is the empty string.
*/
@Optional
@Input
@get:Optional
@get:Input
val modelNamePrefix = project.objects.property<String>()
/**
* Suffix that will be appended to all model names. Default is the empty string.
*/
@Optional
@Input
@get:Optional
@get:Input
val modelNameSuffix = project.objects.property<String>()
/**
* Suffix that will be appended to all api names. Default is the empty string.
*/
@Optional
@Input
@get:Optional
@get:Input
val apiNameSuffix = project.objects.property<String>()
/**
* Sets instantiation type mappings.
*/
@Optional
@Input
@get:Optional
@get:Input
val instantiationTypes = project.objects.mapProperty<String, String>()
/**
* Sets mappings between OpenAPI spec types and generated code types.
*/
@Optional
@Input
@get:Optional
@get:Input
val typeMappings = project.objects.mapProperty<String, String>()
/**
* Sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value.
* You can also have multiple occurrences of this option.
*/
@Optional
@Input
@get:Optional
@get:Input
val additionalProperties = project.objects.mapProperty<String, Any>()
/**
* Sets server variable for server URL template substitution, in the format of name=value,name=value.
* You can also have multiple occurrences of this option.
*/
@Optional
@Input
@get:Optional
@get:Input
val serverVariables = project.objects.mapProperty<String, String>()
/**
* Specifies additional language specific primitive types in the format of type1,type2,type3,type3. For example: String,boolean,Boolean,Double.
*/
@Optional
@Input
@get:Optional
@get:Input
val languageSpecificPrimitives = project.objects.listProperty<String>()
/**
* Specifies .openapi-generator-ignore list in the form of relative/path/to/file1,relative/path/to/file2. For example: README.md,pom.xml.
*/
@Optional
@Input
@get:Optional
@get:Input
val openapiGeneratorIgnoreList = project.objects.listProperty<String>()
/**
* Specifies mappings between a given class and the import that should be used for that class.
*/
@Optional
@Input
@get:Optional
@get:Input
val importMappings = project.objects.mapProperty<String, String>()
/**
* Specifies mappings between a given schema and the new one.
*/
@Optional
@Input
@get:Optional
@get:Input
val schemaMappings = project.objects.mapProperty<String, String>()
/**
* Specifies mappings between the inline scheme name and the new name
*/
@Optional
@Input
@get:Optional
@get:Input
val inlineSchemaNameMappings = project.objects.mapProperty<String, String>()
/**
* Specifies options for inline schemas
*/
@Optional
@Input
@get:Optional
@get:Input
val inlineSchemaOptions = project.objects.mapProperty<String, String>()
/**
* Specifies mappings between the property name and the new name
*/
@Optional
@Input
@get:Optional
@get:Input
val nameMappings = project.objects.mapProperty<String, String>()
/**
* Specifies mappings between the parameter name and the new name
*/
@Optional
@Input
@get:Optional
@get:Input
val parameterNameMappings = project.objects.mapProperty<String, String>()
/**
* Specifies mappings between the model name and the new name
*/
@Optional
@Input
@get:Optional
@get:Input
val modelNameMappings = project.objects.mapProperty<String, String>()
/**
* Specifies mappings between the enum name and the new name
*/
@Optional
@Input
@get:Optional
@get:Input
val enumNameMappings = project.objects.mapProperty<String, String>()
/**
* Specifies mappings between the operation id name and the new name
*/
@Optional
@Input
@get:Optional
@get:Input
val operationIdNameMappings = project.objects.mapProperty<String, String>()
/**
* Specifies mappings (rules) in OpenAPI normalizer
*/
@Optional
@Input
@get:Optional
@get:Input
val openapiNormalizer = project.objects.mapProperty<String, String>()
/**
* Root package for generated code.
*/
@Optional
@Input
@get:Optional
@get:Input
val invokerPackage = project.objects.property<String>()
/**
* GroupId in generated pom.xml/build.gradle.kts or other build script. Language-specific conversions occur in non-jvm generators.
*/
@Optional
@Input
@get:Optional
@get:Input
val groupId = project.objects.property<String>()
/**
* ArtifactId in generated pom.xml/build.gradle.kts or other build script. Language-specific conversions occur in non-jvm generators.
*/
@Optional
@Input
@get:Optional
@get:Input
val id = project.objects.property<String>()
/**
* Artifact version in generated pom.xml/build.gradle.kts or other build script. Language-specific conversions occur in non-jvm generators.
*/
@Optional
@Input
@get:Optional
@get:Input
val version = project.objects.property<String>()
/**
* Reference the library template (sub-template) of a generator.
*/
@Optional
@Input
@get:Optional
@get:Input
val library = project.objects.property<String?>()
/**
* Git host, e.g. gitlab.com.
*/
@Optional
@Input
@get:Optional
@get:Input
val gitHost = project.objects.property<String?>()
/**
* Git user ID, e.g. openapitools.
*/
@Optional
@Input
@get:Optional
@get:Input
val gitUserId = project.objects.property<String?>()
/**
* Git repo ID, e.g. openapi-generator.
*/
@Optional
@Input
@get:Optional
@get:Input
val gitRepoId = project.objects.property<String?>()
/**
* Release note, default to 'Minor update'.
*/
@Optional
@Input
@get:Optional
@get:Input
val releaseNote = project.objects.property<String?>()
/**
* HTTP user agent, e.g. codegen_csharp_api_client, default to 'OpenAPI-Generator/{packageVersion}/{language}'
*/
@Optional
@Input
@get:Optional
@get:Input
val httpUserAgent = project.objects.property<String?>()
/**
* Specifies how a reserved name should be escaped to.
*/
@Optional
@Input
@get:Optional
@get:Input
val reservedWordsMappings = project.objects.mapProperty<String, String>()
/**
* Specifies an override location for the .openapi-generator-ignore file. Most useful on initial generation.
*/
@Optional
@InputFile
@PathSensitive(PathSensitivity.RELATIVE)
@get:Optional
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
val ignoreFileOverride = project.objects.property<String?>()
/**
* Remove prefix of operationId, e.g. config_getId => getId
*/
@Optional
@Input
@get:Optional
@get:Input
val removeOperationIdPrefix = project.objects.property<Boolean?>()
/**
* Remove examples defined in the operation
*/
@Optional
@Input
@get:Optional
@get:Input
val skipOperationExample = project.objects.property<Boolean?>()
/**
@@ -459,8 +459,8 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
* in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation.
* For more control over generation of individual files, configure an ignore file and refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Optional
@get:Input
val apiFilesConstrainedTo = project.objects.listProperty<String>()
/**
@@ -470,8 +470,8 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
* in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation.
* For more control over generation of individual files, configure an ignore file and refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Optional
@get:Input
val modelFilesConstrainedTo = project.objects.listProperty<String>()
/**
@@ -484,8 +484,8 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
* in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation.
* For more control over generation of individual files, configure an ignore file and refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Optional
@get:Input
val supportingFilesConstrainedTo = project.objects.listProperty<String>()
/**
@@ -496,8 +496,8 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
* For more control over generation of individual files, configure an ignore file and
* refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Optional
@get:Input
val generateModelTests = project.objects.property<Boolean>()
/**
@@ -508,8 +508,8 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
* For more control over generation of individual files, configure an ignore file and
* refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Optional
@get:Input
val generateModelDocumentation = project.objects.property<Boolean>()
/**
@@ -520,8 +520,8 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
* For more control over generation of individual files, configure an ignore file and
* refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Optional
@get:Input
val generateApiTests = project.objects.property<Boolean>()
/**
@@ -532,15 +532,15 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
* For more control over generation of individual files, configure an ignore file and
* refer to it via [ignoreFileOverride].
*/
@Optional
@Input
@get:Optional
@get:Input
val generateApiDocumentation = project.objects.property<Boolean>()
/**
* To write all log messages (not just errors) to STDOUT
*/
@Optional
@Input
@get:Optional
@get:Input
val logToStderr = project.objects.property<Boolean>()
/**
@@ -549,15 +549,15 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
* LANG_POST_PROCESS_FILE (e.g. GO_POST_PROCESS_FILE, SCALA_POST_PROCESS_FILE). Please open an issue if your target
* generator does not support this functionality.
*/
@Optional
@Input
@get:Optional
@get:Input
val enablePostProcessFile = project.objects.property<Boolean>()
/**
* To skip spec validation. When true, we will skip the default behavior of validating a spec before generation.
*/
@Optional
@Input
@get:Optional
@get:Input
val skipValidateSpec = project.objects.property<Boolean>()
/**
@@ -565,37 +565,37 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
* definitions generated as top-level Array-of-items, List-of-items, Map-of-items definitions.
* When true, A model representation either containing or extending the array,list,map (depending on specific generator implementation) will be generated.
*/
@Optional
@Input
@get:Optional
@get:Input
val generateAliasAsModel = project.objects.property<Boolean>()
/**
* A dynamic map of options specific to a generator.
*/
@Optional
@Input
@get:Optional
@get:Input
val configOptions = project.objects.mapProperty<String, String>()
/**
* Templating engine: "mustache" (default) or "handlebars" (beta)
*/
@Optional
@Input
@get:Optional
@get:Input
val engine = project.objects.property<String?>()
/**
* Defines whether the output dir should be cleaned up before generating the output.
*
*/
@Optional
@Input
@get:Optional
@get:Input
val cleanupOutput = project.objects.property<Boolean>()
/**
* Defines whether the generator should run in dry-run mode.
*/
@Optional
@Input
@get:Optional
@get:Input
val dryRun = project.objects.property<Boolean>()
private fun <T : Any?> Property<T>.ifNotEmpty(block: Property<T>.(T) -> Unit) {

View File

@@ -22,6 +22,7 @@ import org.gradle.api.tasks.TaskAction
import org.gradle.internal.logging.text.StyledTextOutput
import org.gradle.internal.logging.text.StyledTextOutputFactory
import org.gradle.kotlin.dsl.listProperty
import org.gradle.work.DisableCachingByDefault
import org.openapitools.codegen.CodegenConfigLoader
import org.openapitools.codegen.CodegenType
import org.openapitools.codegen.meta.GeneratorMetadata
@@ -36,6 +37,7 @@ import org.openapitools.codegen.meta.Stability
*
* @author Jim Schubert
*/
@DisableCachingByDefault(because = "not worth caching")
open class GeneratorsTask : DefaultTask() {
/**
* A list of stability indexes to include (value: all,beta,stable,experimental,deprecated). Excludes deprecated by default.

View File

@@ -21,6 +21,7 @@ import io.swagger.v3.parser.core.models.ParseOptions
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.logging.Logging
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Internal
@@ -51,17 +52,18 @@ import org.openapitools.codegen.validations.oas.RuleConfiguration
*
* @author Jim Schubert
*/
@CacheableTask
open class ValidateTask : DefaultTask() {
@get:InputFile
@PathSensitive(PathSensitivity.RELATIVE)
@get:PathSensitive(PathSensitivity.RELATIVE)
val inputSpec = project.objects.property<String>()
@Optional
@Input
@get:Optional
@get:Input
val recommend = project.objects.property<Boolean>().convention(true)
@Optional
@Input
@get:Optional
@get:Input
val treatWarningsAsErrors = project.objects.property<Boolean>().convention(false)
@get:Internal

View File

@@ -217,9 +217,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>2.2.16</swagger-annotations-version>
<jersey-version>2.35</jersey-version>
<jackson-version>2.17.1</jackson-version>
<jackson-databind-version>2.17.1</jackson-databind-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-version>2.19.2</jackson-version>
<jackson-databind-version>2.19.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.2</junit-version>
<scribejava-apis-version>8.3.3</scribejava-apis-version>

View File

@@ -232,8 +232,8 @@
<properties>
<swagger-annotations-version>1.5.8</swagger-annotations-version>
<jersey-version>2.27</jersey-version>
<jackson-version>2.15.2</jackson-version>
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
<jackson-version>2.19.2</jackson-version>
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
<jodatime-version>2.7</jodatime-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.13.2</junit-version>

View File

@@ -15,8 +15,8 @@
<properties>
<swagger-annotations-version>1.5.8</swagger-annotations-version>
<jersey-version>2.35</jersey-version>
<jackson-version>2.17.1</jackson-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<jackson-version>2.19.2</jackson-version>
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
<jodatime-version>2.7</jodatime-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>5.10.2</junit-version>

View File

@@ -111,7 +111,7 @@
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.6</version>
<version>0.2.7</version>
</dependency>
<!-- Bean Validation API support -->
<dependency>

View File

@@ -454,4 +454,6 @@ public class CodegenConstants {
public static final String WAIT_TIME_OF_THREAD = "waitTimeMillis";
public static final String USE_DEFAULT_VALUES_FOR_REQUIRED_VARS = "useDefaultValuesForRequiredVars";
public static final String DEFAULT_TO_EMPTY_CONTAINER = "defaultToEmptyContainer";
}

View File

@@ -88,6 +88,7 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.openapitools.codegen.CodegenConstants.DEFAULT_TO_EMPTY_CONTAINER;
import static org.openapitools.codegen.CodegenConstants.UNSUPPORTED_V310_SPEC_MSG;
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
import static org.openapitools.codegen.utils.OnceLogger.once;
@@ -338,7 +339,7 @@ public class DefaultCodegen implements CodegenConfig {
@Setter @Getter boolean arrayDefaultToEmpty, arrayNullableDefaultToEmpty, arrayOptionalNullableDefaultToEmpty, arrayOptionalDefaultToEmpty;
@Setter @Getter boolean mapDefaultToEmpty, mapNullableDefaultToEmpty, mapOptionalNullableDefaultToEmpty, mapOptionalDefaultToEmpty;
@Setter @Getter protected boolean defaultToEmptyContainer;
final String DEFAULT_TO_EMPTY_CONTAINER = "defaultToEmptyContainer";
final List EMPTY_LIST = new ArrayList();
@Override
@@ -4289,7 +4290,7 @@ public class DefaultCodegen implements CodegenConfig {
} else { // required
if (cp.isNullable && mapNullableDefaultToEmpty) { // nullable
p.setDefault(EMPTY_LIST);
} else if (!cp.isNullable && mapOptionalDefaultToEmpty) { // non-nullable
} else if (!cp.isNullable && mapDefaultToEmpty) { // non-nullable
p.setDefault(EMPTY_LIST);
}
}

View File

@@ -88,6 +88,9 @@ public class OpenAPINormalizer {
// when set to true, boolean enum will be converted to just boolean
final String SIMPLIFY_BOOLEAN_ENUM = "SIMPLIFY_BOOLEAN_ENUM";
// when set to true, oneOf/anyOf with enum sub-schemas containing single values will be converted to a single enum
final String SIMPLIFY_ONEOF_ANYOF_ENUM = "SIMPLIFY_ONEOF_ANYOF_ENUM";
// when set to a string value, tags in all operations will be reset to the string value provided
final String SET_TAGS_FOR_ALL_OPERATIONS = "SET_TAGS_FOR_ALL_OPERATIONS";
String setTagsForAllOperations;
@@ -205,11 +208,12 @@ public class OpenAPINormalizer {
ruleNames.add(FILTER);
ruleNames.add(SET_CONTAINER_TO_NULLABLE);
ruleNames.add(SET_PRIMITIVE_TYPES_TO_NULLABLE);
ruleNames.add(SIMPLIFY_ONEOF_ANYOF_ENUM);
// rules that are default to true
rules.put(SIMPLIFY_ONEOF_ANYOF, true);
rules.put(SIMPLIFY_BOOLEAN_ENUM, true);
rules.put(SIMPLIFY_ONEOF_ANYOF_ENUM, true);
processRules(inputRules);
@@ -972,6 +976,8 @@ public class OpenAPINormalizer {
// Remove duplicate oneOf entries
ModelUtils.deduplicateOneOfSchema(schema);
schema = processSimplifyOneOfEnum(schema);
// simplify first as the schema may no longer be a oneOf after processing the rule below
schema = processSimplifyOneOf(schema);
@@ -1000,6 +1006,11 @@ public class OpenAPINormalizer {
}
protected Schema normalizeAnyOf(Schema schema, Set<Schema> visitedSchemas) {
//transform anyOf into enums if needed
schema = processSimplifyAnyOfEnum(schema);
if (schema.getAnyOf() == null) {
return schema;
}
for (int i = 0; i < schema.getAnyOf().size(); i++) {
// normalize anyOf sub schemas one by one
Object item = schema.getAnyOf().get(i);
@@ -1275,6 +1286,161 @@ public class OpenAPINormalizer {
}
/**
* If the schema is anyOf and all sub-schemas are enums (with one or more values),
* then simplify it to a single enum schema containing all the values.
*
* @param schema Schema
* @return Schema
*/
protected Schema processSimplifyAnyOfEnum(Schema schema) {
if (!getRule(SIMPLIFY_ONEOF_ANYOF_ENUM)) {
return schema;
}
if (schema.getAnyOf() == null || schema.getAnyOf().isEmpty()) {
return schema;
}
if(schema.getOneOf() != null && !schema.getOneOf().isEmpty() ||
schema.getAllOf() != null && !schema.getAllOf().isEmpty() ||
schema.getNot() != null) {
//only convert to enum if anyOf is the only composition
return schema;
}
return simplifyComposedSchemaWithEnums(schema, schema.getAnyOf(), "anyOf");
}
/**
* If the schema is oneOf and all sub-schemas are enums (with one or more values),
* then simplify it to a single enum schema containing all the values.
*
* @param schema Schema
* @return Schema
*/
protected Schema processSimplifyOneOfEnum(Schema schema) {
if (!getRule(SIMPLIFY_ONEOF_ANYOF_ENUM)) {
return schema;
}
if (schema.getOneOf() == null || schema.getOneOf().isEmpty()) {
return schema;
}
if(schema.getAnyOf() != null && !schema.getAnyOf().isEmpty() ||
schema.getAllOf() != null && !schema.getAllOf().isEmpty() ||
schema.getNot() != null) {
//only convert to enum if oneOf is the only composition
return schema;
}
return simplifyComposedSchemaWithEnums(schema, schema.getOneOf(), "oneOf");
}
/**
* Simplifies a composed schema (oneOf/anyOf) where all sub-schemas are enums
* to a single enum schema containing all the values.
*
* @param schema Schema to modify
* @param subSchemas List of sub-schemas to check
* @param schemaType Type of composed schema ("oneOf" or "anyOf")
* @return Simplified schema
*/
protected Schema simplifyComposedSchemaWithEnums(Schema schema, List<Object> subSchemas, String composedType) {
Map<Object, String> enumValues = new LinkedHashMap<>();
if(schema.getTypes() != null && schema.getTypes().size() > 1) {
// we cannot handle enums with multiple types
return schema;
}
if(subSchemas.size() < 2) {
//do not process if there's less than 2 sub-schemas. It will be normalized later, and this prevents
//named enum schemas from being converted to inline enum schemas
return schema;
}
String schemaType = ModelUtils.getType(schema);
for (Object item : subSchemas) {
if (!(item instanceof Schema)) {
return schema;
}
Schema subSchema = ModelUtils.getReferencedSchema(openAPI, (Schema) item);
// Check if this sub-schema has an enum (with one or more values)
if (subSchema.getEnum() == null || subSchema.getEnum().isEmpty()) {
return schema;
}
// Ensure all sub-schemas have the same type (if type is specified)
if(subSchema.getTypes() != null && subSchema.getTypes().size() > 1) {
// we cannot handle enums with multiple types
return schema;
}
String subSchemaType = ModelUtils.getType(subSchema);
if (subSchemaType != null) {
if (schemaType == null) {
schemaType = subSchemaType;
} else if (!schemaType.equals(subSchema.getType())) {
return schema;
}
}
// Add all enum values from this sub-schema to our collection
if(subSchema.getEnum().size() == 1) {
String description = subSchema.getTitle() == null ? "" : subSchema.getTitle();
if(subSchema.getDescription() != null) {
if(!description.isEmpty()) {
description += " - ";
}
description += subSchema.getDescription();
}
enumValues.put(subSchema.getEnum().get(0), description);
} else {
for(Object e: subSchema.getEnum()) {
enumValues.put(e, "");
}
}
}
return createSimplifiedEnumSchema(schema, enumValues, schemaType, composedType);
}
/**
* Creates a simplified enum schema from collected enum values.
*
* @param originalSchema Original schema to modify
* @param enumValues Collected enum values
* @param schemaType Consistent type across sub-schemas
* @param composedType Type of composed schema being simplified
* @return Simplified enum schema
*/
protected Schema createSimplifiedEnumSchema(Schema originalSchema, Map<Object, String> enumValues, String schemaType, String composedType) {
// Clear the composed schema type
if ("oneOf".equals(composedType)) {
originalSchema.setOneOf(null);
} else if ("anyOf".equals(composedType)) {
originalSchema.setAnyOf(null);
}
if (ModelUtils.getType(originalSchema) == null && schemaType != null) {
//if type was specified in subschemas, keep it in the main schema
ModelUtils.setType(originalSchema, schemaType);
}
originalSchema.setEnum(new ArrayList<>(enumValues.keySet()));
if(enumValues.values().stream().anyMatch(e -> !e.isEmpty())) {
//set x-enum-descriptions only if there's at least one non-empty description
originalSchema.addExtension("x-enum-descriptions", new ArrayList<>(enumValues.values()));
}
LOGGER.debug("Simplified {} with enum sub-schemas to single enum: {}", composedType, originalSchema);
return originalSchema;
}
/**
* If the schema is oneOf and the sub-schemas is null, set `nullable: true`
* instead.

View File

@@ -10,6 +10,8 @@ import java.util.List;
public enum VendorExtension {
X_IMPLEMENTS("x-implements", ExtensionLevel.MODEL, "Ability to specify interfaces that model must implements", "empty array"),
X_KOTLIN_IMPLEMENTS("x-kotlin-implements", ExtensionLevel.MODEL, "Ability to specify interfaces that model must implement", "empty array"),
X_KOTLIN_IMPLEMENTS_FIELDS("x-kotlin-implements-fields", ExtensionLevel.MODEL, "Specify attributes that are implemented by the interface(s) added via `x-kotlin-implements`", "empty array"),
X_SPRING_PAGINATED("x-spring-paginated", ExtensionLevel.OPERATION, "Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.", "false"),
X_SPRING_PROVIDE_ARGS("x-spring-provide-args", ExtensionLevel.OPERATION, "Allows adding additional hidden parameters in the API specification to allow access to content such as header values or properties", "empty array"),
X_DISCRIMINATOR_VALUE("x-discriminator-value", ExtensionLevel.MODEL, "Used with model inheritance to specify value for discriminator that identifies current model", ""),

View File

@@ -5,7 +5,9 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.google.common.collect.ImmutableMap;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.servers.Server;
import io.swagger.v3.parser.core.models.ParseOptions;
import org.apache.commons.lang3.ObjectUtils;
import org.openapitools.codegen.auth.AuthParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -17,6 +19,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -58,6 +61,7 @@ public class MergedSpecBuilder {
ParseOptions options = new ParseOptions();
options.setResolve(true);
List<SpecWithPaths> allPaths = new ArrayList<>();
List<Server> allServers = new ArrayList<>();
for (String specRelatedPath : specRelatedPaths) {
String specPath = inputSpecRootDirectory + File.separator + specRelatedPath;
@@ -74,13 +78,14 @@ public class MergedSpecBuilder {
isJson = true;
}
}
allServers.addAll(ObjectUtils.defaultIfNull(result.getServers(), Collections.emptyList()));
allPaths.add(new SpecWithPaths(specRelatedPath, result.getPaths().keySet()));
} catch (Exception e) {
LOGGER.error("Failed to read file: {}. It would be ignored", specPath);
}
}
Map<String, Object> mergedSpec = generatedMergedSpec(openapiVersion, allPaths);
Map<String, Object> mergedSpec = generatedMergedSpec(openapiVersion, allPaths, allServers);
String mergedFilename = this.mergeFileName + (isJson ? ".json" : ".yaml");
Path mergedFilePath = Paths.get(inputSpecRootDirectory, mergedFilename);
@@ -94,8 +99,8 @@ public class MergedSpecBuilder {
return mergedFilePath.toString();
}
private Map<String, Object> generatedMergedSpec(String openapiVersion, List<SpecWithPaths> allPaths) {
Map<String, Object> spec = generateHeader(openapiVersion, mergedFileInfoName, mergedFileInfoDescription, mergedFileInfoVersion);
private Map<String, Object> generatedMergedSpec(String openapiVersion, List<SpecWithPaths> allPaths, List<Server> allServers) {
Map<String, Object> spec = generateHeader(openapiVersion, mergedFileInfoName, mergedFileInfoDescription, mergedFileInfoVersion, allServers);
Map<String, Object> paths = new HashMap<>();
spec.put("paths", paths);
@@ -111,7 +116,7 @@ public class MergedSpecBuilder {
return spec;
}
private static Map<String, Object> generateHeader(String openapiVersion, String title, String description, String version) {
private static Map<String, Object> generateHeader(String openapiVersion, String title, String description, String version, List<Server> allServers) {
Map<String, Object> map = new HashMap<>();
map.put("openapi", openapiVersion);
map.put("info", ImmutableMap.of(
@@ -119,9 +124,17 @@ public class MergedSpecBuilder {
"description", description,
"version", version
));
map.put("servers", Collections.singleton(
ImmutableMap.of("url", "http://localhost:8080")
));
Set<ImmutableMap<String, String>> servers = allServers.stream()
.map(Server::getUrl)
.distinct()
.map(url -> ImmutableMap.of("url", url))
.collect(Collectors.collectingAndThen(Collectors.toSet(), Optional::of))
.filter(Predicate.not(Set::isEmpty))
.orElseGet(() -> Collections.singleton(ImmutableMap.of("url", "http://localhost:8080")));
map.put("servers", servers);
return map;
}

View File

@@ -835,6 +835,16 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
@Override
public CodegenModel fromModel(String name, Schema schema) {
CodegenModel m = super.fromModel(name, schema);
List<String> implementedInterfacesClasses = (List<String>) m.getVendorExtensions().getOrDefault(VendorExtension.X_KOTLIN_IMPLEMENTS.getName(), List.of());
List<String> implementedInterfacesFields = Optional.ofNullable((List<String>) m.getVendorExtensions().get(VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS.getName()))
.map(xKotlinImplementsFields -> {
if (implementedInterfacesClasses.isEmpty() && !xKotlinImplementsFields.isEmpty()) {
LOGGER.warn("Annotating {} with {} without {} is not supported. {} will be ignored.",
name, VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS.getName(), VendorExtension.X_KOTLIN_IMPLEMENTS.getName(),
VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS.getName());
}
return xKotlinImplementsFields;
}).orElse(List.of());
m.optionalVars = m.optionalVars.stream().distinct().collect(Collectors.toList());
// Update allVars/requiredVars/optionalVars with isInherited
// Each of these lists contains elements that are similar, but they are all cloned
@@ -850,7 +860,9 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
// Update any other vars (requiredVars, optionalVars)
Stream.of(m.requiredVars, m.optionalVars)
.flatMap(List::stream)
.filter(p -> allVarsMap.containsKey(p.baseName))
.filter(p -> allVarsMap.containsKey(p.baseName)
|| implementedInterfacesFields.contains(p.baseName)
)
.forEach(p -> p.isInherited = true);
return m;
}
@@ -1119,6 +1131,8 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
}
protected interface DataTypeAssigner {
void setIsVoid(Boolean isVoid);
void setReturnType(String returnType);
void setReturnContainer(String returnContainer);
@@ -1131,6 +1145,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
protected void doDataTypeAssignment(final String returnType, DataTypeAssigner dataTypeAssigner) {
if (returnType == null) {
dataTypeAssigner.setReturnType("Unit");
dataTypeAssigner.setIsVoid(true);
} else if (returnType.startsWith("kotlin.collections.List")) {
int end = returnType.lastIndexOf(">");
if (end > 0) {

View File

@@ -317,7 +317,7 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
imports.put("OffsetDate", "package:time_machine/time_machine.dart");
imports.put("OffsetDateTime", "package:time_machine/time_machine.dart");
if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) {
supportingFiles.add(new SupportingFile("serialization/built_value/offset_date_serializer.mustache", srcFolder, "local_date_serializer.dart"));
supportingFiles.add(new SupportingFile("serialization/built_value/offset_date_serializer.mustache", srcFolder, "offset_date_serializer.dart"));
}
break;
default:

View File

@@ -18,6 +18,7 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.openapitools.codegen.*;
@@ -115,6 +116,20 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
return "jaxrs-cxf-client";
}
@Override
public List<DocumentationProvider> supportedDocumentationProvider() {
return List.of(DocumentationProvider.NONE, DocumentationProvider.SWAGGER1, DocumentationProvider.SWAGGER2);
}
@Override
public List<AnnotationLibrary> supportedAnnotationLibraries() {
return List.of(AnnotationLibrary.NONE, AnnotationLibrary.SWAGGER1, AnnotationLibrary.SWAGGER2);
}
@Override
public DocumentationProvider defaultDocumentationProvider() {
return DocumentationProvider.SWAGGER1;
}
@Override
public CodegenType getTag() {
@@ -127,11 +142,19 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
co.subresourceOperation = !co.path.isEmpty();
}
@Override
public CodegenModel fromModel(String name, Schema model) {
CodegenModel m = super.fromModel(name, model);
m.imports.remove("ApiModel");
return m;
}
@Override
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
super.postProcessModelProperty(model, property);
model.imports.remove("ApiModelProperty");
model.imports.remove("ApiModel");
model.imports.remove("JsonTypeName");
if (jackson) {
//Add jackson imports when model has inner enum

View File

@@ -18,6 +18,7 @@
package org.openapitools.codegen.languages;
import lombok.Setter;
import io.swagger.v3.oas.models.media.Schema;
import org.openapitools.codegen.*;
import org.openapitools.codegen.languages.features.CXFServerFeatures;
import org.openapitools.codegen.languages.features.GzipTestFeatures;
@@ -222,12 +223,35 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
return "jaxrs-cxf";
}
@Override
public List<DocumentationProvider> supportedDocumentationProvider() {
return List.of(DocumentationProvider.NONE, DocumentationProvider.SWAGGER1, DocumentationProvider.SWAGGER2);
}
@Override
public List<AnnotationLibrary> supportedAnnotationLibraries() {
return List.of(AnnotationLibrary.NONE, AnnotationLibrary.SWAGGER1, AnnotationLibrary.SWAGGER2);
}
@Override
public DocumentationProvider defaultDocumentationProvider() {
return DocumentationProvider.SWAGGER1;
}
@Override
public CodegenModel fromModel(String name, Schema model) {
CodegenModel m = super.fromModel(name, model);
m.imports.remove("ApiModel");
return m;
}
@Override
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
super.postProcessModelProperty(model, property);
model.imports.remove("ApiModelProperty");
model.imports.remove("ApiModel");
model.imports.remove("JsonFormat");
model.imports.remove("JsonTypeName");
//Add imports for Jackson when model has inner enum
if (isJackson()) {

View File

@@ -1088,6 +1088,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
}
}
if (!AnnotationLibrary.SWAGGER2.equals(getAnnotationLibrary())) {
codegenModel.imports.remove("Schema");
}
return codegenModel;
}

View File

@@ -0,0 +1,885 @@
/*
* 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 of 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 io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.ModelsMap;
import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap;
import org.openapitools.codegen.templating.mustache.TrimWhitespaceLambda;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
import org.openapitools.codegen.utils.CamelizeOption;
import static org.openapitools.codegen.utils.StringUtils.camelize;
public class JavaDubboServerCodegen extends AbstractJavaCodegen {
private final Logger LOGGER = LoggerFactory.getLogger(JavaDubboServerCodegen.class);
public static final String TITLE = "title";
public static final String CONFIG_PACKAGE = "configPackage";
public static final String BASE_PACKAGE = "basePackage";
public static final String INTERFACE_ONLY = "interfaceOnly";
public static final String USE_TAGS = "useTags";
public static final String DUBBO_VERSION = "dubboVersion";
public static final String JAVA_VERSION = "javaVersion";
public static final String SERVICE_INTERFACE = "serviceInterface";
public static final String SERVICE_IMPLEMENTATION = "serviceImplementation";
public static final String USE_GENERIC_RESPONSE = "useGenericResponse";
public static final String REGISTRY_ADDRESS = "registry-address";
@Setter
protected String title = null;
@Getter
@Setter
protected String configPackage = "org.openapitools.configuration";
@Getter
@Setter
protected String basePackage = "org.openapitools";
@Setter
protected boolean interfaceOnly = false;
@Setter
protected boolean useTags = true;
@Setter
protected String javaVersion = "17";
@Setter
protected String dubboVersion = "3.2.18";
@Setter
protected boolean serviceInterface = true;
@Setter
protected boolean serviceImplementation = true;
@Setter
protected boolean useGenericResponse = false;
@Setter
protected String registryAddress = "zookeeper://127.0.0.1:2181";
public JavaDubboServerCodegen() {
super();
modifyFeatureSet(features -> features
.includeDocumentationFeatures(DocumentationFeature.Readme)
.wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML, WireFormatFeature.Custom))
.securityFeatures(EnumSet.of(SecurityFeature.OAuth2_Implicit, SecurityFeature.OAuth2_AuthorizationCode,
SecurityFeature.OAuth2_ClientCredentials, SecurityFeature.OAuth2_Password,
SecurityFeature.ApiKey, SecurityFeature.BasicAuth))
.excludeGlobalFeatures(GlobalFeature.Callbacks, GlobalFeature.LinkObjects, GlobalFeature.ParameterStyling)
.includeSchemaSupportFeatures(SchemaSupportFeature.Polymorphism)
.excludeParameterFeatures(ParameterFeature.Cookie));
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
.stability(Stability.BETA)
.build();
dateLibrary = "java8";
useBeanValidation = false;
serializableModel = true;
outputFolder = "generated-code/java-dubbo";
embeddedTemplateDir = templateDir = "java-dubbo";
invokerPackage = "org.openapitools";
apiPackage = invokerPackage + ".api";
modelPackage = invokerPackage + ".model";
artifactId = "openapi-dubbo";
additionalProperties.put("hideGenerationTimestamp", true);
additionalProperties.put("withXml", false);
importMapping.remove("ApiModel");
importMapping.remove("ApiModelProperty");
setDocumentationProvider(DocumentationProvider.NONE);
setAnnotationLibrary(AnnotationLibrary.NONE);
supportsInheritance = false;
supportsMixins = false;
importMapping.remove("ApiModel");
importMapping.remove("ApiModelProperty");
importMapping.remove("Schema");
importMapping.remove("io.swagger.annotations.ApiModel");
importMapping.remove("io.swagger.annotations.ApiModelProperty");
importMapping.remove("io.swagger.v3.oas.annotations.media.Schema");
typeMapping.clear();
typeMapping.put("integer", "Integer");
typeMapping.put("long", "Long");
typeMapping.put("float", "Float");
typeMapping.put("double", "Double");
typeMapping.put("boolean", "Boolean");
typeMapping.put("string", "String");
typeMapping.put("array", "List");
typeMapping.put("map", "Map");
typeMapping.put("object", "Object");
typeMapping.put("date", "LocalDate");
typeMapping.put("DateTime", "OffsetDateTime");
typeMapping.put("date-time", "OffsetDateTime");
typeMapping.put("number", "BigDecimal");
typeMapping.put("decimal", "BigDecimal");
typeMapping.put("binary", "byte[]");
typeMapping.put("file", "org.springframework.web.multipart.MultipartFile");
typeMapping.put("uuid", "UUID");
typeMapping.put("byte", "byte[]");
typeMapping.put("ByteArray", "byte[]");
typeMapping.put("binary", "byte[]");
typeMapping.put("password", "String");
languageSpecificPrimitives.clear();
languageSpecificPrimitives.add("String");
languageSpecificPrimitives.add("boolean");
languageSpecificPrimitives.add("Boolean");
languageSpecificPrimitives.add("Double");
languageSpecificPrimitives.add("Integer");
languageSpecificPrimitives.add("Long");
languageSpecificPrimitives.add("Float");
languageSpecificPrimitives.add("Object");
languageSpecificPrimitives.add("List");
languageSpecificPrimitives.add("Map");
languageSpecificPrimitives.add("Set");
importMapping.put("List", "java.util.List");
importMapping.put("Map", "java.util.Map");
importMapping.put("Set", "java.util.Set");
importMapping.put("ArrayList", "java.util.ArrayList");
importMapping.put("HashMap", "java.util.HashMap");
importMapping.put("HashSet", "java.util.HashSet");
importMapping.put("Date", "java.util.Date");
importMapping.put("Arrays", "java.util.Arrays");
importMapping.put("OffsetDateTime", "java.time.OffsetDateTime");
importMapping.put("LocalDate", "java.time.LocalDate");
importMapping.put("LocalTime", "java.time.LocalTime");
importMapping.put("LocalDateTime", "java.time.LocalDateTime");
importMapping.put("BigDecimal", "java.math.BigDecimal");
importMapping.put("BigInteger", "java.math.BigInteger");
importMapping.put("UUID", "java.util.UUID");
importMapping.put("MultipartFile", "org.springframework.web.multipart.MultipartFile");
typeMapping.put("List", "List");
typeMapping.put("Set", "Set");
typeMapping.put("Map", "Map");
updateOption(CodegenConstants.INVOKER_PACKAGE, this.getInvokerPackage());
updateOption(CodegenConstants.ARTIFACT_ID, this.getArtifactId());
updateOption(CodegenConstants.API_PACKAGE, apiPackage);
updateOption(CodegenConstants.MODEL_PACKAGE, modelPackage);
apiTestTemplateFiles.clear();
apiTemplateFiles.clear();
apiTemplateFiles.put("api.mustache", ".java");
apiTemplateFiles.put("apiDubbo.mustache", ".java");
apiTemplateFiles.put("apiController.mustache", ".java");
apiDocTemplateFiles.clear();
modelTemplateFiles.clear();
modelTemplateFiles.put("model.mustache", ".java");
modelDocTemplateFiles.clear();
additionalProperties.put("dubboVersion", dubboVersion);
additionalProperties.put("javaVersion", javaVersion);
cliOptions.add(new CliOption(TITLE, "API title name").defaultValue(title));
cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code")
.defaultValue(this.getConfigPackage()));
cliOptions.add(new CliOption(BASE_PACKAGE, "base package (invokerPackage) for generated code")
.defaultValue(this.getBasePackage()));
cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY,
"Whether to generate only API interface stubs without the server files.", interfaceOnly));
cliOptions.add(CliOption.newBoolean(USE_TAGS, "use tags for creating interface and controller classnames", useTags));
cliOptions.add(new CliOption(DUBBO_VERSION, "Dubbo version").defaultValue(dubboVersion));
cliOptions.add(new CliOption(JAVA_VERSION, "Java version").defaultValue(javaVersion));
cliOptions.add(CliOption.newBoolean(SERVICE_INTERFACE, "Generate service interface", serviceInterface));
cliOptions.add(CliOption.newBoolean(SERVICE_IMPLEMENTATION, "Generate service implementation", serviceImplementation));
cliOptions.add(CliOption.newBoolean(USE_GENERIC_RESPONSE, "Use generic response wrapper", useGenericResponse));
cliOptions.add(new CliOption(REGISTRY_ADDRESS, "Registry address (e.g., zookeeper://127.0.0.1:2181 or nacos://127.0.0.1:8848)")
.defaultValue(registryAddress));
}
@Override
public CodegenType getTag() {
return CodegenType.SERVER;
}
@Override
public String getName() {
return "java-dubbo";
}
@Override
public String getHelp() {
return "Generates a Java Apache Dubbo server application.";
}
private boolean isOutputFolderPointingToSourceDirectory() {
if (outputFolder == null) {
return false;
}
String normalizedPath = outputFolder.replace('\\', '/');
return normalizedPath.endsWith("/src/main/java") || normalizedPath.endsWith("src/main/java");
}
@Override
public String outputFolder() {
if (isOutputFolderPointingToSourceDirectory()) {
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
for (StackTraceElement element : stackTrace) {
String methodName = element.getMethodName();
String className = element.getClassName();
if (className.equals("org.openapitools.codegen.DefaultGenerator")) {
if (methodName.equals("generateVersionMetadata") ||
methodName.equals("generateFilesMetadata")) {
return outputFolder + File.separator + ".." + File.separator + ".." + File.separator + "..";
}
}
}
}
return outputFolder;
}
public String getIgnoreFileOutputPath() {
if (isOutputFolderPointingToSourceDirectory()) {
return outputFolder + File.separator + ".." + File.separator + ".." + File.separator + "..";
}
return outputFolder;
}
@Override
public void processOpts() {
final List<org.apache.commons.lang3.tuple.Pair<String, String>> configOptions =
additionalProperties.entrySet().stream()
.filter(e -> !Arrays.asList("hideGenerationTimestamp").contains(e.getKey()))
.filter(e -> cliOptions.stream().map(CliOption::getOpt).anyMatch(opt -> opt.equals(e.getKey())))
.map(e -> org.apache.commons.lang3.tuple.Pair.of(e.getKey(), e.getValue().toString()))
.collect(Collectors.toList());
additionalProperties.put("configOptions", configOptions);
super.processOpts();
supportingFiles.removeIf(sf -> sf.getDestinationFilename().equals(".openapi-generator-ignore"));
openapiGeneratorIgnoreList = new HashSet<>();
openapiGeneratorIgnoreList.add("# Dubbo generator explicitly disables .openapi-generator-ignore");
importMapping.remove("ApiModel");
importMapping.remove("ApiModelProperty");
importMapping.remove("io.swagger.annotations.ApiModel");
importMapping.remove("io.swagger.annotations.ApiModelProperty");
importMapping.remove("Schema");
importMapping.remove("io.swagger.v3.oas.annotations.media.Schema");
String userTitle = (String) additionalProperties.get(TITLE);
boolean userProvidedTitle = userTitle != null && !userTitle.equals("OpenAPI Dubbo");
if (userProvidedTitle) {
this.title = userTitle;
}
additionalProperties.put("userProvidedTitle", userProvidedTitle);
additionalProperties.put("title", this.title);
if (additionalProperties.containsKey(CONFIG_PACKAGE)) {
this.setConfigPackage((String) additionalProperties.get(CONFIG_PACKAGE));
}
if (additionalProperties.containsKey(BASE_PACKAGE)) {
String basePackageName = (String) additionalProperties.get(BASE_PACKAGE);
this.setBasePackage(basePackageName);
this.setInvokerPackage(basePackageName);
this.apiPackage = basePackageName + ".api";
this.modelPackage = basePackageName + ".model";
if (!additionalProperties.containsKey(CONFIG_PACKAGE)) {
this.configPackage = basePackageName + ".configuration";
}
updateOption(CodegenConstants.API_PACKAGE, this.apiPackage);
updateOption(CodegenConstants.MODEL_PACKAGE, this.modelPackage);
updateOption(CodegenConstants.INVOKER_PACKAGE, this.getInvokerPackage());
}
if (additionalProperties.containsKey(INTERFACE_ONLY)) {
this.interfaceOnly = Boolean.parseBoolean(additionalProperties.get(INTERFACE_ONLY).toString());
}
if (additionalProperties.containsKey(USE_TAGS)) {
this.useTags = Boolean.parseBoolean(additionalProperties.get(USE_TAGS).toString());
}
if (additionalProperties.containsKey(DUBBO_VERSION)) {
this.dubboVersion = (String) additionalProperties.get(DUBBO_VERSION);
}
if (additionalProperties.containsKey(JAVA_VERSION)) {
this.javaVersion = (String) additionalProperties.get(JAVA_VERSION);
}
if (additionalProperties.containsKey(SERVICE_INTERFACE)) {
this.serviceInterface = Boolean.parseBoolean(additionalProperties.get(SERVICE_INTERFACE).toString());
}
if (additionalProperties.containsKey(SERVICE_IMPLEMENTATION)) {
this.serviceImplementation = Boolean.parseBoolean(additionalProperties.get(SERVICE_IMPLEMENTATION).toString());
}
if (additionalProperties.containsKey(USE_GENERIC_RESPONSE)) {
this.useGenericResponse = Boolean.parseBoolean(additionalProperties.get(USE_GENERIC_RESPONSE).toString());
}
if (additionalProperties.containsKey(REGISTRY_ADDRESS)) {
this.registryAddress = (String) additionalProperties.get(REGISTRY_ADDRESS);
}
additionalProperties.put("title", this.title);
additionalProperties.put("configPackage", this.configPackage);
additionalProperties.put("basePackage", this.basePackage);
additionalProperties.put("apiPackage", this.apiPackage);
additionalProperties.put("modelPackage", this.modelPackage);
additionalProperties.put("invokerPackage", this.getInvokerPackage());
additionalProperties.put("interfaceOnly", interfaceOnly);
additionalProperties.put("useTags", useTags);
additionalProperties.put("dubboVersion", dubboVersion);
additionalProperties.put("javaVersion", javaVersion);
additionalProperties.put("serviceInterface", serviceInterface);
additionalProperties.put("serviceImplementation", serviceImplementation);
additionalProperties.put("useGenericResponse", useGenericResponse);
additionalProperties.put("registryAddress", registryAddress);
supportingFiles.clear();
if (isOutputFolderPointingToSourceDirectory()) {
String rootPath = ".." + File.separator + ".." + File.separator + "..";
supportingFiles.add(new SupportingFile("pom.mustache", rootPath, "pom.xml"));
supportingFiles.add(new SupportingFile("README.mustache", rootPath, "README.md"));
} else {
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
}
if (serviceImplementation && !interfaceOnly) {
String mainClassName;
boolean isUserTitle = (Boolean) additionalProperties.getOrDefault("userProvidedTitle", false);
if (isUserTitle) {
String titleName = (String) additionalProperties.get(TITLE);
mainClassName = (camelize(titleName.trim(), CamelizeOption.UPPERCASE_FIRST_CHAR) + "Application").replaceAll("\\s+", "");
;
} else {
mainClassName = "OpenApiGeneratorApplication";
}
String testClassName = mainClassName + "Tests";
additionalProperties.put("mainClassName", mainClassName);
additionalProperties.put("testClassName", testClassName);
if (isOutputFolderPointingToSourceDirectory()) {
supportingFiles.add(new SupportingFile("mainApplication.mustache",
basePackage.replace(".", File.separator),
mainClassName + ".java"));
supportingFiles.add(new SupportingFile("applicationTest.mustache",
".." + File.separator + ".." + File.separator + ".." + File.separator + "src" + File.separator + "test" + File.separator + "java" + File.separator + basePackage.replace(".", File.separator),
testClassName + ".java"));
supportingFiles.add(new SupportingFile("application.mustache",
".." + File.separator + ".." + File.separator + ".." + File.separator + "src" + File.separator + "main" + File.separator + "resources",
"application.yml"));
} else {
supportingFiles.add(new SupportingFile("mainApplication.mustache",
(sourceFolder + File.separator + basePackage).replace(".", File.separator),
mainClassName + ".java"));
supportingFiles.add(new SupportingFile("applicationTest.mustache",
(testFolder + File.separator + basePackage).replace(".", File.separator),
testClassName + ".java"));
supportingFiles.add(new SupportingFile("application.mustache",
"src/main/resources".replace("/", File.separator),
"application.yml"));
}
}
additionalProperties.put("lambdaTrimWhitespace", new TrimWhitespaceLambda());
additionalProperties.put("documentationProvider", "none");
additionalProperties.put("annotationLibrary", "none");
additionalProperties.put("hideGenerationTimestamp", true);
additionalProperties.put("useBeanValidation", false);
additionalProperties.put("performBeanValidation", false);
}
private boolean isDubbo33OrHigher(String version) {
if (version == null || version.trim().isEmpty()) {
return false;
}
try {
String cleanVersion = version.split("-")[0];
String[] parts = cleanVersion.split("\\.");
if (parts.length >= 2) {
int major = Integer.parseInt(parts[0]);
int minor = Integer.parseInt(parts[1]);
return major > 3 || (major == 3 && minor >= 3);
}
} catch (NumberFormatException e) {
LOGGER.warn("Unable to parse Dubbo version: " + version);
}
return false;
}
@Override
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
generateYAMLSpecFile(objs);
objs = super.postProcessSupportingFileData(objs);
objs.put("interfacePackage", apiPackage + ".interfaces");
objs.put("consumerPackage", apiPackage + ".consumer");
objs.put("providerPackage", apiPackage + ".provider");
objs.put("registryAddress", registryAddress);
boolean isDubbo33Plus = isDubbo33OrHigher(dubboVersion);
objs.put("isDubbo33Plus", isDubbo33Plus);
boolean isZookeeperRegistry = registryAddress != null && registryAddress.startsWith("zookeeper://");
boolean isNacosRegistry = registryAddress != null && registryAddress.startsWith("nacos://");
objs.put("isZookeeperRegistry", isZookeeperRegistry);
objs.put("isNacosRegistry", isNacosRegistry);
String nacosClientVersion = isDubbo33Plus ? "2.5.0" : "2.2.4";
objs.put("nacosClientVersion", nacosClientVersion);
return objs;
}
@Override
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) {
OperationsMap results = super.postProcessOperationsWithModels(objs, allModels);
if (results.getImports() != null) {
boolean hasJavaUtilImports = false;
Iterator<Map<String, String>> importIterator = results.getImports().iterator();
while (importIterator.hasNext()) {
Map<String, String> importMap = importIterator.next();
String importName = importMap.get("import");
if (importName != null && importName.startsWith("java.util.") &&
!importName.equals("java.util.*") &&
!importName.equals("java.util.UUID")) {
importIterator.remove();
hasJavaUtilImports = true;
}
}
if (hasJavaUtilImports) {
Map<String, String> utilImport = new HashMap<>();
utilImport.put("import", "java.util.*");
utilImport.put("classname", "*");
results.getImports().add(utilImport);
}
}
OperationMap operations = results.getOperations();
if (operations != null) {
String baseName = (String) operations.get("baseName");
String originalClassName = (String) operations.get("classname");
if (baseName == null) {
baseName = originalClassName;
if (baseName != null && baseName.endsWith("Service")) {
baseName = baseName.substring(0, baseName.length() - 7).toLowerCase(java.util.Locale.ROOT);
} else if (baseName != null && baseName.endsWith("Api")) {
baseName = baseName.substring(0, baseName.length() - 3).toLowerCase(java.util.Locale.ROOT);
}
}
if (baseName != null) {
if ("ashares".equals(baseName)) {
operations.put("baseName", "a");
} else if ("usdata".equals(baseName)) {
operations.put("baseName", "us");
} else if ("kline".equals(baseName)) {
operations.put("baseName", "kline");
}
}
if (originalClassName != null) {
String serviceName = originalClassName;
if (serviceName.endsWith("Api")) {
serviceName = serviceName.replace("Api", "Service");
} else if (serviceName.endsWith("Service")) {
serviceName = originalClassName;
}
operations.put("serviceName", serviceName);
operations.put("serviceVarName", camelize(serviceName, LOWERCASE_FIRST_LETTER));
operations.put("servicePackage", apiPackage + ".interfaces");
operations.put("serviceImport", apiPackage + ".interfaces." + serviceName);
operations.put("interfacePackage", apiPackage + ".interfaces");
operations.put("consumerPackage", apiPackage + ".consumer");
operations.put("providerPackage", apiPackage + ".provider");
}
List<CodegenOperation> ops = operations.getOperation();
for (CodegenOperation operation : ops) {
if (useGenericResponse) {
operation.vendorExtensions.put("x-generic-response", true);
}
}
}
results.put("interfacePackage", apiPackage + ".interfaces");
results.put("consumerPackage", apiPackage + ".consumer");
results.put("providerPackage", apiPackage + ".provider");
return results;
}
@Override
public String apiFileFolder() {
if (isOutputFolderPointingToSourceDirectory()) {
return outputFolder + File.separator + apiPackage().replace('.', File.separatorChar);
} else {
return outputFolder + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + apiPackage().replace('.', File.separatorChar);
}
}
public String getFileFolderForTemplate(String templateName) {
String baseFolder;
if (isOutputFolderPointingToSourceDirectory()) {
baseFolder = outputFolder + File.separator + apiPackage().replace('.', File.separatorChar);
} else {
baseFolder = outputFolder + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + apiPackage().replace('.', File.separatorChar);
}
if ("api.mustache".equals(templateName)) {
return baseFolder + File.separator + "interfaces";
} else if ("apiController.mustache".equals(templateName)) {
return baseFolder + File.separator + "consumer";
} else if ("apiDubbo.mustache".equals(templateName)) {
return baseFolder + File.separator + "provider";
}
return baseFolder;
}
public String getPackageForTemplate(String templateName) {
if ("api.mustache".equals(templateName)) {
return apiPackage() + ".interfaces";
} else if ("apiController.mustache".equals(templateName)) {
return apiPackage() + ".consumer";
} else if ("apiDubbo.mustache".equals(templateName)) {
return apiPackage() + ".provider";
}
return apiPackage();
}
@Override
public String modelFileFolder() {
if (isOutputFolderPointingToSourceDirectory()) {
return outputFolder + File.separator + modelPackage().replace('.', File.separatorChar);
} else {
return outputFolder + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator + modelPackage().replace('.', File.separatorChar);
}
}
@Override
public String apiFilename(String templateName, String tag) {
String suffix = apiTemplateFiles().get(templateName);
if (suffix == null) {
return null;
}
String folder = getFileFolderForTemplate(templateName);
String filename;
String apiName = toApiName(tag);
if ("api.mustache".equals(templateName)) {
filename = apiName;
} else if ("apiDubbo.mustache".equals(templateName)) {
filename = apiName + "Impl";
} else if ("apiController.mustache".equals(templateName)) {
filename = apiName + "Controller";
} else {
filename = toApiFilename(tag);
}
return folder + File.separator + filename + suffix;
}
@Override
public String toApiName(String name) {
if (name.length() == 0) {
return "DefaultService";
}
name = sanitizeName(name);
String apiName = camelize(name, CamelizeOption.UPPERCASE_FIRST_CHAR);
if (!apiName.endsWith("Service")) {
apiName = apiName + "Service";
}
return apiName;
}
@Override
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
if (useTags) {
String basePath = resourcePath;
if (basePath.startsWith("/")) {
basePath = basePath.substring(1);
}
int pos = basePath.indexOf("/");
if (pos > 0) {
basePath = basePath.substring(0, pos);
}
if (basePath.length() == 0) {
basePath = "default";
} else {
String subPath = resourcePath;
if (subPath.startsWith("/" + basePath)) {
subPath = subPath.substring(("/" + basePath).length());
}
if (subPath.isEmpty()) {
subPath = "/";
}
co.vendorExtensions.put("x-sub-path", subPath);
co.subresourceOperation = !subPath.equals("/");
co.vendorExtensions.put("x-base-path", "/" + basePath);
if ("a".equals(basePath)) {
basePath = "ashares";
} else if ("us".equals(basePath)) {
basePath = "usdata";
}
}
List<CodegenOperation> opList = operations.computeIfAbsent(basePath, k -> new ArrayList<>());
opList.add(co);
co.baseName = basePath;
} else {
super.addOperationToGroup(tag, resourcePath, operation, co, operations);
}
}
@Override
public boolean isDataTypeString(String dataType) {
return "String".equals(dataType);
}
@Override
public String getTypeDeclaration(Schema p) {
if (ModelUtils.isArraySchema(p)) {
Schema inner = ModelUtils.getSchemaItems(p);
String innerType = getTypeDeclaration(inner);
return "List<" + innerType + ">";
} else if (ModelUtils.isMapSchema(p)) {
Schema inner = ModelUtils.getAdditionalProperties(p);
String innerType = getTypeDeclaration(inner);
return "Map<String, " + innerType + ">";
}
return super.getTypeDeclaration(p);
}
@Override
public String getSchemaType(Schema p) {
String openAPIType = super.getSchemaType(p);
if (typeMapping.containsKey(openAPIType)) {
return typeMapping.get(openAPIType);
}
return openAPIType;
}
@Override
public Set<String> defaultIncludes() {
return new HashSet<String>(
Arrays.asList(
"double",
"int",
"long",
"short",
"char",
"float",
"String",
"boolean",
"Boolean",
"Double",
"Void",
"Integer",
"Long",
"Float")
);
}
@Override
public String toModelImport(String name) {
if ("ApiModel".equals(name) || "ApiModelProperty".equals(name)) {
return null;
}
if ("".equals(modelPackage())) {
return name;
} else {
return modelPackage() + "." + name;
}
}
@Override
public String getTypeDeclaration(String name) {
if ("ApiModel".equals(name) || "ApiModelProperty".equals(name)) {
return null;
}
return super.getTypeDeclaration(name);
}
@Override
public boolean needToImport(String type) {
if ("ApiModel".equals(type) ||
"ApiModelProperty".equals(type) ||
"io.swagger.annotations.ApiModel".equals(type) ||
"io.swagger.annotations.ApiModelProperty".equals(type) ||
"Schema".equals(type) ||
"io.swagger.v3.oas.annotations.media.Schema".equals(type)) {
return false;
}
if ("LocalDate".equals(type) ||
"LocalDateTime".equals(type) ||
"LocalTime".equals(type) ||
"OffsetDateTime".equals(type) ||
"BigDecimal".equals(type) ||
"BigInteger".equals(type) ||
"UUID".equals(type)) {
return true;
}
return super.needToImport(type);
}
@Override
public ModelsMap postProcessModels(ModelsMap objs) {
objs = super.postProcessModels(objs);
for (ModelMap modelMap : objs.getModels()) {
CodegenModel model = modelMap.getModel();
model.imports.remove("ApiModel");
model.imports.remove("ApiModelProperty");
model.imports.remove("io.swagger.annotations.ApiModel");
model.imports.remove("io.swagger.annotations.ApiModelProperty");
model.imports.remove("Schema");
model.imports.remove("io.swagger.v3.oas.annotations.media.Schema");
boolean hasJavaUtilImports = false;
Set<String> javaUtilImports = new HashSet<>();
Iterator<String> iterator = model.imports.iterator();
while (iterator.hasNext()) {
String importName = iterator.next();
if (importName.startsWith("java.util.") &&
!importName.equals("java.util.*") &&
!importName.equals("java.util.UUID")) {
javaUtilImports.add(importName);
iterator.remove();
hasJavaUtilImports = true;
}
}
if (hasJavaUtilImports) {
model.imports.add("java.util.*");
}
for (CodegenProperty var : model.vars) {
if (var.allowableValues != null && var.allowableValues.get("imports") != null) {
((Set<String>) var.allowableValues.get("imports")).remove("ApiModel");
((Set<String>) var.allowableValues.get("imports")).remove("ApiModelProperty");
((Set<String>) var.allowableValues.get("imports")).remove("io.swagger.annotations.ApiModel");
((Set<String>) var.allowableValues.get("imports")).remove("io.swagger.annotations.ApiModelProperty");
}
}
}
if (objs.getImports() != null) {
objs.getImports().removeIf(importMap -> {
String className = importMap.get("classname");
return "ApiModel".equals(className) || "ApiModelProperty".equals(className);
});
boolean hasJavaUtilImports = false;
Iterator<Map<String, String>> importIterator = objs.getImports().iterator();
while (importIterator.hasNext()) {
Map<String, String> importMap = importIterator.next();
String importName = importMap.get("import");
if (importName != null && importName.startsWith("java.util.") &&
!importName.equals("java.util.*") &&
!importName.equals("java.util.UUID")) {
importIterator.remove();
hasJavaUtilImports = true;
}
}
if (hasJavaUtilImports) {
Map<String, String> utilImport = new HashMap<>();
utilImport.put("import", "java.util.*");
utilImport.put("classname", "*");
objs.getImports().add(utilImport);
}
}
return objs;
}
@Override
public String toModelDocFilename(String name) {
return null;
}
@Override
public String toApiDocFilename(String name) {
return null;
}
}

View File

@@ -18,6 +18,7 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.media.Schema;
import java.util.Locale;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
@@ -37,6 +38,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
public static final String INTERFACE_ONLY = "interfaceOnly";
public static final String RETURN_RESPONSE = "returnResponse";
public static final String RETURN_JBOSS_RESPONSE = "returnJBossResponse";
public static final String GENERATE_POM = "generatePom";
public static final String USE_SWAGGER_ANNOTATIONS = "useSwaggerAnnotations";
public static final String USE_MICROPROFILE_OPENAPI_ANNOTATIONS = "useMicroProfileOpenAPIAnnotations";
@@ -52,6 +54,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
private boolean interfaceOnly = false;
private boolean returnResponse = false;
private boolean returnJbossResponse = false;
private boolean generatePom = true;
private boolean useSwaggerAnnotations = true;
private boolean useMicroProfileOpenAPIAnnotations = false;
@@ -128,6 +131,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
cliOptions.add(CliOption.newBoolean(GENERATE_POM, "Whether to generate pom.xml if the file does not already exist.").defaultValue(String.valueOf(generatePom)));
cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.").defaultValue(String.valueOf(interfaceOnly)));
cliOptions.add(CliOption.newBoolean(RETURN_RESPONSE, "Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.").defaultValue(String.valueOf(returnResponse)));
cliOptions.add(CliOption.newBoolean(RETURN_JBOSS_RESPONSE, "Whether generate API interface should return `org.jboss.resteasy.reactive.RestResponse` instead of a deserialized entity. This flag cannot be combined with `returnResponse` flag. It requires the flag `interfaceOnly` and `useJakartaEE` set to true, because `org.jboss.resteasy.reactive.RestResponse` was introduced in Quarkus 2.x").defaultValue(String.valueOf(returnJbossResponse)));
cliOptions.add(CliOption.newBoolean(USE_SWAGGER_ANNOTATIONS, "Whether to generate Swagger annotations.", useSwaggerAnnotations));
cliOptions.add(CliOption.newBoolean(USE_MICROPROFILE_OPENAPI_ANNOTATIONS, "Whether to generate Microprofile OpenAPI annotations. Only valid when library is set to quarkus.", useMicroProfileOpenAPIAnnotations));
cliOptions.add(CliOption.newString(OPEN_API_SPEC_FILE_LOCATION, "Location where the file containing the spec will be generated in the output folder. No file generated when set to null or empty string."));
@@ -142,6 +146,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
convertPropertyToBooleanAndWriteBack(INTERFACE_ONLY, value -> interfaceOnly = value);
convertPropertyToBooleanAndWriteBack(RETURN_RESPONSE, value -> returnResponse = value);
convertPropertyToBooleanAndWriteBack(RETURN_JBOSS_RESPONSE, value -> returnJbossResponse = value);
convertPropertyToBooleanAndWriteBack(SUPPORT_ASYNC, this::setSupportAsync);
if (QUARKUS_LIBRARY.equals(library) || THORNTAIL_LIBRARY.equals(library) || HELIDON_LIBRARY.equals(library) || OPEN_LIBERTY_LIBRARY.equals(library) || KUMULUZEE_LIBRARY.equals(library)) {
useSwaggerAnnotations = false;
@@ -218,6 +223,18 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
.doNotOverwrite());
supportingFiles.add(new SupportingFile("dockerignore.mustache", "", ".dockerignore")
.doNotOverwrite());
if(returnResponse && returnJbossResponse) {
String msg = String.format(Locale.ROOT,
"You cannot combine [%s] and [%s] since they are mutually exclusive",
RETURN_RESPONSE, RETURN_JBOSS_RESPONSE);
throw new IllegalArgumentException(msg);
}
if(returnJbossResponse && !useJakartaEe) {
String msg = String.format(Locale.ROOT,
"The [%s] requires [%s] to be true, because org.jboss.resteasy.reactive.RestResponse was introduced in Quarkus 2.x",
RETURN_JBOSS_RESPONSE, USE_JAKARTA_EE);
throw new IllegalArgumentException(msg);
}
} else if (OPEN_LIBERTY_LIBRARY.equals(library)) {
supportingFiles.add(new SupportingFile("server.xml.mustache", "src/main/liberty/config", "server.xml")
.doNotOverwrite());

View File

@@ -642,7 +642,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
typeMapping.put("Date", "LocalDate");
typeMapping.put("Time", "LocalTime");
importMapping.put("Instant", "kotlinx.datetime.Instant");
importMapping.put("Instant", "kotlin.time.Instant");
importMapping.put("LocalDate", "kotlinx.datetime.LocalDate");
importMapping.put("LocalTime", "kotlinx.datetime.LocalTime");
}
@@ -887,7 +887,6 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
// multiplatform specific supporting files
supportingFiles.add(new SupportingFile("infrastructure/Base64ByteArray.kt.mustache", infrastructureFolder, "Base64ByteArray.kt"));
supportingFiles.add(new SupportingFile("infrastructure/Bytes.kt.mustache", infrastructureFolder, "Bytes.kt"));
supportingFiles.add(new SupportingFile("infrastructure/HttpResponse.kt.mustache", infrastructureFolder, "HttpResponse.kt"));
supportingFiles.add(new SupportingFile("infrastructure/OctetByteArray.kt.mustache", infrastructureFolder, "OctetByteArray.kt"));

View File

@@ -418,6 +418,11 @@ public class KotlinServerCodegen extends AbstractKotlinCodegen implements BeanVa
}
doDataTypeAssignment(resp.dataType, new DataTypeAssigner() {
@Override
public void setIsVoid(Boolean isVoid) {
resp.isVoid = isVoid;
}
@Override
public void setReturnType(final String returnType) {
resp.dataType = returnType;
@@ -432,6 +437,10 @@ public class KotlinServerCodegen extends AbstractKotlinCodegen implements BeanVa
}
doDataTypeAssignment(operation.returnType, new DataTypeAssigner() {
@Override
public void setIsVoid(Boolean isVoid) {
operation.isVoid = isVoid;
}
@Override
public void setReturnType(final String returnType) {

View File

@@ -880,6 +880,11 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
resp.baseType = getNonMutableContainerTypeIfNeeded(resp.baseType);
doDataTypeAssignment(resp.dataType, new DataTypeAssigner() {
@Override
public void setIsVoid(Boolean isVoid) {
resp.isVoid = isVoid;
}
@Override
public void setReturnType(final String returnType) {
resp.dataType = returnType;
@@ -904,6 +909,10 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
}
doDataTypeAssignment(operation.returnType, new DataTypeAssigner() {
@Override
public void setIsVoid(Boolean isVoid) {
operation.isVoid = isVoid;
}
@Override
public void setReturnType(final String returnType) {
@@ -1003,6 +1012,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
extensions.add(VendorExtension.X_DISCRIMINATOR_VALUE);
extensions.add(VendorExtension.X_FIELD_EXTRA_ANNOTATION);
extensions.add(VendorExtension.X_PATTERN_MESSAGE);
extensions.add(VendorExtension.X_KOTLIN_IMPLEMENTS);
extensions.add(VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS);
return extensions;
}

View File

@@ -48,6 +48,7 @@ public class PythonClientCodegen extends AbstractPythonCodegen implements Codege
public static final String DATE_FORMAT = "dateFormat";
public static final String SET_ENSURE_ASCII_TO_FALSE = "setEnsureAsciiToFalse";
public static final String POETRY1_FALLBACK = "poetry1";
public static final String LAZY_IMPORTS = "lazyImports";
@Setter protected String packageUrl;
protected String apiDocPath = "docs/";
@@ -151,6 +152,7 @@ public class PythonClientCodegen extends AbstractPythonCodegen implements Codege
.defaultValue("%Y-%m-%d"));
cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC).defaultValue("false"));
cliOptions.add(new CliOption(POETRY1_FALLBACK, "Fallback to formatting pyproject.toml to Poetry 1.x format."));
cliOptions.add(new CliOption(LAZY_IMPORTS, "Enable lazy imports.").defaultValue(Boolean.FALSE.toString()));
supportedLibraries.put("urllib3", "urllib3-based client");
supportedLibraries.put("asyncio", "asyncio-based client");
@@ -264,6 +266,10 @@ public class PythonClientCodegen extends AbstractPythonCodegen implements Codege
additionalProperties.put(DATE_FORMAT, dateFormat);
}
if (additionalProperties.containsKey(LAZY_IMPORTS)) {
additionalProperties.put(LAZY_IMPORTS, Boolean.valueOf(additionalProperties.get(LAZY_IMPORTS).toString()));
}
String modelPath = packagePath() + File.separatorChar + modelPackage.replace('.', File.separatorChar);
String apiPath = packagePath() + File.separatorChar + apiPackage.replace('.', File.separatorChar);

View File

@@ -19,6 +19,8 @@ package org.openapitools.codegen.languages;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.ModelsMap;
@@ -61,6 +63,10 @@ public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements Cod
)
);
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
.stability(Stability.DEPRECATED)
.build();
outputFolder = "generated-code/scala-lagom-server";
modelTemplateFiles.put("model.mustache", ".scala");
apiTemplateFiles.put("api.mustache", ".scala");
@@ -149,12 +155,12 @@ public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements Cod
@Override
public String getName() {
return "scala-lagom-server";
return "scala-lagom-server-deprecated";
}
@Override
public String getHelp() {
return "Generates a Lagom API server (Beta) in scala";
return "Generates a Lagom API server (Beta) in scala. IMPORTANT: this generator has been deprecated";
}
@Override
@@ -220,6 +226,4 @@ public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements Cod
}
return objs;
}
}
}

View File

@@ -99,6 +99,7 @@ public class SpringCodegen extends AbstractJavaCodegen
public static final String USE_SEALED = "useSealed";
public static final String OPTIONAL_ACCEPT_NULLABLE = "optionalAcceptNullable";
public static final String USE_SPRING_BUILT_IN_VALIDATION = "useSpringBuiltInValidation";
public static final String USE_DEDUCTION_FOR_ONE_OF_INTERFACES = "useDeductionForOneOfInterfaces";
@Getter
public enum RequestMappingMode {
@@ -159,6 +160,8 @@ public class SpringCodegen extends AbstractJavaCodegen
protected boolean optionalAcceptNullable = true;
@Getter @Setter
protected boolean useSpringBuiltInValidation = false;
@Getter @Setter
protected boolean useDeductionForOneOfInterfaces = false;
public SpringCodegen() {
super();
@@ -282,6 +285,7 @@ public class SpringCodegen extends AbstractJavaCodegen
"Use `ofNullable` instead of just `of` to accept null values when using Optional.",
optionalAcceptNullable));
cliOptions.add(CliOption.newBoolean(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "whether to use deduction for generated oneOf interfaces", useDeductionForOneOfInterfaces));
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
supportedLibraries.put(SPRING_CLOUD_LIBRARY,
"Spring-Cloud-Feign client with Spring-Boot auto-configured settings.");
@@ -449,6 +453,7 @@ public class SpringCodegen extends AbstractJavaCodegen
}
convertPropertyToBooleanAndWriteBack(OPTIONAL_ACCEPT_NULLABLE, this::setOptionalAcceptNullable);
convertPropertyToBooleanAndWriteBack(USE_SPRING_BUILT_IN_VALIDATION, this::setUseSpringBuiltInValidation);
convertPropertyToBooleanAndWriteBack(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, this::setUseDeductionForOneOfInterfaces);
additionalProperties.put("springHttpStatus", new SpringHttpStatusLambda());

View File

@@ -2179,6 +2179,22 @@ public class ModelUtils {
}
}
/**
* Set schema type.
* For 3.1 spec, set as types, for 3.0, type
*
* @param schema the schema
* @return schema type
*/
public static void setType(Schema schema, String type) {
if (schema instanceof JsonSchema) {
schema.setTypes(null);
schema.addType(type);
} else {
schema.setType(type);
}
}
/**
* Returns true if any of the common attributes of the schema (e.g. readOnly, default, maximum, etc) is defined.
*

View File

@@ -114,10 +114,10 @@ if(hasProperty('target') && target == 'android') {
ext {
swagger_annotations_version = "1.6.3"
jackson_version = "2.17.1"
jackson_databind_version = "2.17.1"
jackson_version = "2.19.2"
jackson_databind_version = "2.19.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.7"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
{{#useBeanValidation}}

View File

@@ -114,10 +114,10 @@ if(hasProperty('target') && target == 'android') {
ext {
swagger_annotations_version = "1.6.6"
jackson_version = "2.17.1"
jackson_databind_version = "2.17.1"
jackson_version = "2.19.2"
jackson_databind_version = "2.19.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.7"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
httpclient_version = "5.1.3"

View File

@@ -351,10 +351,10 @@
<swagger-annotations-version>2.2.15</swagger-annotations-version>
{{/swagger2AnnotationLibrary}}
<httpclient-version>5.2.1</httpclient-version>
<jackson-version>2.17.1</jackson-version>
<jackson-databind-version>2.17.1</jackson-databind-version>
<jackson-version>2.19.2</jackson-version>
<jackson-databind-version>2.19.2</jackson-databind-version>
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
{{/openApiNullable}}
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>

View File

@@ -103,11 +103,11 @@ test {
ext {
swagger_annotations_version = "1.6.11"
{{#jackson}}
jackson_version = "2.17.1"
jackson_databind_version = "2.17.1"
jackson_version = "2.19.2"
jackson_databind_version = "2.19.2"
{{/jackson}}
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.7"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
feign_version = "13.5"

View File

@@ -98,10 +98,10 @@ if(hasProperty('target') && target == 'android') {
ext {
swagger_annotations_version = "1.6.3"
jackson_version = "2.17.1"
jackson_databind_version = "2.17.1"
jackson_version = "2.19.2"
jackson_databind_version = "2.19.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.7"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
google_api_client_version = "1.32.2"

View File

@@ -310,10 +310,10 @@
{{/swagger2AnnotationLibrary}}
<google-api-client-version>2.2.0</google-api-client-version>
<jersey-common-version>2.40</jersey-common-version>
<jackson-version>2.17.1</jackson-version>
<jackson-databind-version>2.17.1</jackson-databind-version>
<jackson-version>2.19.2</jackson-version>
<jackson-databind-version>2.19.2</jackson-databind-version>
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
{{/openApiNullable}}
{{#joda}}
<jodatime-version>2.9.9</jodatime-version>

View File

@@ -104,10 +104,10 @@ ext {
{{#swagger2AnnotationLibrary}}
swagger_annotations_version = "2.2.15"
{{/swagger2AnnotationLibrary}}
jackson_version = "2.17.1"
jackson_databind_version = "2.17.1"
jackson_version = "2.19.2"
jackson_databind_version = "2.19.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.7"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
{{#useBeanValidation}}

View File

@@ -16,15 +16,15 @@ lazy val root = (project in file(".")).
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.35",
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.35",
"org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35",
"com.fasterxml.jackson.core" % "jackson-core" % "2.17.1" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.17.1" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.17.1" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.19.2" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.19.2" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.19.2" % "compile",
{{#joda}}
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.17.1" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.19.2" % "compile",
{{/joda}}
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.17.1" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.19.2" % "compile",
{{#openApiNullable}}
"org.openapitools" % "jackson-databind-nullable" % "0.2.6" % "compile",
"org.openapitools" % "jackson-databind-nullable" % "0.2.7" % "compile",
{{/openApiNullable}}
{{#hasOAuthMethods}}
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",

View File

@@ -405,9 +405,9 @@
<swagger-annotations-version>2.2.15</swagger-annotations-version>
{{/swagger2AnnotationLibrary}}
<jersey-version>2.37</jersey-version>
<jackson-version>2.17.1</jackson-version>
<jackson-databind-version>2.17.1</jackson-databind-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-version>2.19.2</jackson-version>
<jackson-databind-version>2.19.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
<beanvalidation-version>3.0.2</beanvalidation-version>

View File

@@ -99,10 +99,10 @@ if(hasProperty('target') && target == 'android') {
ext {
swagger_annotations_version = "1.6.5"
jackson_version = "2.17.1"
jackson_databind_version = "2.17.1"
jackson_version = "2.19.2"
jackson_databind_version = "2.19.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.7"
{{/openApiNullable}}
jakarta_annotation_version = "2.1.0"
{{#useBeanValidation}}

View File

@@ -16,15 +16,15 @@ lazy val root = (project in file(".")).
"org.glassfish.jersey.media" % "jersey-media-multipart" % "3.0.4",
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "3.0.4",
"org.glassfish.jersey.connectors" % "jersey-apache-connector" % "3.0.4",
"com.fasterxml.jackson.core" % "jackson-core" % "2.17.1" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.17.1" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.17.1" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.19.2" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.19.2" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.19.2" % "compile",
{{#joda}}
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.17.1" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.19.2" % "compile",
{{/joda}}
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.17.1" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.19.2" % "compile",
{{#openApiNullable}}
"org.openapitools" % "jackson-databind-nullable" % "0.2.6" % "compile",
"org.openapitools" % "jackson-databind-nullable" % "0.2.7" % "compile",
{{/openApiNullable}}
{{#hasOAuthMethods}}
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",

View File

@@ -405,9 +405,9 @@
<swagger-annotations-version>2.2.15</swagger-annotations-version>
{{/swagger2AnnotationLibrary}}
<jersey-version>3.1.1</jersey-version>
<jackson-version>2.17.1</jackson-version>
<jackson-databind-version>2.17.1</jackson-databind-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-version>2.19.2</jackson-version>
<jackson-databind-version>2.19.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
<beanvalidation-version>3.0.2</beanvalidation-version>

View File

@@ -72,7 +72,7 @@ ext {
{{#swagger2AnnotationLibrary}}
swagger_annotations_version = "2.2.9"
{{/swagger2AnnotationLibrary}}
jackson_version = "2.17.1"
jackson_version = "2.19.2"
{{#useJakartaEe}}
jakarta_annotation_version = "2.1.1"
beanvalidation_version = "3.0.2"
@@ -102,7 +102,7 @@ dependencies {
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation "org.openapitools:jackson-databind-nullable:0.2.1"
implementation "org.openapitools:jackson-databind-nullable:0.2.7"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
{{#useBeanValidation}}
implementation "jakarta.validation:jakarta.validation-api:$beanvalidation_version"

View File

@@ -299,8 +299,8 @@
{{/swagger2AnnotationLibrary}}
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<jackson-version>2.17.1</jackson-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-version>2.19.2</jackson-version>
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
<beanvalidation-version>3.0.2</beanvalidation-version>

View File

@@ -289,8 +289,8 @@ public class ApiClient {
/**
* Set base path
*
* @param basePath Base path of the URL (e.g {{{basePath}}}
* @return An instance of OkHttpClient
* @param basePath Base path of the URL (e.g {{{basePath}}})
* @return An instance of ApiClient
*/
public ApiClient setBasePath(String basePath) {
this.basePath = basePath;
@@ -338,7 +338,7 @@ public class ApiClient {
* Set HTTP client, which must never be null.
*
* @param newHttpClient An instance of OkHttpClient
* @return Api Client
* @return ApiClient
* @throws java.lang.NullPointerException when newHttpClient is null
*/
public ApiClient setHttpClient(OkHttpClient newHttpClient) {

View File

@@ -132,7 +132,7 @@ dependencies {
implementation 'io.gsonfire:gson-fire:1.9.0'
implementation 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6'
{{#openApiNullable}}
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
implementation 'org.openapitools:jackson-databind-nullable:0.2.7'
{{/openApiNullable}}
{{#withAWSV4Signature}}
implementation 'software.amazon.awssdk:auth:2.20.157'

View File

@@ -16,7 +16,7 @@ lazy val root = (project in file(".")).
"org.apache.commons" % "commons-lang3" % "3.18.0",
"jakarta.ws.rs" % "jakarta.ws.rs-api" % "2.1.6",
{{#openApiNullable}}
"org.openapitools" % "jackson-databind-nullable" % "0.2.6",
"org.openapitools" % "jackson-databind-nullable" % "0.2.7",
{{/openApiNullable}}
{{#withAWSV4Signature}}
"software.amazon.awssdk" % "auth" % "2.20.157",

View File

@@ -416,7 +416,7 @@
<gson-version>2.10.1</gson-version>
<commons-lang3-version>3.18.0</commons-lang3-version>
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
{{/openApiNullable}}
{{#joda}}
<jodatime-version>2.12.0</jodatime-version>

View File

@@ -98,18 +98,18 @@ if(hasProperty('target') && target == 'android') {
ext {
{{#swagger1AnnotationLibrary}}
swagger_annotations_version = "1.6.6"
swagger_annotations_version = "1.6.16"
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
swagger_annotations_version = "2.2.15"
swagger_annotations_version = "2.2.36"
{{/swagger2AnnotationLibrary}}
rest_assured_version = "5.3.2"
rest_assured_version = "5.5.6"
junit_version = "5.10.3"
{{#jackson}}
jackson_version = "2.17.1"
jackson_databind_version = "2.17.1"
jackson_version = "2.19.2"
jackson_databind_version = "2.19.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.7"
{{/openApiNullable}}
{{/jackson}}
{{#gson}}

View File

@@ -9,16 +9,16 @@ lazy val root = (project in file(".")).
Compile / packageDoc / publishArtifact := false,
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.6.6",
"io.rest-assured" % "rest-assured" % "4.5.1",
"io.rest-assured" % "scala-support" % "4.5.1",
"io.swagger" % "swagger-annotations" % "1.6.16",
"io.rest-assured" % "rest-assured" % "5.5.6",
"io.rest-assured" % "scala-support" % "5.5.6",
"com.google.code.findbugs" % "jsr305" % "3.0.2",
{{#jackson}}
"com.fasterxml.jackson.core" % "jackson-core" % "2.13.4",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.4",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.4.2",
"com.fasterxml.jackson.core" % "jackson-core" % "2.19.2",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.19.2",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.19.2",
{{#openApiNullable}}
"org.openapitools" % "jackson-databind-nullable" % "0.2.6",
"org.openapitools" % "jackson-databind-nullable" % "0.2.7",
{{/openApiNullable}}
{{#withXml}}
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.13.4.1",

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