Compare commits

...

50 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
1417 changed files with 33543 additions and 13125 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

@@ -6,12 +6,17 @@ on:
- '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
@@ -23,6 +28,9 @@ jobs:
- '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

@@ -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

@@ -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

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,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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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;
}

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

@@ -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

@@ -1012,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

@@ -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

@@ -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

@@ -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

@@ -106,10 +106,10 @@ ext {
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

@@ -14,11 +14,11 @@ lazy val root = (project in file(".")).
"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",

View File

@@ -352,9 +352,9 @@
<jodatime-version>2.10.5</jodatime-version>
{{/joda}}
{{#jackson}}
<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>
{{/jackson}}
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>

View File

@@ -103,10 +103,10 @@ ext {
{{#swagger2AnnotationLibrary}}
swagger_annotations_version = "2.2.9"
{{/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}}
spring_web_version = "6.1.21"
jakarta_annotation_version = "2.1.1"

View File

@@ -67,7 +67,12 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
{{#gson}}
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}}
{{^isDiscriminator}}
{{>nullable_var_annotations}}{{! prevent indent}}
{{/isDiscriminator}}
{{#isDiscriminator}}
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
{{/isDiscriminator}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}

View File

@@ -347,10 +347,10 @@
<swagger-annotations-version>2.2.15</swagger-annotations-version>
{{/swagger2AnnotationLibrary}}
<spring-web-version>6.1.21</spring-web-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}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
{{#joda}}

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"
threetenbp_version = "2.9.10"

View File

@@ -298,10 +298,10 @@
<swagger-annotations-version>2.2.15</swagger-annotations-version>
{{/swagger2AnnotationLibrary}}
<resteasy-version>4.7.6.Final</resteasy-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

@@ -145,7 +145,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
// Set default User-Agent.
setUserAgent("Java-SDK");
setUserAgent("{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}");
// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}

View File

@@ -115,10 +115,10 @@ ext {
{{#swagger2AnnotationLibrary}}
swagger_annotations_version = "2.2.9"
{{/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}}
{{#useJakartaEe}}
spring_web_version = "6.2.8"

View File

@@ -67,7 +67,12 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{#gson}}
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}}
{{^isDiscriminator}}
{{>nullable_var_annotations}}{{! prevent indent}}
{{/isDiscriminator}}
{{#isDiscriminator}}
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
{{/isDiscriminator}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}

View File

@@ -361,10 +361,10 @@
{{#swagger2AnnotationLibrary}}
<swagger-annotations-version>2.2.15</swagger-annotations-version>
{{/swagger2AnnotationLibrary}}
<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}}
<spring-web-version>6.2.8</spring-web-version>

View File

@@ -100,11 +100,11 @@ ext {
oltu_version = "1.0.1"
retrofit_version = "2.11.0"
{{#jackson}}
jackson_version = "2.17.1"
jackson_databind_version = "2.17.1"
jackson_version = "2.19.2"
jackson_databind_version = "2.19.2"
javax_ws_rs_api_version = "2.1.1"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.7"
{{/openApiNullable}}
{{/jackson}}
{{#usePlayWS}}

View File

@@ -383,10 +383,10 @@
{{/gson}}
<swagger-annotations-version>1.6.3</swagger-annotations-version>
{{#jackson}}
<jackson-databind-version>2.17.1</jackson-databind-version>
<jackson-version>2.17.1</jackson-version>
<jackson-databind-version>2.19.2</jackson-databind-version>
<jackson-version>2.19.2</jackson-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}}
<javax.ws.rs-api-version>2.1.1</javax.ws.rs-api-version>
{{/jackson}}

View File

@@ -30,12 +30,12 @@ task execute(type:JavaExec) {
ext {
swagger_annotations_version = "1.5.21"
jackson_version = "2.17.1"
jackson_databind_version = "2.17.1"
jackson_version = "2.19.2"
jackson_databind_version = "2.19.2"
vertx_version = "{{#supportVertxFuture}}4.0.0{{/supportVertxFuture}}{{^supportVertxFuture}}3.5.2{{/supportVertxFuture}}"
junit_version = "5.10.3"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.7"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
}

View File

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

View File

@@ -144,10 +144,10 @@ ext {
reactor_version = "3.4.34"
reactor_netty_version = "1.2.8"
{{/useJakartaEe}}
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}}
{{#joda}}
jodatime_version = "2.9.9"

View File

@@ -67,7 +67,12 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
{{#gson}}
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}}
{{^isDiscriminator}}
{{>nullable_var_annotations}}{{! prevent indent}}
{{/isDiscriminator}}
{{#isDiscriminator}}
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
{{/isDiscriminator}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}

View File

@@ -167,10 +167,10 @@
{{#swagger2AnnotationLibrary}}
<swagger-annotations-version>2.2.15</swagger-annotations-version>
{{/swagger2AnnotationLibrary}}
<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}}
<spring-boot-version>3.0.12</spring-boot-version>

View File

@@ -3,20 +3,40 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
{{#useAbstractionForFiles}}
import java.io.InputStream;
import java.io.OutputStream;
{{/useAbstractionForFiles}}
import java.util.List;
import java.util.Map;
import {{javaxPackage}}.ws.rs.*;
{{#useGenericResponse}}
import {{javaxPackage}}.ws.rs.core.Response;
{{/useGenericResponse}}
{{#addConsumesProducesJson}}
import {{javaxPackage}}.ws.rs.core.MediaType;
{{/addConsumesProducesJson}}
import org.apache.cxf.jaxrs.ext.multipart.*;
{{#swagger1AnnotationLibrary}}
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ApiResponse;
import io.swagger.jaxrs.PATCH;
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
{{/swagger2AnnotationLibrary}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
@@ -33,7 +53,18 @@ import {{javaxPackage}}.validation.Valid;
*/
{{/appName}}
@Path("{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}{{commonPath}}")
{{#swagger1AnnotationLibrary}}
@Api(value = "/", description = "{{description}}")
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
@OpenAPIDefinition(
info = @Info(
{{#appName}}title = "{{{appName}}}",{{/appName}}
{{#appDescription}}description = "{{{appDescription}}}",{{/appDescription}}
version = "{{{appVersion}}}"
)
)
{{/swagger2AnnotationLibrary}}
{{#addConsumesProducesJson}}
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@@ -60,6 +91,7 @@ public interface {{classname}} {
{{#hasProduces}}
@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} })
{{/hasProduces}}
{{#swagger1AnnotationLibrary}}
@ApiOperation(value = "{{{summary}}}", tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-tags}} })
{{#implicitHeadersParams.0}}
@io.swagger.annotations.ApiImplicitParams({
@@ -70,6 +102,19 @@ public interface {{classname}} {
{{/implicitHeadersParams.0}}
@ApiResponses(value = { {{#responses}}
@ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{^vendorExtensions.x-java-is-response-void}}, response = {{#isFile}}{{#useAbstractionForFiles}}InputStream{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{baseType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{baseType}}}{{/isFile}}.class{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}{{/vendorExtensions.x-java-is-response-void}}){{^-last}},{{/-last}}{{/responses}} })
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
@Operation(operationId = "{{{operationIdOriginal}}}"{{#summary}}, summary = "{{{.}}}"{{/summary}}, {{#isDeprecated}}deprecated = true, {{/isDeprecated}} tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-tags}} })
@ApiResponses(value = { {{#responses}}
@ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{^vendorExtensions.x-java-is-response-void}}, content = @Content({{#containerType}}array = @ArraySchema({{/containerType}}schema = @Schema(implementation = {{#isFile}}{{#useAbstractionForFiles}}InputStream{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{baseType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{baseType}}}{{/isFile}}.class){{#containerType}}){{/containerType}}){{/vendorExtensions.x-java-is-response-void}}){{^-last}},{{/-last}}{{/responses}} })
{{#implicitHeadersParams.0}}
@Parameters({
{{#implicitHeadersParams}}
{{>paramDoc}}{{^-last}},{{/-last}}
{{/implicitHeadersParams}}
})
{{/implicitHeadersParams.0}}
{{/swagger2AnnotationLibrary}}
public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}});
{{/operation}}
}

View File

@@ -15,7 +15,6 @@ import org.apache.cxf.jaxrs.model.wadl.DocTarget;
import org.apache.cxf.jaxrs.ext.multipart.*;
import io.swagger.annotations.Api;
{{#useSpringAnnotationConfig}}
import org.springframework.stereotype.Service;
{{/useSpringAnnotationConfig}}

View File

@@ -0,0 +1 @@
@Parameter(name = "{{{baseName}}}"{{#isDeprecated}}, deprecated = true{{/isDeprecated}}, description = "{{{description}}}"{{#required}}, required = true{{/required}}{{#isPathParam}}, in = ParameterIn.PATH{{/isPathParam}}{{#isQueryParam}}, in = ParameterIn.QUERY{{/isQueryParam}}{{#isCookieParam}}, in = ParameterIn.COOKIE{{/isCookieParam}}{{#isHeaderParam}}, in = ParameterIn.HEADER{{/isHeaderParam}})

View File

@@ -1,4 +1,12 @@
{{#swagger1AnnotationLibrary}}
{{#description}}
import io.swagger.annotations.ApiModel;
{{/description}}
import io.swagger.annotations.ApiModelProperty;
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
import io.swagger.v3.oas.annotations.media.Schema;
{{/swagger2AnnotationLibrary}}
import java.util.Objects;
{{#withXml}}
import {{javaxPackage}}.xml.bind.annotation.XmlElement;
@@ -13,9 +21,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
{{#description}}
/**
* {{{description}}}
**/
* {{{description}}}
*/
{{#swagger1AnnotationLibrary}}
@ApiModel(description="{{{description}}}")
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
@Schema(description="{{{description}}}")
{{/swagger2AnnotationLibrary}}
{{/description}}
{{>additionalModelTypeAnnotations}}{{>xmlPojoAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
{{#vendorExtensions.x-class-extra-annotation}}
@@ -25,16 +38,23 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
{{#vars}}{{#isEnum}}{{^isContainer}}
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
{{#description}}
/**
* {{{.}}}
*/
{{/description}}
{{#withXml}}
@XmlElement(name="{{baseName}}"{{#required}}, required = {{required}}{{/required}})
{{/withXml}}
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}"){{^isPrimitiveType}}{{^isDate}}{{^isDateTime}}{{^isString}}{{^isFile}}{{#useBeanValidation}}
@Valid{{/useBeanValidation}}{{/isFile}}{{/isString}}{{/isDateTime}}{{/isDate}}{{/isPrimitiveType}}
{{#description}}
/**
* {{{.}}}
**/
{{/description}}
{{#swagger1AnnotationLibrary}}
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
@Schema(description = "{{{description}}}"{{#example}}, example = "{{{example}}}"{{/example}}{{#required}}, requiredMode = Schema.RequiredMode.REQUIRED{{/required}})
{{/swagger2AnnotationLibrary}}
{{^isPrimitiveType}}{{^isDate}}{{^isDateTime}}{{^isString}}{{^isFile}}{{#useBeanValidation}}
@Valid
{{/useBeanValidation}}{{/isFile}}{{/isString}}{{/isDateTime}}{{/isDate}}{{/isPrimitiveType}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}

View File

@@ -111,6 +111,7 @@
</dependencies>
</dependencyManagement>
<dependencies>
{{#swagger1AnnotationLibrary}}
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
@@ -125,6 +126,14 @@ for this project used jakarta.validation-api -->
</exclusion>
</exclusions>
</dependency>
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations-version}</version>
</dependency>
{{/swagger2AnnotationLibrary}}
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
@@ -238,7 +247,12 @@ for this project used jakarta.validation-api -->
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<swagger-core-version>1.5.18</swagger-core-version>
{{#swagger1AnnotationLibrary}}
<swagger-core-version>1.6.6</swagger-core-version>
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
<swagger-annotations-version>2.2.7</swagger-annotations-version>
{{/swagger2AnnotationLibrary}}
<jetty-version>9.2.9.v20150224</jetty-version>
<junit-version>4.13.2</junit-version>
<logback-version>1.5.13</logback-version>

View File

@@ -34,6 +34,7 @@
{{/useSpringAnnotationConfig}}
{{#useSwaggerFeature}}
{{#swagger1AnnotationLibrary}}
<!-- CXF Swagger2Feature -->
{{! http://cxf.apache.org/docs/swagger2feature.html }}
<bean id="swagger2Feature" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
@@ -48,6 +49,7 @@
<property name="license" value="${swagger.license}" />
<property name="licenseUrl" value="${swagger.licenseUrl}" /-->
</bean>
{{/swagger1AnnotationLibrary}}
{{/useSwaggerFeature}}
<cxf:bus>

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