Compare commits

...

22 Commits

Author SHA1 Message Date
William Cheng
56eb5a63bf set useJakartaEe to true by default 2024-04-03 16:24:18 +08:00
William Cheng
2934f5ac51 add logic to simplify any type represented with oneof/anyof (#18268) 2024-04-02 15:08:20 +08:00
dependabot[bot]
2ce71512d0 Bump julia-actions/setup-julia from 1 to 2 (#18270)
Bumps [julia-actions/setup-julia](https://github.com/julia-actions/setup-julia) from 1 to 2.
- [Release notes](https://github.com/julia-actions/setup-julia/releases)
- [Commits](https://github.com/julia-actions/setup-julia/compare/v1...v2)

---
updated-dependencies:
- dependency-name: julia-actions/setup-julia
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-02 08:52:03 +08:00
William Cheng
927768757b Add designli to bronze sponsor (#18269)
* add designli to bronze sponsor

* update link to jpg
2024-04-01 15:46:04 +08:00
devhl-labs
858499ffdd [csharp][generichost] Form models (#18264)
* rename a bin artifact

* add support for form models

* revert sample changes

* revert sample changes

* build samples

* build samples
2024-04-01 13:12:03 +08:00
William Cheng
4719d9e55f update spring-context to newer version (#18266) 2024-04-01 11:56:58 +08:00
William Cheng
2d7f0496ec add rule to set primitive types to nullable (#18258) 2024-04-01 11:54:21 +08:00
devhl-labs
2fac8e34db [csharp][generichost] Updated UseSourceGeneration (#18265)
* updated UseSourceGeneration

* updated UseSourceGeneration

* updated UseSourceGeneration
2024-04-01 11:49:13 +08:00
martin-mfg
1704ae1194 fix issue 17999 (#18259) 2024-03-31 22:47:19 +08:00
devhl-labs
370eca2889 [csharp] Update dependencies (#18263)
* version bump

* updated a workflow
2024-03-31 11:27:57 +08:00
devhl-labs
d0f8468651 [csharp] Rename samples (#18260)
* renamed OpenAPIClient-httpclient to Petstore

* updated bin artifacts

* renamed OpenAPIClientCoreAndNet47 to MultipleFrameworks

* updated bin artifacts

* renamed OpenAPIClient-net47 to Petstore

* renamed OpenAPIClient-net48 to Petstore

* updated bin artifacts

* renamed OpenAPIClient-restsharp-name-parameter-mappings to ParameterMappings

* updated bin artifacts

* renamed OpenAPIClientCore to Petstore

* updated bin artifacts

* renamed OpenAPIClient-net7.0-useDateTimeForDate to UseDateTimeForDate

* updated bin artifacts

* renamed OpenAPIClient-net5.0 to EnumMappings

* updated bin artifacts

* renamed OpenAPIClient-ConditionalSerialization to ConditionalSerialization

* updated bin artifacts

* renamed OpenAPIClient to Petstore

* updated bin artifacts

* renamed OpenAPIClient-unityWebRequest to Petstore

* updated bin artifacts

* updated appveyor

* updated bin artifacts

* updated bin artifacts

* comenting out a sample project with no csproj file

* updated bin artifacts
2024-03-31 10:36:42 +08:00
devhl-labs
6252dac28e [csharp][generichost] Ensure samples are running (#18257)
* ensure samples are running

* ensure samples are running

* ensure samples are running

* ensure samples are running

* ensure samples are running

* ensure samples are running

* revert testing changes

* sorted the array entries
2024-03-30 21:14:51 +08:00
B4ckslash
807aa5d3ae [Java][jersey2] Fix generated client code for oneOf models if datatype includes arrays (#18042)
* Add java-jersey2 sample with mixed oneOf

* [java][jersey2]Fix client generation if oneOf contains an array type

Changes:
* Change jersey2/oneof_model template to use composed schema data
* Change adding of imports in AbstractJavaCodegen to use composed schema data
* Add escapedDataType property to CodegenProperty so that the data type
  may be part of identifiers (e.g. in getters)
* Update samples

* Add sample for multiple array in oneOf

* Fix generation of constructors with same erasures

* Update samples again

* Version bump

* Add new sample folders to CI

* Make primitive handling more explicit

* Replace escapedDataType property with Mustache lambda

* Update samples with new primitive handling and sanitization lambda
2024-03-30 21:08:41 +08:00
timo-a
f73db59b0e Migrate generated tests for java resttemplate generator updateFeature/resttemplate junit5 (#18222)
* update(resttemplate): migrate java resttemplate templates to junit 5

* update(java defaults): migrate java defaults as well because resttemplate uses model_tests from default

* update(samples, java): update samples as described in the contribution guidelines

* fix tests: try double quotes

* fix tests: remaining double quotes

* update(samples): regenerate resttemplate

* update(samples): regenerate resttemplate-jakarta

* update(samples): regenerate resttemplate-swagger1

* update(samples): regenerate resttemplate-swagger2

* update(samples): regenerate resttemplate-withXml

* update(samples again): ./bin/generate-samples.sh ./bin/configs/*.yaml
2024-03-30 21:06:05 +08:00
Yohei Kitamura
34ebc1c644 [ruby] Use Marcel to detect content-type in form-data file upload using faraday (#18243) 2024-03-29 21:58:08 +08:00
martin-mfg
de680de60e fix issue 17895 (#18248) 2024-03-29 21:57:13 +08:00
William Cheng
e78aeb6bc7 Better support for $ref to schema's properties (#18233)
* use once

* add support for reference to schema properties
2024-03-27 11:46:00 +08:00
Dennis Melzer
309918d03e Fix compile error in client properties configuration (#18232)
* Fix config

* Add tests

* Remove unused import

* Sort imports

* Add new workflow
2024-03-26 22:02:19 +08:00
Harry Devane
6690b9f87d Update okhttp3 to 4.12.0 (#18235) 2024-03-26 21:44:43 +08:00
dependabot[bot]
ee69a7983a Bump express from 4.18.2 to 4.19.2 in /website (#18228)
Bumps [express](https://github.com/expressjs/express) from 4.18.2 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.18.2...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-26 10:21:02 +08:00
devhl-labs
204407daf0 Rename samples (#18223)
* moved OpenAPIClient-generichost-net6.0

* moved OpenAPIClient-generichost-netcore-latest-allOf

* moved OpenAPIClient-generichost-netcore-latest-anyOf

* moved OpenAPIClient-generichost-netcore-latest-oneOf

* moved OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration

* moved OpenAPIClient-generichost-net6.0-nrt

* moved OpenAPIClient-generichost-net7.0-useDateTimeForDate

* moved OpenAPIClient-generichost-manual-tests

* moved OpenAPIClient-generichost-netstandard2.0

* moved OpenAPIClient-generichost-net6.0

* deleted abandoned files

* updated bin artifacts

* build samples

* updated workflow

* fix manual tests
2024-03-26 10:19:05 +08:00
devhl-labs
d1860b95cf [csharp] Move samples (#18217)
* moved manual tests

* moved allOf

* moved anyOf

* moved oneOf

* moved OpenAPIClient-generichost-net6.0

* moved OpenAPIClient-generichost-net6.0-nrt

* moved OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration

* moved OpenAPIClient-generichost-net7.0-useDateTimeForDate

* moved OpenAPIClient-generichost-netstandard2.0

* moved OpenAPIClient

* moved OpenAPIClient-ConditionalSerialization

* moved OpenAPIClient-httpclient

* moved OpenAPIClient-net5.0

* moved OpenAPIClient-net7.0-useDateTimeForDate

* moved OpenAPIClient-net47

* moved OpenAPIClient-net48

* moved OpenAPIClient-restsharp-name-parameter-mappings

* moved OpenAPIClient-unityWebRequest

* moved OpenAPIClientCore

* moved OpenAPIClientCoreAndNet47

* renamed standard2 to standard2.0

* renamed standard2 to standard2.0

* fixed workflows

* renamed workflows

* updated bin artifacts

* updated bin artifacts

* pinned the samples to their version

* renamed bin artifacts

* update bin artifact

* update bin artifact

* update bin artifact

* updated appveyor

* reverting changes bc git does not show the rename

* commiting all but the file rename for these two files
2024-03-25 09:14:34 +08:00
9630 changed files with 89808 additions and 23767 deletions

View File

@@ -3,22 +3,16 @@ name: Samples C# .Net Standard Client
on: on:
push: push:
paths: paths:
# build C# API client (netstandard) - samples/client/petstore/csharp/generichost/standard2.0/**
- samples/client/petstore/csharp/OpenAPIClient/** - samples/client/petstore/csharp/httpclient/standard2.0/**
- samples/client/petstore/csharp/*netstandard*/** - samples/client/petstore/csharp/restsharp/standard2.0/**
# build C# API client (netstandard with ConditionalSerialization) - samples/client/petstore/csharp/unityWebRequest/standard2.0/**
- samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/**
# build C# API client (netstandard httpclient)
- samples/client/petstore/csharp/OpenAPIClient-httpclient/**
pull_request: pull_request:
paths: paths:
# build C# API client (netstandard) - samples/client/petstore/csharp/generichost/standard2.0/**
- samples/client/petstore/csharp/OpenAPIClient/** - samples/client/petstore/csharp/httpclient/standard2.0/**
- samples/client/petstore/csharp/*netstandard*/** - samples/client/petstore/csharp/restsharp/standard2.0/**
# build C# API client (netstandard with ConditionalSerialization) - samples/client/petstore/csharp/unityWebRequest/standard2.0/**
- samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/**
# build C# API client (netstandard httpclient)
- samples/client/petstore/csharp/OpenAPIClient-httpclient/**
jobs: jobs:
build: build:
name: Build .Net projects name: Build .Net projects
@@ -27,13 +21,11 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
sample: sample:
# build C# API client (netstandard) - samples/client/petstore/csharp/generichost/standard2.0/Petstore/
- samples/client/petstore/csharp/OpenAPIClient/ - samples/client/petstore/csharp/httpclient/standard2.0/Petstore/
- samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/ - samples/client/petstore/csharp/restsharp/standard2.0/Petstore/
# build C# API client (netstandard with ConditionalSerialization) - samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/
- samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/ # - samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/
# build C# API client (netstandard httpclient)
- samples/client/petstore/csharp/OpenAPIClient-httpclient/
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4.0.0 - uses: actions/setup-dotnet@v4.0.0

View File

@@ -3,16 +3,16 @@ name: Samples C# .Net 8 Clients
on: on:
push: push:
paths: paths:
- samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/** - samples/client/petstore/csharp/generichost/net8/**
- samples/client/petstore/csharp/*net6.0*/** - samples/client/petstore/csharp/httpclient/net8/**
- samples/client/petstore/csharp/*net7.0*/** - samples/client/petstore/csharp/restsharp/net8/**
- samples/client/petstore/csharp/OpenAPIClient-*latest*/** - samples/client/petstore/csharp/unityWebRequest/net8/**
pull_request: pull_request:
paths: paths:
- samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/** - samples/client/petstore/csharp/generichost/net8/**
- samples/client/petstore/csharp/*net6.0*/** - samples/client/petstore/csharp/httpclient/net8/**
- samples/client/petstore/csharp/*net7.0*/** - samples/client/petstore/csharp/restsharp/net8/**
- samples/client/petstore/csharp/OpenAPIClient-*latest*/** - samples/client/petstore/csharp/unityWebRequest/net8/**
jobs: jobs:
build: build:
name: Build .Net projects name: Build .Net projects
@@ -21,16 +21,16 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
sample: sample:
# clients - samples/client/petstore/csharp/generichost/net8/AllOf
- samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests - samples/client/petstore/csharp/generichost/net8/AnyOf
- samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0 - samples/client/petstore/csharp/generichost/net8/FormModels
- samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt - samples/client/petstore/csharp/generichost/net8/ManualPetstoreTests
- samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration - samples/client/petstore/csharp/generichost/net8/ManualSourceGenerationTests
- samples/client/petstore/csharp/OpenAPIClient-generichost-net7.0-useDateTimeForDate - samples/client/petstore/csharp/generichost/net8/NullReferenceTypes
- samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf - samples/client/petstore/csharp/generichost/net8/OneOf
- samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf - samples/client/petstore/csharp/generichost/net8/Petstore
- samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf - samples/client/petstore/csharp/generichost/net8/SourceGeneration
- samples/client/petstore/csharp/OpenAPIClient-net7.0-useDateTimeForDate - samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4.0.0 - uses: actions/setup-dotnet@v4.0.0

View File

@@ -3,28 +3,10 @@ name: Samples C# .Net 6 Client
on: on:
push: push:
paths: paths:
# build C# API client (httpclient) - samples/client/petstore/csharp/restsharp/net6/**
- samples/client/petstore/csharp/OpenAPIClient-httpclient/**
# build C# API client (.net framework 4.7)
- samples/client/petstore/csharp/OpenAPIClient-net47/**
# build C# API client (.net framework 4.8)
- samples/client/petstore/csharp/OpenAPIClient-net48/**
# build C# API client (property, parameter name mappings)
- samples/client/petstore/csharp/OpenAPIClient-restsharp-name-parameter-mappings/**
# build C# API client (multiple frameworks)
- samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/**
pull_request: pull_request:
paths: paths:
# build C# API client (httpclient) - samples/client/petstore/csharp/restsharp/net6/**
- samples/client/petstore/csharp/OpenAPIClient-httpclient/**
# build C# API client (.net framework 4.7)
- samples/client/petstore/csharp/OpenAPIClient-net47/**
# build C# API client (.net framework 4.8)
- samples/client/petstore/csharp/OpenAPIClient-net48/**
# build C# API client (property, parameter name mappings)
- samples/client/petstore/csharp/OpenAPIClient-restsharp-name-parameter-mappings/**
# build C# API client (multiple frameworks)
- samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/**
jobs: jobs:
build: build:
name: Build .Net clients name: Build .Net clients
@@ -33,16 +15,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
sample: sample:
# build C# API client (httpclient) - samples/client/petstore/csharp/restsharp/net6/ParameterMappings/
- samples/client/petstore/csharp/OpenAPIClient-httpclient/
# build C# API client (.net framework 4.7)
- samples/client/petstore/csharp/OpenAPIClient-net47/
# build C# API client (.net framework 4.8)
- samples/client/petstore/csharp/OpenAPIClient-net48/
# build C# API client (property, parameter name mappings)
- samples/client/petstore/csharp/OpenAPIClient-restsharp-name-parameter-mappings/
# build C# API client (multiple frameworks)
- samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4.0.0 - uses: actions/setup-dotnet@v4.0.0

View File

@@ -13,6 +13,8 @@ on:
- samples/client/others/java/okhttp-gson-oneOf/** - samples/client/others/java/okhttp-gson-oneOf/**
- samples/client/others/java/resttemplate-useAbstractionForFiles/** - samples/client/others/java/resttemplate-useAbstractionForFiles/**
- samples/client/others/java/webclient-useAbstractionForFiles/** - samples/client/others/java/webclient-useAbstractionForFiles/**
- samples/client/others/java/jersey2-oneOf-duplicates/**
- samples/client/others/java/jersey2-oneOf-Mixed/**
pull_request: pull_request:
paths: paths:
- 'samples/client/petstore/java/**' - 'samples/client/petstore/java/**'
@@ -25,6 +27,8 @@ on:
- samples/client/others/java/okhttp-gson-oneOf/** - samples/client/others/java/okhttp-gson-oneOf/**
- samples/client/others/java/resttemplate-useAbstractionForFiles/** - samples/client/others/java/resttemplate-useAbstractionForFiles/**
- samples/client/others/java/webclient-useAbstractionForFiles/** - samples/client/others/java/webclient-useAbstractionForFiles/**
- samples/client/others/java/jersey2-oneOf-duplicates/**
- samples/client/others/java/jersey2-oneOf-Mixed/**
jobs: jobs:
build: build:
name: Build Java Client JDK11 name: Build Java Client JDK11
@@ -71,6 +75,8 @@ jobs:
- samples/client/others/java/okhttp-gson-oneOf/ - samples/client/others/java/okhttp-gson-oneOf/
- samples/client/others/java/resttemplate-useAbstractionForFiles/ - samples/client/others/java/resttemplate-useAbstractionForFiles/
- samples/client/others/java/webclient-useAbstractionForFiles/ - samples/client/others/java/webclient-useAbstractionForFiles/
- samples/client/others/java/jersey2-oneOf-duplicates/
- samples/client/others/java/jersey2-oneOf-Mixed/
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-java@v4 - uses: actions/setup-java@v4

View File

@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1 - uses: julia-actions/setup-julia@v2
with: with:
version: 1.8 version: 1.8
arch: x64 arch: x64

View File

@@ -34,6 +34,7 @@ jobs:
- samples/openapi3/client/petstore/spring-cloud-async - samples/openapi3/client/petstore/spring-cloud-async
- samples/openapi3/client/petstore/spring-cloud-spring-pageable - samples/openapi3/client/petstore/spring-cloud-spring-pageable
- samples/client/petstore/spring-cloud-tags - samples/client/petstore/spring-cloud-tags
- samples/client/petstore/spring-cloud-auth
- samples/client/petstore/spring-cloud-deprecated - samples/client/petstore/spring-cloud-deprecated
# servers # servers
- samples/server/petstore/springboot - samples/server/petstore/springboot

View File

@@ -13,7 +13,7 @@ if [ "$NODE_INDEX" = "1" ]; then
echo "Running node $NODE_INDEX ..." echo "Running node $NODE_INDEX ..."
java -version java -version
sudo apt-get -y install cpanminus libmagic-dev sudo apt-get -y install cpanminus
(cd samples/client/petstore/perl && /bin/bash ./test.bash) (cd samples/client/petstore/perl && /bin/bash ./test.bash)
(cd samples/client/petstore/ruby && mvn integration-test) (cd samples/client/petstore/ruby && mvn integration-test)
@@ -112,5 +112,3 @@ else
(cd samples/client/petstore/java/apache-httpclient && mvn integration-test) (cd samples/client/petstore/java/apache-httpclient && mvn integration-test)
fi fi

View File

@@ -68,6 +68,7 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
[<img src="https://openapi-generator.tech/img/companies/ssstwitter.png" width="128" height="128">](https://ssstwitter.com/?utm_source=github&utm_medium=referral&utm_campaign=sponsor) [<img src="https://openapi-generator.tech/img/companies/ssstwitter.png" width="128" height="128">](https://ssstwitter.com/?utm_source=github&utm_medium=referral&utm_campaign=sponsor)
[<img src="https://openapi-generator.tech/img/companies/svix.png" width="128" height="128">](https://www.svix.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship) [<img src="https://openapi-generator.tech/img/companies/svix.png" width="128" height="128">](https://www.svix.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
[<img src="https://openapi-generator.tech/img/companies/litslink.png" width="128" height="128">](https://litslink.com/services/artificial-intelligence?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship) [<img src="https://openapi-generator.tech/img/companies/litslink.png" width="128" height="128">](https://litslink.com/services/artificial-intelligence?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
[<img src="https://openapi-generator.tech/img/companies/designli.jpg" width="128" height="128">](https://designli.co?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
#### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS, Checkly for sponsoring the API monitoring and Gradle for sponsoring Develocity #### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS, Checkly for sponsoring the API monitoring and Gradle for sponsoring Develocity

View File

@@ -43,23 +43,29 @@ build_script:
#- dotnet build samples\client\petstore\csharp\OpenAPIClient-ConditionalSerialization\Org.OpenAPITools.sln #- dotnet build samples\client\petstore\csharp\OpenAPIClient-ConditionalSerialization\Org.OpenAPITools.sln
test_script: test_script:
# test c# API client (multiple frameworks) - dotnet test samples\client\petstore\csharp\generichost\net8\AllOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\OpenAPIClientCoreAndNet47\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
# test c# API client (httpclient) - dotnet test samples\client\petstore\csharp\generichost\net8\FormModels\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\OpenAPIClient-httpclient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp\generichost\net8\ManualSourceGenerationTests\ManualTests.Latest.UseSourceGeneration\ManualTests.Latest.UseSourceGeneration.csproj
# test c# API client (generichost) - dotnet test samples\client\petstore\csharp\generichost\net8\ManualPetstoreTests\OpenAPIClient-generichost-manual-tests\OpenAPIClient-generichost-manual-tests.csproj
- dotnet test samples\client\petstore\csharp\OpenAPIClient-generichost-netstandard2.0\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp\generichost\net8\NullReferenceTypes\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
# test c# API client (netcore) - dotnet test samples\client\petstore\csharp\generichost\net8\OneOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\OpenAPIClientCore\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\OpenAPIClient\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
# test C# API client (.net framework 4.7) - dotnet test samples\client\petstore\csharp\generichost\net8\UseDateTimeForDate\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\OpenAPIClient-net47\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
# test C# API client (.net framework 4.8)
- dotnet test samples\client\petstore\csharp\OpenAPIClient-net48\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
# test C# API client (.net 5.0)
- dotnet test samples\client\petstore\csharp\OpenAPIClient-net5.0\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
# test C# API Client using conditional-serialization - dotnet test samples\client\petstore\csharp\restsharp\net4.7\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\OpenAPIClient-ConditionalSerialization\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\net6\ParameterMappings\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\restsharp\net7\EnumMappings\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\restsharp\net7\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp\restsharp\net7\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 ### TODO: Execute all generators via powershell or other
# generate all petstore clients # generate all petstore clients

View File

@@ -1,6 +1,6 @@
# for csharp generichost # for csharp generichost
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf outputDir: samples/client/petstore/csharp/generichost/net8/AllOf
inputSpec: modules/openapi-generator/src/test/resources/3_0/allOf.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/allOf.yaml
library: generichost library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
@@ -10,3 +10,4 @@ additionalProperties:
disallowAdditionalPropertiesIfNotPresent: false disallowAdditionalPropertiesIfNotPresent: false
nullableReferenceTypes: true nullableReferenceTypes: true
equatable: true equatable: true
targetFramework: net8.0

View File

@@ -1,6 +1,6 @@
# for csharp generichost # for csharp generichost
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf outputDir: samples/client/petstore/csharp/generichost/net8/AnyOf
inputSpec: modules/openapi-generator/src/test/resources/3_0/anyOf.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/anyOf.yaml
library: generichost library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
@@ -10,3 +10,4 @@ additionalProperties:
disallowAdditionalPropertiesIfNotPresent: false disallowAdditionalPropertiesIfNotPresent: false
nullableReferenceTypes: true nullableReferenceTypes: true
equatable: true equatable: true
targetFramework: net8.0

View File

@@ -0,0 +1,16 @@
# for csharp generichost
generatorName: csharp
outputDir: samples/client/petstore/csharp/generichost/net8/FormModels
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
useCompareNetObjects: true
disallowAdditionalPropertiesIfNotPresent: false
nullableReferenceTypes: false
equatable: true
targetFramework: net8.0
skipFormModel: false
inlineSchemaOptions:
RESOLVE_INLINE_ENUMS: true

View File

@@ -1,6 +1,6 @@
# for csharp generichost # for csharp generichost
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration outputDir: samples/client/petstore/csharp/generichost/net8/SourceGeneration
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
library: generichost library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
@@ -9,5 +9,5 @@ additionalProperties:
useCompareNetObjects: true useCompareNetObjects: true
disallowAdditionalPropertiesIfNotPresent: false disallowAdditionalPropertiesIfNotPresent: false
useSourceGeneration: true useSourceGeneration: true
packageName: UseSourceGeneration
equatable: true equatable: true
targetFramework: net8.0

View File

@@ -1,6 +1,6 @@
# for csharp generichost # for csharp generichost
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt outputDir: samples/client/petstore/csharp/generichost/net8/NullReferenceTypes
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
library: generichost library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
@@ -10,3 +10,4 @@ additionalProperties:
disallowAdditionalPropertiesIfNotPresent: false disallowAdditionalPropertiesIfNotPresent: false
nullableReferenceTypes: true nullableReferenceTypes: true
equatable: true equatable: true
targetFramework: net8.0

View File

@@ -1,6 +1,6 @@
# for csharp generichost # for csharp generichost
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf outputDir: samples/client/petstore/csharp/generichost/net8/OneOf
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf.yaml
library: generichost library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
@@ -10,3 +10,4 @@ additionalProperties:
disallowAdditionalPropertiesIfNotPresent: false disallowAdditionalPropertiesIfNotPresent: false
nullableReferenceTypes: true nullableReferenceTypes: true
equatable: true equatable: true
targetFramework: net8.0

View File

@@ -1,9 +1,10 @@
# for csharp generichost # for csharp generichost
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-generichost-net7.0-useDateTimeForDate outputDir: samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/dates-api.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/dates-api.yaml
library: generichost library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties: additionalProperties:
packageGuid: '{2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}' packageGuid: '{2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}'
useDateTimeForDate: true useDateTimeForDate: true
targetFramework: net8.0

View File

@@ -1,6 +1,6 @@
# for csharp generichost # for csharp generichost
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0 outputDir: samples/client/petstore/csharp/generichost/net8/Petstore
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
library: generichost library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
@@ -10,3 +10,4 @@ additionalProperties:
disallowAdditionalPropertiesIfNotPresent: false disallowAdditionalPropertiesIfNotPresent: false
nullableReferenceTypes: false nullableReferenceTypes: false
equatable: true equatable: true
targetFramework: net8.0

View File

@@ -1,6 +1,6 @@
# for csharp generichost # for csharp generichost
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0 outputDir: samples/client/petstore/csharp/generichost/standard2.0/Petstore
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
library: generichost library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp

View File

@@ -1,6 +1,6 @@
# for .net standard httpclient # for .net standard httpclient
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-httpclient outputDir: samples/client/petstore/csharp/httpclient/standard2.0/Petstore
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
library: httpclient library: httpclient

View File

@@ -1,5 +1,5 @@
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClientCoreAndNet47 outputDir: samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties: additionalProperties:

View File

@@ -1,6 +1,6 @@
# for .net standard # for .net standard
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-net47 outputDir: samples/client/petstore/csharp/restsharp/net4.7/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.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties: additionalProperties:

View File

@@ -1,6 +1,6 @@
# for .net standard # for .net standard
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-net48 outputDir: samples/client/petstore/csharp/restsharp/net4.8/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.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties: additionalProperties:

View File

@@ -1,5 +1,5 @@
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-restsharp-name-parameter-mappings outputDir: samples/client/petstore/csharp/restsharp/net6/ParameterMappings
inputSpec: modules/openapi-generator/src/test/resources/3_0/name-parameter-mappings.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/name-parameter-mappings.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
nameMappings: nameMappings:

View File

@@ -1,5 +1,5 @@
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClientCore outputDir: samples/client/petstore/csharp/restsharp/net7/Petstore
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties: additionalProperties:

View File

@@ -1,6 +1,6 @@
# for .net standard # for .net standard
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-net7.0-useDateTimeForDate outputDir: samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/dates-api.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/dates-api.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties: additionalProperties:

View File

@@ -1,6 +1,6 @@
# for .net standard # for .net standard
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-net5.0 outputDir: samples/client/petstore/csharp/restsharp/net7/EnumMappings
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.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties: additionalProperties:

View File

@@ -1,6 +1,6 @@
# for .net standard # for .net standard
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization outputDir: samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties: additionalProperties:

View File

@@ -1,6 +1,6 @@
# for .net standard # for .net standard
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient 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.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties: additionalProperties:

View File

@@ -1,6 +1,6 @@
# for .net Unity # for .net Unity
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-unityWebRequest outputDir: samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp templateDir: modules/openapi-generator/src/main/resources/csharp
library: unityWebRequest library: unityWebRequest

View File

@@ -0,0 +1,7 @@
generatorName: java
outputDir: samples/client/others/java/jersey2-oneOf-duplicates
library: jersey2
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf_duplicateArray.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -0,0 +1,7 @@
generatorName: java
outputDir: samples/client/others/java/jersey2-oneOf-Mixed
library: jersey2
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf_primitiveAndArray.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -8,3 +8,4 @@ additionalProperties:
hideGenerationTimestamp: "true" hideGenerationTimestamp: "true"
disallowAdditionalPropertiesIfNotPresent: false disallowAdditionalPropertiesIfNotPresent: false
useSingleRequestParameter: true useSingleRequestParameter: true
useBeanValidation: true

View File

@@ -0,0 +1,9 @@
generatorName: spring
outputDir: samples/client/petstore/spring-cloud-auth
library: spring-cloud
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-auth.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
documentationProvider: none
artifactId: petstore-spring-cloud-auth
hideGenerationTimestamp: "true"

View File

@@ -1,10 +1,10 @@
--- ---
# csharp test files and image for upload # csharp test files and image for upload
- filename: "samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs" - filename: "samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs"
sha256: e323c7e646a0ceb6d1d8f34f287175ac666fdbbe057791b45d138de3d9582666 sha256: e323c7e646a0ceb6d1d8f34f287175ac666fdbbe057791b45d138de3d9582666
- filename: "samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs" - filename: "samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs"
sha256: 7dad88554fe630d25c787cae05305d302d5e34ca810aee4fa23f20055f9188e1 sha256: 7dad88554fe630d25c787cae05305d302d5e34ca810aee4fa23f20055f9188e1
- filename: "samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/linux-logo.png" - filename: "samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/linux-logo.png"
sha256: 0a67c32728197e942b13bdda064b73793f12f5c795f1e5cf35a3adf69c973230 sha256: 0a67c32728197e942b13bdda064b73793f12f5c795f1e5cf35a3adf69c973230
# java okhttp gson test files # java okhttp gson test files
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/ClientTest.java" - filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/ClientTest.java"

View File

@@ -605,3 +605,10 @@ Example:
``` ```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/java-okhttp/ --openapi-normalizer SET_CONTAINER_TO_NULLABLE="array|map" java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/java-okhttp/ --openapi-normalizer SET_CONTAINER_TO_NULLABLE="array|map"
``` ```
- `SET_PRIMITIVE_TYPES_TO_NULLABLE`: When set to `string|integer|number|boolean` (or just `string`) for example, it will set the type to `nullable` (nullable: true)
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/java-okhttp/ --openapi-normalizer SET_PRIMITIVE_TYPES_TO_NULLABLE="integer|number"
```

View File

@@ -350,6 +350,8 @@ public interface CodegenConfig {
*/ */
String generatorLanguageVersion(); String generatorLanguageVersion();
boolean isTypeErasedGenerics();
List<VendorExtension> getSupportedVendorExtensions(); List<VendorExtension> getSupportedVendorExtensions();
boolean getUseInlineModelResolver(); boolean getUseInlineModelResolver();

View File

@@ -1139,6 +1139,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
this.isEnum = isEnum; this.isEnum = isEnum;
} }
@Override @Override
public String toString() { public String toString() {
final StringBuilder sb = new StringBuilder("CodegenProperty{"); final StringBuilder sb = new StringBuilder("CodegenProperty{");

View File

@@ -43,6 +43,8 @@ public class CodegenSecurity {
// Oauth specific // Oauth specific
public String flow, authorizationUrl, tokenUrl, refreshUrl; public String flow, authorizationUrl, tokenUrl, refreshUrl;
public List<Map<String, Object>> scopes; public List<Map<String, Object>> scopes;
public Boolean hasScopes;
public Boolean isCode, isPassword, isApplication, isImplicit; public Boolean isCode, isPassword, isApplication, isImplicit;
// OpenId specific // OpenId specific
public String openIdConnectUrl; public String openIdConnectUrl;

View File

@@ -2464,6 +2464,14 @@ public class DefaultCodegen implements CodegenConfig {
protected String getSingleSchemaType(Schema schema) { protected String getSingleSchemaType(Schema schema) {
Schema unaliasSchema = unaliasSchema(schema); Schema unaliasSchema = unaliasSchema(schema);
if (ModelUtils.isRefToSchemaWithProperties(unaliasSchema.get$ref())) {
// ref to schema's properties, e.g. #/components/schemas/Pet/properties/category
Schema refSchema = ModelUtils.getReferencedSchema(openAPI, unaliasSchema);
if (refSchema != null) {
return getSingleSchemaType(refSchema);
}
}
if (StringUtils.isNotBlank(unaliasSchema.get$ref())) { // reference to another definition/schema if (StringUtils.isNotBlank(unaliasSchema.get$ref())) { // reference to another definition/schema
// get the schema/model name from $ref // get the schema/model name from $ref
String schemaName = ModelUtils.getSimpleRef(unaliasSchema.get$ref()); String schemaName = ModelUtils.getSimpleRef(unaliasSchema.get$ref());
@@ -3354,7 +3362,7 @@ public class DefaultCodegen implements CodegenConfig {
String modelName = ModelUtils.getSimpleRef(((Schema) oneOf).get$ref()); String modelName = ModelUtils.getSimpleRef(((Schema) oneOf).get$ref());
CodegenProperty thisCp = discriminatorFound(composedSchemaName, (Schema) oneOf, discPropName, visitedSchemas); CodegenProperty thisCp = discriminatorFound(composedSchemaName, (Schema) oneOf, discPropName, visitedSchemas);
if (thisCp == null) { if (thisCp == null) {
LOGGER.warn( once(LOGGER).warn(
"'{}' defines discriminator '{}', but the referenced OneOf schema '{}' is missing {}", "'{}' defines discriminator '{}', but the referenced OneOf schema '{}' is missing {}",
composedSchemaName, discPropName, modelName, discPropName); composedSchemaName, discPropName, modelName, discPropName);
} }
@@ -3363,7 +3371,7 @@ public class DefaultCodegen implements CodegenConfig {
continue; continue;
} }
if (cp != thisCp) { if (cp != thisCp) {
LOGGER.warn( once(LOGGER).warn(
"'{}' defines discriminator '{}', but the OneOf schema '{}' has a different {} definition than the prior OneOf schema's. Make sure the {} type and required values are the same", "'{}' defines discriminator '{}', but the OneOf schema '{}' has a different {} definition than the prior OneOf schema's. Make sure the {} type and required values are the same",
composedSchemaName, discPropName, modelName, discPropName, discPropName); composedSchemaName, discPropName, modelName, discPropName, discPropName);
} }
@@ -3377,7 +3385,7 @@ public class DefaultCodegen implements CodegenConfig {
String modelName = ModelUtils.getSimpleRef(((Schema) anyOf).get$ref()); String modelName = ModelUtils.getSimpleRef(((Schema) anyOf).get$ref());
CodegenProperty thisCp = discriminatorFound(composedSchemaName, (Schema) anyOf, discPropName, visitedSchemas); CodegenProperty thisCp = discriminatorFound(composedSchemaName, (Schema) anyOf, discPropName, visitedSchemas);
if (thisCp == null) { if (thisCp == null) {
LOGGER.warn( once(LOGGER).warn(
"'{}' defines discriminator '{}', but the referenced AnyOf schema '{}' is missing {}", "'{}' defines discriminator '{}', but the referenced AnyOf schema '{}' is missing {}",
composedSchemaName, discPropName, modelName, discPropName); composedSchemaName, discPropName, modelName, discPropName);
} }
@@ -3386,7 +3394,7 @@ public class DefaultCodegen implements CodegenConfig {
continue; continue;
} }
if (cp != thisCp) { if (cp != thisCp) {
LOGGER.warn( once(LOGGER).warn(
"'{}' defines discriminator '{}', but the AnyOf schema '{}' has a different {} definition than the prior AnyOf schema's. Make sure the {} type and required values are the same", "'{}' defines discriminator '{}', but the AnyOf schema '{}' has a different {} definition than the prior AnyOf schema's. Make sure the {} type and required values are the same",
composedSchemaName, discPropName, modelName, discPropName, discPropName); composedSchemaName, discPropName, modelName, discPropName, discPropName);
} }
@@ -3454,7 +3462,7 @@ public class DefaultCodegen implements CodegenConfig {
} }
} }
if (discriminatorsPropNames.size() > 1) { if (discriminatorsPropNames.size() > 1) {
LOGGER.warn("The oneOf schemas have conflicting discriminator property names. " + once(LOGGER).warn("The oneOf schemas have conflicting discriminator property names. " +
"oneOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames)); "oneOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
} }
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) { if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) {
@@ -3483,7 +3491,7 @@ public class DefaultCodegen implements CodegenConfig {
} }
} }
if (discriminatorsPropNames.size() > 1) { if (discriminatorsPropNames.size() > 1) {
LOGGER.warn("The anyOf schemas have conflicting discriminator property names. " + once(LOGGER).warn("The anyOf schemas have conflicting discriminator property names. " +
"anyOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames)); "anyOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
} }
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getAnyOf().size() && discriminatorsPropNames.size() == 1) { if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getAnyOf().size() && discriminatorsPropNames.size() == 1) {
@@ -3532,7 +3540,7 @@ public class DefaultCodegen implements CodegenConfig {
// schemas also has inline composed schemas // schemas also has inline composed schemas
// Note: if it is only inline one level, then the inline model resolver will move it into its own // Note: if it is only inline one level, then the inline model resolver will move it into its own
// schema and make it a $ref schema in the oneOf/anyOf location // schema and make it a $ref schema in the oneOf/anyOf location
LOGGER.warn( once(LOGGER).warn(
"Invalid inline schema defined in oneOf/anyOf in '{}'. Per the OpenApi spec, for this case when a composed schema defines a discriminator, the oneOf/anyOf schemas must use $ref. Change this inline definition to a $ref definition", "Invalid inline schema defined in oneOf/anyOf in '{}'. Per the OpenApi spec, for this case when a composed schema defines a discriminator, the oneOf/anyOf schemas must use $ref. Change this inline definition to a $ref definition",
composedSchemaName); composedSchemaName);
} }
@@ -3554,14 +3562,14 @@ public class DefaultCodegen implements CodegenConfig {
msgSuffix += spacer + "invalid optional definition of " + discPropName + ", include it in required"; msgSuffix += spacer + "invalid optional definition of " + discPropName + ", include it in required";
} }
} }
LOGGER.warn("'{}' defines discriminator '{}', but the referenced schema '{}' is incorrect. {}", once(LOGGER).warn("'{}' defines discriminator '{}', but the referenced schema '{}' is incorrect. {}",
composedSchemaName, discPropName, modelName, msgSuffix); composedSchemaName, discPropName, modelName, msgSuffix);
} }
MappedModel mm = new MappedModel(modelName, toModelName(modelName)); MappedModel mm = new MappedModel(modelName, toModelName(modelName));
descendentSchemas.add(mm); descendentSchemas.add(mm);
Schema cs = ModelUtils.getSchema(openAPI, modelName); Schema cs = ModelUtils.getSchema(openAPI, modelName);
if (cs == null) { // cannot lookup the model based on the name if (cs == null) { // cannot lookup the model based on the name
LOGGER.error("Failed to lookup the schema '{}' when processing oneOf/anyOf. Please check to ensure it's defined properly.", modelName); once(LOGGER).error("Failed to lookup the schema '{}' when processing oneOf/anyOf. Please check to ensure it's defined properly.", modelName);
} else { } else {
Map<String, Object> vendorExtensions = cs.getExtensions(); Map<String, Object> vendorExtensions = cs.getExtensions();
if (vendorExtensions != null && !vendorExtensions.isEmpty() && vendorExtensions.containsKey("x-discriminator-value")) { if (vendorExtensions != null && !vendorExtensions.isEmpty() && vendorExtensions.containsKey("x-discriminator-value")) {
@@ -3674,7 +3682,7 @@ public class DefaultCodegen implements CodegenConfig {
if (e.getValue().indexOf('/') >= 0) { if (e.getValue().indexOf('/') >= 0) {
name = ModelUtils.getSimpleRef(e.getValue()); name = ModelUtils.getSimpleRef(e.getValue());
if (ModelUtils.getSchema(openAPI, name) == null) { if (ModelUtils.getSchema(openAPI, name) == null) {
LOGGER.error("Failed to lookup the schema '{}' when processing the discriminator mapping of oneOf/anyOf. Please check to ensure it's defined properly.", name); once(LOGGER).error("Failed to lookup the schema '{}' when processing the discriminator mapping of oneOf/anyOf. Please check to ensure it's defined properly.", name);
} }
} else { } else {
name = e.getValue(); name = e.getValue();
@@ -3983,6 +3991,13 @@ public class DefaultCodegen implements CodegenConfig {
return cpc; return cpc;
} }
// if it's ref to schema's properties, get the actual schema defined in the properties
Schema refToPropertiesSchema = ModelUtils.getSchemaFromRefToSchemaWithProperties(openAPI, p.get$ref());
if (refToPropertiesSchema != null) {
p = refToPropertiesSchema;
return fromProperty(name, refToPropertiesSchema, required, schemaIsFromAdditionalProperties);
}
Schema original = null; Schema original = null;
// check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level // check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level
if (ModelUtils.isAllOf(p) && p.getAllOf().size() == 1) { if (ModelUtils.isAllOf(p) && p.getAllOf().size() == 1) {
@@ -6780,6 +6795,7 @@ public class DefaultCodegen implements CodegenConfig {
enumVar.put("name", finalEnumName); enumVar.put("name", finalEnumName);
enumVar.put("value", toEnumValue(String.valueOf(value), dataType)); enumVar.put("value", toEnumValue(String.valueOf(value), dataType));
enumVar.put("isString", isDataTypeString(dataType)); enumVar.put("isString", isDataTypeString(dataType));
// TODO: add isNumeric
enumVars.add(enumVar); enumVars.add(enumVar);
} }
@@ -6802,6 +6818,7 @@ public class DefaultCodegen implements CodegenConfig {
enumVar.put("name", toEnumVarName(enumName, dataType)); enumVar.put("name", toEnumVarName(enumName, dataType));
enumVar.put("value", toEnumValue(enumValue, dataType)); enumVar.put("value", toEnumValue(enumValue, dataType));
enumVar.put("isString", isDataTypeString(dataType)); enumVar.put("isString", isDataTypeString(dataType));
// TODO: add isNumeric
enumVars.add(enumVar); enumVars.add(enumVar);
} }
@@ -6940,6 +6957,7 @@ public class DefaultCodegen implements CodegenConfig {
scopes.add(scope); scopes.add(scope);
} }
codegenSecurity.scopes = scopes; codegenSecurity.scopes = scopes;
codegenSecurity.hasScopes = true;
} }
} }
@@ -8421,12 +8439,17 @@ public class DefaultCodegen implements CodegenConfig {
xOf.add(cp); xOf.add(cp);
i += 1; i += 1;
if (dataTypeSet.contains(cp.dataType)) { if (dataTypeSet.contains(cp.dataType)
|| (isTypeErasedGenerics() && dataTypeSet.contains(cp.baseType))) {
// add "x-duplicated-data-type" to indicate if the dataType already occurs before // add "x-duplicated-data-type" to indicate if the dataType already occurs before
// in other sub-schemas of allOf/anyOf/oneOf // in other sub-schemas of allOf/anyOf/oneOf
cp.vendorExtensions.putIfAbsent("x-duplicated-data-type", true); cp.vendorExtensions.putIfAbsent("x-duplicated-data-type", true);
} else { } else {
dataTypeSet.add(cp.dataType); if(isTypeErasedGenerics()) {
dataTypeSet.add(cp.baseType);
} else {
dataTypeSet.add(cp.dataType);
}
} }
} }
return xOf; return xOf;
@@ -8463,11 +8486,16 @@ public class DefaultCodegen implements CodegenConfig {
return openapiGeneratorIgnoreList; return openapiGeneratorIgnoreList;
} }
@Override
public boolean isTypeErasedGenerics() {
return false;
}
/* /*
A function to convert yaml or json ingested strings like property names A function to convert yaml or json ingested strings like property names
And convert special characters like newline, tab, carriage return And convert special characters like newline, tab, carriage return
Into strings that can be rendered in the language that the generator will output to Into strings that can be rendered in the language that the generator will output to
*/ */
protected String handleSpecialCharacters(String name) { return name; } protected String handleSpecialCharacters(String name) { return name; }
/** /**

View File

@@ -38,6 +38,8 @@ public class OpenAPINormalizer {
private Map<String, String> inputRules = new HashMap<>(); private Map<String, String> inputRules = new HashMap<>();
private Map<String, Boolean> rules = new HashMap<>(); private Map<String, Boolean> rules = new HashMap<>();
private TreeSet<String> anyTypeTreeSet = new TreeSet<>();
final Logger LOGGER = LoggerFactory.getLogger(OpenAPINormalizer.class); final Logger LOGGER = LoggerFactory.getLogger(OpenAPINormalizer.class);
Set<String> ruleNames = new TreeSet<>(); Set<String> ruleNames = new TreeSet<>();
@@ -112,6 +114,14 @@ public class OpenAPINormalizer {
boolean updateSetToNullable; boolean updateSetToNullable;
boolean updateMapToNullable; boolean updateMapToNullable;
// when set (e.g. operationId:getPetById|addPet), filter out (or remove) everything else
final String SET_PRIMITIVE_TYPES_TO_NULLABLE = "SET_PRIMITIVE_TYPES_TO_NULLABLE";
HashSet<String> setPrimitiveTypesToNullable = new HashSet<>();
boolean updateStringToNullable;
boolean updateIntegerToNullable;
boolean updateNumberToNullable;
boolean updateBooleanToNullable;
// ============= end of rules ============= // ============= end of rules =============
/** /**
@@ -143,12 +153,23 @@ public class OpenAPINormalizer {
ruleNames.add(NORMALIZE_31SPEC); ruleNames.add(NORMALIZE_31SPEC);
ruleNames.add(REMOVE_X_INTERNAL); ruleNames.add(REMOVE_X_INTERNAL);
ruleNames.add(FILTER); ruleNames.add(FILTER);
ruleNames.add(SET_CONTAINER_TO_NULLABLE);
ruleNames.add(SET_PRIMITIVE_TYPES_TO_NULLABLE);
// rules that are default to true // rules that are default to true
rules.put(SIMPLIFY_ONEOF_ANYOF, true); rules.put(SIMPLIFY_ONEOF_ANYOF, true);
rules.put(SIMPLIFY_BOOLEAN_ENUM, true); rules.put(SIMPLIFY_BOOLEAN_ENUM, true);
processRules(inputRules); processRules(inputRules);
// represent any type in tree set
anyTypeTreeSet.add("string");
anyTypeTreeSet.add("number");
anyTypeTreeSet.add("integer");
anyTypeTreeSet.add("boolean");
anyTypeTreeSet.add("object");
anyTypeTreeSet.add("array");
} }
/** /**
@@ -223,6 +244,26 @@ public class OpenAPINormalizer {
LOGGER.error("SET_CONTAINER_TO_NULLABLE rule must be in the form of `array|set|map`, e.g. `set`, `array|map`: {}", inputRules.get(SET_CONTAINER_TO_NULLABLE)); LOGGER.error("SET_CONTAINER_TO_NULLABLE rule must be in the form of `array|set|map`, e.g. `set`, `array|map`: {}", inputRules.get(SET_CONTAINER_TO_NULLABLE));
} }
} }
if (inputRules.get(SET_PRIMITIVE_TYPES_TO_NULLABLE) != null) {
rules.put(SET_PRIMITIVE_TYPES_TO_NULLABLE, true);
setPrimitiveTypesToNullable = new HashSet<>(Arrays.asList(inputRules.get(SET_PRIMITIVE_TYPES_TO_NULLABLE).split("[|]")));
if (setPrimitiveTypesToNullable.contains("string")) {
updateStringToNullable = true;
}
if (setPrimitiveTypesToNullable.contains("integer")) {
updateIntegerToNullable = true;
}
if (setPrimitiveTypesToNullable.contains("number")) {
updateNumberToNullable = true;
}
if (setPrimitiveTypesToNullable.contains("boolean")) {
updateBooleanToNullable = true;
}
if (!updateStringToNullable && !updateIntegerToNullable && !updateNumberToNullable && !updateBooleanToNullable) {
LOGGER.error("SET_PRIMITIVE_TYPES_TO_NULLABLE rule must be in the form of `string|integer|number|boolean`, e.g. `string`, `integer|number`: {}", inputRules.get(SET_PRIMITIVE_TYPES_TO_NULLABLE));
}
}
} }
/** /**
@@ -533,15 +574,18 @@ public class OpenAPINormalizer {
} }
private Schema normalizeSimpleSchema(Schema schema, Set<Schema> visitedSchemas) { private Schema normalizeSimpleSchema(Schema schema, Set<Schema> visitedSchemas) {
return processNormalize31Spec(schema, visitedSchemas); Schema result = processNormalize31Spec(schema, visitedSchemas);
return processSetPrimitiveTypesToNullable(result);
} }
private void normalizeBooleanSchema(Schema schema, Set<Schema> visitedSchemas) { private void normalizeBooleanSchema(Schema schema, Set<Schema> visitedSchemas) {
processSimplifyBooleanEnum(schema); processSimplifyBooleanEnum(schema);
processSetPrimitiveTypesToNullable(schema);
} }
private void normalizeIntegerSchema(Schema schema, Set<Schema> visitedSchemas) { private void normalizeIntegerSchema(Schema schema, Set<Schema> visitedSchemas) {
processAddUnsignedToIntegerWithInvalidMaxValue(schema); processAddUnsignedToIntegerWithInvalidMaxValue(schema);
processSetPrimitiveTypesToNullable(schema);
} }
private void normalizeProperties(Map<String, Schema> properties, Set<Schema> visitedSchemas) { private void normalizeProperties(Map<String, Schema> properties, Set<Schema> visitedSchemas) {
@@ -888,6 +932,27 @@ public class OpenAPINormalizer {
List<Schema> oneOfSchemas = schema.getOneOf(); List<Schema> oneOfSchemas = schema.getOneOf();
if (oneOfSchemas != null) { if (oneOfSchemas != null) {
// simplify any type with 6 sub-schemas (string, integer, etc) in oneOf
if (oneOfSchemas.size() == 6) {
TreeSet<String> ts = new TreeSet<>();
for (Schema s: oneOfSchemas) {
ts.add(s.getType());
}
if (ts.equals(anyTypeTreeSet)) {
Schema anyType = new Schema();
anyType.setDescription(schema.getDescription());
anyType.setNullable(schema.getNullable());
anyType.setExtensions(schema.getExtensions());
anyType.setTitle(schema.getTitle());
anyType.setExample(schema.getExample());
anyType.setExamples(schema.getExamples());
anyType.setDefault(schema.getDefault());
anyType.setDeprecated(schema.getDeprecated());
return anyType;
}
}
if (oneOfSchemas.removeIf(oneOf -> isNullTypeSchema(oneOf))) { if (oneOfSchemas.removeIf(oneOf -> isNullTypeSchema(oneOf))) {
schema.setNullable(true); schema.setNullable(true);
@@ -917,25 +982,49 @@ public class OpenAPINormalizer {
if (Boolean.TRUE.equals(schema.getUniqueItems())) { // a set if (Boolean.TRUE.equals(schema.getUniqueItems())) { // a set
if (updateSetToNullable) { if (updateSetToNullable) {
if (schema.getNullable() != null || (schema.getExtensions() != null && schema.getExtensions().containsKey("x-nullable"))) { return setNullable(schema);
// already set, don't overwrite
return schema;
}
schema.setNullable(true);
} }
} else { // array } else { // array
if (updateArrayToNullable) { if (updateArrayToNullable) {
if (schema.getNullable() != null || (schema.getExtensions() != null && schema.getExtensions().containsKey("x-nullable"))) { return setNullable(schema);
// already set, don't overwrite
return schema;
}
schema.setNullable(true);
} }
} }
return schema; return schema;
} }
/**
* Set nullable to true in primitive types (e.g. string) if needed.
*
* @param schema Schema
* @return Schema
*/
private Schema processSetPrimitiveTypesToNullable(Schema schema) {
if (!getRule(SET_PRIMITIVE_TYPES_TO_NULLABLE)) {
return schema;
}
if (updateStringToNullable && "string".equals(schema.getType())) {
return setNullable(schema);
} else if (updateIntegerToNullable && "integer".equals(schema.getType())) {
return setNullable(schema);
} else if (updateNumberToNullable && "number".equals(schema.getType())) {
return setNullable(schema);
} else if (updateBooleanToNullable && "boolean".equals(schema.getType())) {
return setNullable(schema);
}
return schema;
}
private Schema setNullable(Schema schema) {
if (schema.getNullable() != null || (schema.getExtensions() != null && schema.getExtensions().containsKey("x-nullable"))) {
// already set, don't overwrite
return schema;
}
schema.setNullable(true);
return schema;
}
/** /**
* Set nullable to true in map if needed. * Set nullable to true in map if needed.
* *
@@ -948,11 +1037,7 @@ public class OpenAPINormalizer {
} }
if (updateMapToNullable) { if (updateMapToNullable) {
if (schema.getNullable() != null || (schema.getExtensions() != null && schema.getExtensions().containsKey("x-nullable"))) { return setNullable(schema);
// already set, don't override
return schema;
}
schema.setNullable(true);
} }
return schema; return schema;
@@ -972,6 +1057,27 @@ public class OpenAPINormalizer {
List<Schema> anyOfSchemas = schema.getAnyOf(); List<Schema> anyOfSchemas = schema.getAnyOf();
if (anyOfSchemas != null) { if (anyOfSchemas != null) {
// simplify any type with 6 sub-schemas (string, integer, etc) in anyOf
if (anyOfSchemas.size() == 6) {
TreeSet<String> ts = new TreeSet<>();
for (Schema s: anyOfSchemas) {
ts.add(s.getType());
}
if (ts.equals(anyTypeTreeSet)) {
Schema anyType = new Schema();
anyType.setDescription(schema.getDescription());
anyType.setNullable(schema.getNullable());
anyType.setExtensions(schema.getExtensions());
anyType.setTitle(schema.getTitle());
anyType.setExample(schema.getExample());
anyType.setExamples(schema.getExamples());
anyType.setDefault(schema.getDefault());
anyType.setDeprecated(schema.getDeprecated());
return anyType;
}
}
if (anyOfSchemas.removeIf(anyOf -> isNullTypeSchema(anyOf))) { if (anyOfSchemas.removeIf(anyOf -> isNullTypeSchema(anyOf))) {
schema.setNullable(true); schema.setNullable(true);
} }

View File

@@ -734,6 +734,11 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
}); });
} }
String[] numericTypes = {"double", "double?", "decimal", "decimal", "float", "float?", "int", "int?", "long", "long?", "ulong", "ulong?"};
enumVars.forEach((enumVar) -> {
enumVar.put("isNumeric", Arrays.stream(numericTypes).anyMatch(dataType::equals));
});
return enumVars; return enumVars;
} }

View File

@@ -21,6 +21,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ArrayNode;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.samskivert.mustache.Mustache;
import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.PathItem;
@@ -139,7 +140,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
protected boolean implicitHeaders = false; protected boolean implicitHeaders = false;
protected String implicitHeadersRegex = null; protected String implicitHeadersRegex = null;
protected boolean camelCaseDollarSign = false; protected boolean camelCaseDollarSign = false;
protected boolean useJakartaEe = false; protected boolean useJakartaEe = true;
protected boolean containerDefaultToNull = false; protected boolean containerDefaultToNull = false;
private Map<String, String> schemaKeyToModelNameCache = new HashMap<>(); private Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
@@ -666,6 +667,14 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
this.setContainerDefaultToNull(Boolean.parseBoolean(additionalProperties.get(CONTAINER_DEFAULT_TO_NULL).toString())); this.setContainerDefaultToNull(Boolean.parseBoolean(additionalProperties.get(CONTAINER_DEFAULT_TO_NULL).toString()));
} }
additionalProperties.put(CONTAINER_DEFAULT_TO_NULL, containerDefaultToNull); additionalProperties.put(CONTAINER_DEFAULT_TO_NULL, containerDefaultToNull);
additionalProperties.put("sanitizeGeneric", (Mustache.Lambda) (fragment, writer) -> {
String content = fragment.execute();
for (final String s: List.of("<", ">", ",", " ")) {
content = content.replace(s, "");
}
writer.write(content);
});
} }
@Override @Override
@@ -1592,15 +1601,29 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
} }
// additional import for different cases // additional import for different cases
addAdditionalImports(codegenModel, codegenModel.oneOf); addAdditionalImports(codegenModel, codegenModel.getComposedSchemas());
addAdditionalImports(codegenModel, codegenModel.anyOf);
return codegenModel; return codegenModel;
} }
private void addAdditionalImports(CodegenModel model, Set<String> dataTypeSet) { private void addAdditionalImports(CodegenModel model, CodegenComposedSchemas composedSchemas) {
for (String dataType : dataTypeSet) { if(composedSchemas == null) {
if (null != importMapping().get(dataType)) { return;
model.imports.add(dataType); }
final List<List<CodegenProperty>> propertyLists = Arrays.asList(
composedSchemas.getAnyOf(),
composedSchemas.getOneOf(),
composedSchemas.getAllOf());
for(final List<CodegenProperty> propertyList : propertyLists){
if(propertyList == null)
{
continue;
}
for (CodegenProperty cp : propertyList) {
final String dataType = cp.baseType;
if (null != importMapping().get(dataType)) {
model.imports.add(dataType);
}
} }
} }
} }
@@ -2507,4 +2530,9 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
imports.add(importsItem); imports.add(importsItem);
} }
} }
@Override
public boolean isTypeErasedGenerics() {
return true;
}
} }

View File

@@ -615,10 +615,6 @@ public class SpringCodegen extends AbstractJavaCodegen
additionalProperties.put(USE_FEIGN_CLIENT, "true"); additionalProperties.put(USE_FEIGN_CLIENT, "true");
} else if (SPRING_BOOT.equals(library)) { } else if (SPRING_BOOT.equals(library)) {
apiTemplateFiles.put("apiController.mustache", "Controller.java"); apiTemplateFiles.put("apiController.mustache", "Controller.java");
if (containsEnums()) {
supportingFiles.add(new SupportingFile("converter.mustache",
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "EnumConverterConfiguration.java"));
}
supportingFiles.add(new SupportingFile("application.mustache", supportingFiles.add(new SupportingFile("application.mustache",
("src.main.resources").replace(".", java.io.File.separator), "application.properties")); ("src.main.resources").replace(".", java.io.File.separator), "application.properties"));
supportingFiles.add(new SupportingFile("homeController.mustache", supportingFiles.add(new SupportingFile("homeController.mustache",
@@ -786,6 +782,12 @@ public class SpringCodegen extends AbstractJavaCodegen
@Override @Override
public void preprocessOpenAPI(OpenAPI openAPI) { public void preprocessOpenAPI(OpenAPI openAPI) {
super.preprocessOpenAPI(openAPI); super.preprocessOpenAPI(openAPI);
if (!interfaceOnly && SPRING_BOOT.equals(library) && containsEnums()) {
supportingFiles.add(new SupportingFile("converter.mustache",
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "EnumConverterConfiguration.java"));
}
/* /*
* TODO the following logic should not need anymore in OAS 3.0 if * TODO the following logic should not need anymore in OAS 3.0 if
* ("/".equals(swagger.getBasePath())) { swagger.setBasePath(""); } * ("/".equals(swagger.getBasePath())) { swagger.setBasePath(""); }

View File

@@ -929,16 +929,76 @@ public class ModelUtils {
* @return schema without '$ref' * @return schema without '$ref'
*/ */
public static Schema getReferencedSchema(OpenAPI openAPI, Schema schema) { public static Schema getReferencedSchema(OpenAPI openAPI, Schema schema) {
if (schema != null && StringUtils.isNotEmpty(schema.get$ref())) { if (schema == null) {
String name = getSimpleRef(schema.get$ref()); return null;
Schema referencedSchema = getSchema(openAPI, name);
if (referencedSchema != null) {
return referencedSchema;
}
} }
if (StringUtils.isEmpty(schema.get$ref())) {
return schema;
}
try {
Schema refSchema = getSchemaFromRefToSchemaWithProperties(openAPI, schema.get$ref());
if (refSchema != null) {
// it's ref to schema's properties, #/components/schemas/Pet/properties/category for example
return refSchema;
}
} catch (Exception e) {
LOGGER.warn("Failed to parse $ref {}. Please report the issue to openapi-generator GitHub repo.", schema.get$ref());
}
// a simple ref, e.g. #/components/schemas/Pet
String name = getSimpleRef(schema.get$ref());
Schema referencedSchema = getSchema(openAPI, name);
if (referencedSchema != null) {
return referencedSchema;
}
return schema; return schema;
} }
/**
* Get the schema referenced by $ref to schema's properties, e.g. #/components/schemas/Pet/properties/category.
*
* @param openAPI specification being checked
* @param refString schema reference
* @return schema
*/
public static Schema getSchemaFromRefToSchemaWithProperties(OpenAPI openAPI, String refString) {
if (refString == null) {
return null;
}
String[] parts = refString.split("/");
// #/components/schemas/Pet/properties/category
if (parts.length == 6 && "properties".equals(parts[4])) {
Schema referencedSchema = getSchema(openAPI, parts[3]); // parts[3] is Pet
return (Schema) referencedSchema.getProperties().get(parts[5]); // parts[5] is category
} else {
return null;
}
}
/**
* Returns true if $ref to a reference to schema's properties, e.g. #/components/schemas/Pet/properties/category.
*
* @param refString schema reference
* @return true if $ref to a reference to schema's properties
*/
public static boolean isRefToSchemaWithProperties(String refString) {
if (refString == null) {
return false;
}
String[] parts = refString.split("/");
// #/components/schemas/Pet/properties/category
if (parts.length == 6 && "properties".equals(parts[4])) {
return true;
} else {
return false;
}
}
public static Schema getSchema(OpenAPI openAPI, String name) { public static Schema getSchema(OpenAPI openAPI, String name) {
if (name == null) { if (name == null) {
return null; return null;
@@ -1272,7 +1332,9 @@ public class ModelUtils {
} }
Schema ref = allSchemas.get(simpleRef); Schema ref = allSchemas.get(simpleRef);
if (ref == null) { if (ref == null) {
once(LOGGER).warn("{} is not defined", schema.get$ref()); if (!isRefToSchemaWithProperties(schema.get$ref())) {
once(LOGGER).warn("{} is not defined", schema.get$ref());
}
return schema; return schema;
} else if (ref.getEnum() != null && !ref.getEnum().isEmpty()) { } else if (ref.getEnum() != null && !ref.getEnum().isEmpty()) {
// top-level enum class // top-level enum class

View File

@@ -5,9 +5,9 @@ package {{package}};
import {{invokerPackage}}.ApiException; import {{invokerPackage}}.ApiException;
{{#imports}}import {{import}}; {{#imports}}import {{import}};
{{/imports}} {{/imports}}
import org.junit.Test; import org.junit.jupiter.api.Assertions;
import org.junit.Ignore; import org.junit.jupiter.api.Disabled;
import org.junit.Assert; import org.junit.jupiter.api.Test;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
@@ -19,7 +19,7 @@ import java.util.Map;
/** /**
* API tests for {{classname}} * API tests for {{classname}}
*/ */
public class {{classname}}Test { class {{classname}}Test {
private final {{classname}} api = new {{classname}}(); private final {{classname}} api = new {{classname}}();
@@ -38,7 +38,7 @@ public class {{classname}}Test {
* if the Api call fails * if the Api call fails
*/ */
@Test @Test
public void {{operationId}}Test() throws ApiException { void {{operationId}}Test() throws ApiException {
//{{#allParams}} //{{#allParams}}
//{{{dataType}}} {{paramName}} = null; //{{{dataType}}} {{paramName}} = null;
//{{/allParams}} //{{/allParams}}

View File

@@ -125,7 +125,7 @@ ext {
{{/useBeanValidation}} {{/useBeanValidation}}
jersey_version = "1.19.4" jersey_version = "1.19.4"
jodatime_version = "2.9.9" jodatime_version = "2.9.9"
junit_version = "4.13.2" junit_version = "5.10.2"
} }
dependencies { dependencies {
@@ -149,4 +149,20 @@ dependencies {
implementation "jakarta.validation:jakarta.validation-api:$bean_validation_version" implementation "jakarta.validation:jakarta.validation-api:$bean_validation_version"
{{/useBeanValidation}} {{/useBeanValidation}}
testImplementation "junit:junit:$junit_version" testImplementation "junit:junit:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
}
test {
// Enable JUnit 5 (Gradle 4.6+).
useJUnitPlatform()
// Always run tests, even when nothing changed.
dependsOn 'cleanTest'
// Show test results.
testLogging {
events "passed", "skipped", "failed"
}
} }

View File

@@ -78,37 +78,74 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0; int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken(); JsonToken token = tree.traverse(jp.getCodec()).nextToken();
{{#composedSchemas}}
{{#oneOf}} {{#oneOf}}
// deserialize {{{.}}} // deserialize {{{dataType}}}{{#isNullable}} (nullable){{/isNullable}}
try { try {
{{^isArray}}
boolean attemptParsing = true; boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper {{#isPrimitiveType}}
if ({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class) || {{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class) || {{{.}}}.class.equals(Boolean.class) || {{{.}}}.class.equals(String.class)) { attemptParsing = typeCoercion; //respect type coercion setting
attemptParsing = typeCoercion; if (!attemptParsing) {
if (!attemptParsing) { {{#isString}}
attemptParsing |= (({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); attemptParsing |= (token == JsonToken.VALUE_STRING);
attemptParsing |= (({{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); {{/isString}}
attemptParsing |= ({{{.}}}.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); {{#isInteger}}
attemptParsing |= ({{{.}}}.class.equals(String.class) && token == JsonToken.VALUE_STRING); attemptParsing |= (token == JsonToken.VALUE_NUMBER_INT);
{{#isNullable}} {{/isInteger}}
attemptParsing |= (token == JsonToken.VALUE_NULL); {{#isLong}}
{{/isNullable}} attemptParsing |= (token == JsonToken.VALUE_NUMBER_INT);
} {{/isLong}}
{{#isShort}}
attemptParsing |= (token == JsonToken.VALUE_NUMBER_INT);
{{/isShort}}
{{#isFloat}}
attemptParsing |= (token == JsonToken.VALUE_NUMBER_FLOAT);
{{/isFloat}}
{{#isDouble}}
attemptParsing |= (token == JsonToken.VALUE_NUMBER_FLOAT);
{{/isDouble}}
{{#isNumber}}
attemptParsing |= (token == JsonToken.VALUE_NUMBER_FLOAT);
{{/isNumber}}
{{#isDecimal}}
attemptParsing |= (token == JsonToken.VALUE_NUMBER_FLOAT);
{{/isDecimal}}
{{#isBoolean}}
attemptParsing |= (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
{{/isBoolean}}
{{#isNullable}}
attemptParsing |= (token == JsonToken.VALUE_NULL);
{{/isNullable}}
} }
{{/isPrimitiveType}}
if (attemptParsing) { if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class); deserialized = tree.traverse(jp.getCodec()).readValueAs({{{dataType}}}.class);
// TODO: there is no validation against JSON schema constraints // TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON // (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be. // validation, which means the 'match' count may be higher than it should be.
match++; match++;
log.log(Level.FINER, "Input data matches schema '{{{.}}}'"); log.log(Level.FINER, "Input data matches schema '{{{dataType}}}'");
} }
{{/isArray}}
{{#isArray}}
if (token == JsonToken.START_ARRAY) {
final TypeReference<{{{dataType}}}> ref = new TypeReference<{{{dataType}}}>(){};
deserialized = tree.traverse(jp.getCodec()).readValueAs(ref);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema '{{{dataType}}}'");
}
{{/isArray}}
} catch (Exception e) { } catch (Exception e) {
// deserialization failed, continue // deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e); log.log(Level.FINER, "Input data does not match schema '{{{dataType}}}'", e);
} }
{{/oneOf}} {{/oneOf}}
{{/composedSchemas}}
if (match == 1) { if (match == 1) {
{{classname}} ret = new {{classname}}(); {{classname}} ret = new {{classname}}();
ret.setActualInstance(deserialized); ret.setActualInstance(deserialized);
@@ -152,13 +189,17 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties); return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties);
} }
{{/additionalPropertiesType}} {{/additionalPropertiesType}}
{{#composedSchemas}}
{{#oneOf}} {{#oneOf}}
public {{classname}}({{{.}}} o) { {{^vendorExtensions.x-duplicated-data-type}}
public {{classname}}({{{baseType}}} o) {
super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
setActualInstance(o); setActualInstance(o);
} }
{{/vendorExtensions.x-duplicated-data-type}}
{{/oneOf}} {{/oneOf}}
{{/composedSchemas}}
static { static {
{{#oneOf}} {{#oneOf}}
schemas.put("{{{.}}}", new GenericType<{{{.}}}>() { schemas.put("{{{.}}}", new GenericType<{{{.}}}>() {
@@ -198,13 +239,17 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
} }
{{/isNullable}} {{/isNullable}}
{{#composedSchemas}}
{{#oneOf}} {{#oneOf}}
if (JSON.isInstanceOf({{{.}}}.class, instance, new HashSet<>())) { {{^vendorExtensions.x-duplicated-data-type}}
if (JSON.isInstanceOf({{{baseType}}}.class, instance, new HashSet<>())) {
super.setActualInstance(instance); super.setActualInstance(instance);
return; return;
} }
{{/vendorExtensions.x-duplicated-data-type}}
{{/oneOf}} {{/oneOf}}
{{/composedSchemas}}
throw new RuntimeException("Invalid instance type. Must be {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}"); throw new RuntimeException("Invalid instance type. Must be {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}");
} }
@@ -219,17 +264,26 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return super.getActualInstance(); return super.getActualInstance();
} }
{{#composedSchemas}}
{{#oneOf}} {{#oneOf}}
/** /**
* Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`, * Get the actual instance of `{{{dataType}}}`. If the actual instance is not `{{{dataType}}}`,
* the ClassCastException will be thrown. * the ClassCastException will be thrown.
* *
* @return The actual instance of `{{{.}}}` * @return The actual instance of `{{{dataType}}}`
* @throws ClassCastException if the instance is not `{{{.}}}` * @throws ClassCastException if the instance is not `{{{dataType}}}`
*/ */
public {{{.}}} get{{{.}}}() throws ClassCastException { {{^isArray}}
return ({{{.}}})super.getActualInstance(); public {{{dataType}}} get{{{dataType}}}() throws ClassCastException {
return ({{{dataType}}})super.getActualInstance();
} }
{{/isArray}}
{{#isArray}}
public {{{dataType}}} get{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}() throws ClassCastException {
return ({{{dataType}}})super.getActualInstance();
}
{{/isArray}}
{{/oneOf}} {{/oneOf}}
{{/composedSchemas}}
} }

View File

@@ -21,7 +21,7 @@ import {{invokerPackage}}.JSON;
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}}
@JsonDeserialize(using={{classname}}.{{classname}}Deserializer.class) @JsonDeserialize(using={{classname}}.{{classname}}Deserializer.class)
@JsonSerialize(using = {{classname}}.{{classname}}Serializer.class) @JsonSerialize(using = {{classname}}.{{classname}}Serializer.class)
public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} {
private static final Logger log = Logger.getLogger({{classname}}.class.getName()); private static final Logger log = Logger.getLogger({{classname}}.class.getName());
public static class {{classname}}Serializer extends StdSerializer<{{classname}}> { public static class {{classname}}Serializer extends StdSerializer<{{classname}}> {

View File

@@ -23,7 +23,7 @@ import {{invokerPackage}}.JSON;
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}}
@JsonDeserialize(using = {{classname}}.{{classname}}Deserializer.class) @JsonDeserialize(using = {{classname}}.{{classname}}Deserializer.class)
@JsonSerialize(using = {{classname}}.{{classname}}Serializer.class) @JsonSerialize(using = {{classname}}.{{classname}}Serializer.class)
public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} {
private static final Logger log = Logger.getLogger({{classname}}.class.getName()); private static final Logger log = Logger.getLogger({{classname}}.class.getName());
public static class {{classname}}Serializer extends StdSerializer<{{classname}}> { public static class {{classname}}Serializer extends StdSerializer<{{classname}}> {

View File

@@ -112,8 +112,8 @@ ext {
dependencies { dependencies {
implementation 'io.swagger:swagger-annotations:1.6.8' implementation 'io.swagger:swagger-annotations:1.6.8'
implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation 'com.squareup.okhttp3:okhttp:4.10.0' implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0' implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
implementation 'com.google.code.gson:gson:2.9.1' implementation 'com.google.code.gson:gson:2.9.1'
implementation 'io.gsonfire:gson-fire:1.9.0' implementation 'io.gsonfire:gson-fire:1.9.0'
implementation 'javax.ws.rs:jsr311-api:1.1.1' implementation 'javax.ws.rs:jsr311-api:1.1.1'

View File

@@ -10,8 +10,8 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal, resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.6.5", "io.swagger" % "swagger-annotations" % "1.6.5",
"com.squareup.okhttp3" % "okhttp" % "4.10.0", "com.squareup.okhttp3" % "okhttp" % "4.12.0",
"com.squareup.okhttp3" % "logging-interceptor" % "4.10.0", "com.squareup.okhttp3" % "logging-interceptor" % "4.12.0",
"com.google.code.gson" % "gson" % "2.9.1", "com.google.code.gson" % "gson" % "2.9.1",
"org.apache.commons" % "commons-lang3" % "3.12.0", "org.apache.commons" % "commons-lang3" % "3.12.0",
"javax.ws.rs" % "jsr311-api" % "1.1.1", "javax.ws.rs" % "jsr311-api" % "1.1.1",

View File

@@ -4,8 +4,9 @@ package {{package}};
{{#imports}}import {{import}}; {{#imports}}import {{import}};
{{/imports}} {{/imports}}
import org.junit.Test; import org.junit.jupiter.api.Disabled;
import org.junit.Ignore; import org.junit.jupiter.api.Test;
import org.springframework.web.client.RestClientException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
@@ -17,8 +18,8 @@ import java.util.Map;
/** /**
* API tests for {{classname}} * API tests for {{classname}}
*/ */
@Ignore @Disabled
public class {{classname}}Test { class {{classname}}Test {
private final {{classname}} api = new {{classname}}(); private final {{classname}} api = new {{classname}}();
@@ -28,11 +29,11 @@ public class {{classname}}Test {
* *
* {{notes}} * {{notes}}
* *
* @throws ApiException * @throws RestClientException
* if the Api call fails * if the Api call fails
*/ */
@Test @Test
public void {{operationId}}Test() { void {{operationId}}Test() {
{{#allParams}} {{#allParams}}
{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection<org.springframework.core.io.Resource>{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.Resource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}} = null; {{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection<org.springframework.core.io.Resource>{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.Resource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}} = null;
{{/allParams}} {{/allParams}}

View File

@@ -121,15 +121,15 @@ ext {
jackson_databind_nullable_version = "0.2.6" jackson_databind_nullable_version = "0.2.6"
{{/openApiNullable}} {{/openApiNullable}}
{{#useJakartaEe}} {{#useJakartaEe}}
spring_web_version = "6.0.17" spring_web_version = "6.1.5"
jakarta_annotation_version = "2.1.1" jakarta_annotation_version = "2.1.1"
{{/useJakartaEe}} {{/useJakartaEe}}
{{^useJakartaEe}} {{^useJakartaEe}}
spring_web_version = "5.3.32" spring_web_version = "5.3.33"
jakarta_annotation_version = "1.3.5" jakarta_annotation_version = "1.3.5"
{{/useJakartaEe}} {{/useJakartaEe}}
jodatime_version = "2.9.9" jodatime_version = "2.9.9"
junit_version = "4.13.2" junit_version = "5.10.2"
} }
dependencies { dependencies {
@@ -158,5 +158,20 @@ dependencies {
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version" implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
{{/withXml}} {{/withXml}}
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version" testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
}
test {
// Enable JUnit 5 (Gradle 4.6+).
useJUnitPlatform()
// Always run tests, even when nothing changed.
dependsOn 'cleanTest'
// Show test results.
testLogging {
events "passed", "skipped", "failed"
}
} }

View File

@@ -76,6 +76,14 @@
<forkMode>pertest</forkMode> <forkMode>pertest</forkMode>
<useUnlimitedThreads>true</useUnlimitedThreads> <useUnlimitedThreads>true</useUnlimitedThreads>
</configuration> </configuration>
<dependencies>
<!--Custom provider and engine for Junit 5 to surefire-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-version}</version>
</dependency>
</dependencies>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
@@ -339,11 +347,17 @@
<!-- test dependencies --> <!-- test dependencies -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit</artifactId> <artifactId>junit-jupiter-engine</artifactId>
<version>${junit-version}</version> <version>${junit-version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit-platform-runner.version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -354,10 +368,10 @@
<swagger-annotations-version>2.2.15</swagger-annotations-version> <swagger-annotations-version>2.2.15</swagger-annotations-version>
{{/swagger2AnnotationLibrary}} {{/swagger2AnnotationLibrary}}
{{#useJakartaEe}} {{#useJakartaEe}}
<spring-web-version>6.0.17</spring-web-version> <spring-web-version>6.1.5</spring-web-version>
{{/useJakartaEe}} {{/useJakartaEe}}
{{^useJakartaEe}} {{^useJakartaEe}}
<spring-web-version>5.3.32</spring-web-version> <spring-web-version>5.3.33</spring-web-version>
{{/useJakartaEe}} {{/useJakartaEe}}
<jackson-version>2.15.2</jackson-version> <jackson-version>2.15.2</jackson-version>
<jackson-databind-version>2.15.2</jackson-databind-version> <jackson-databind-version>2.15.2</jackson-databind-version>
@@ -379,6 +393,7 @@
{{#performBeanValidation}} {{#performBeanValidation}}
<hibernate-validator-version>5.4.3.Final</hibernate-validator-version> <hibernate-validator-version>5.4.3.Final</hibernate-validator-version>
{{/performBeanValidation}} {{/performBeanValidation}}
<junit-version>4.13.2</junit-version> <junit-version>5.10.2</junit-version>
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
</properties> </properties>
</project> </project>

View File

@@ -4,14 +4,14 @@ package {{package}};
{{#imports}}import {{import}}; {{#imports}}import {{import}};
{{/imports}} {{/imports}}
import org.junit.Assert; import org.junit.jupiter.api.Assertions;
import org.junit.Ignore; import org.junit.jupiter.api.Disabled;
import org.junit.Test; import org.junit.jupiter.api.Test;
/** /**
* Model tests for {{classname}} * Model tests for {{classname}}
*/ */
public class {{classname}}Test { class {{classname}}Test {
{{#models}} {{#models}}
{{#model}} {{#model}}
{{^vendorExtensions.x-is-one-of-interface}} {{^vendorExtensions.x-is-one-of-interface}}
@@ -23,7 +23,7 @@ public class {{classname}}Test {
* Model tests for {{classname}} * Model tests for {{classname}}
*/ */
@Test @Test
public void test{{classname}}() { void test{{classname}}() {
// TODO: test {{classname}} // TODO: test {{classname}}
} }
@@ -32,7 +32,7 @@ public class {{classname}}Test {
* Test the property '{{name}}' * Test the property '{{name}}'
*/ */
@Test @Test
public void {{name}}Test() { void {{name}}Test() {
// TODO: test {{name}} // TODO: test {{name}}
} }

View File

@@ -92,6 +92,14 @@
<parallel>methods</parallel> <parallel>methods</parallel>
<forkMode>pertest</forkMode> <forkMode>pertest</forkMode>
</configuration> </configuration>
<dependencies>
<!--Custom provider and engine for Junit 5 to surefire-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-version}</version>
</dependency>
</dependencies>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
@@ -335,11 +343,17 @@
</dependency> </dependency>
<!-- test dependencies --> <!-- test dependencies -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit</artifactId> <artifactId>junit-jupiter-engine</artifactId>
<version>${junit-version}</version> <version>${junit-version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit-platform-runner.version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -362,6 +376,7 @@
<beanvalidation-version>3.0.2</beanvalidation-version> <beanvalidation-version>3.0.2</beanvalidation-version>
{{/useBeanValidation}} {{/useBeanValidation}}
<maven-plugin-version>1.0.0</maven-plugin-version> <maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.13.2</junit-version> <junit-version>5.10.2</junit-version>
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
</properties> </properties>
</project> </project>

View File

@@ -1,7 +1,6 @@
package {{configPackage}}; package {{configPackage}};
{{#authMethods}}
{{#isOAuth}}
import java.util.Properties; import java.util.Properties;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.ConfigurableEnvironment;
@@ -11,31 +10,34 @@ import org.springframework.core.env.PropertiesPropertySource;
public class ClientPropertiesConfiguration { public class ClientPropertiesConfiguration {
public ClientPropertiesConfiguration( final ConfigurableEnvironment configurableEnvironment ) { public ClientPropertiesConfiguration( final ConfigurableEnvironment configurableEnvironment ) {
final Properties properties = new Properties(); {{#authMethods}}
properties.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.client-id", "set-{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}-client-id" ); {{#isOAuth}}
properties.put("{{#scopes}}{{#-first}}spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.scope", "{{/-first}}{{scope}}{{^-last}},{{/-last}}{{/scopes}}" ); final Properties {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}} = new Properties();
{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.client-id", "set-{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}-client-id" );
{{#hasScopes}}
{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("{{#scopes}}{{#-first}}spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.scope", "{{/-first}}{{scope}}{{^-last}},{{/-last}}{{/scopes}}" );
{{/hasScopes}}
{{#isCode}} {{#isCode}}
properties.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-grant-type", "authorization_code" ); {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-grant-type", "authorization_code" );
properties.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.redirect-uri", "set-{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}-redirect-uri" ); {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.redirect-uri", "set-{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}-redirect-uri" );
properties.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.token-uri", "{{{tokenUrl}}}" ); {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.token-uri", "{{{tokenUrl}}}" );
properties.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-uri", "{{{authorizationUrl}}}" ); {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-uri", "{{{authorizationUrl}}}" );
{{/isCode}} {{/isCode}}
{{#isPassword}} {{#isPassword}}
properties.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-grant-type", "password" ); {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-grant-type", "password" );
properties.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.token-uri", "{{{tokenUrl}}}" ); {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.token-uri", "{{{tokenUrl}}}" );
{{/isPassword}} {{/isPassword}}
{{#isApplication}} {{#isApplication}}
properties.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-grant-type", "client_credentials" ); {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-grant-type", "client_credentials" );
properties.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.token-uri", "{{{tokenUrl}}}" ); {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.token-uri", "{{{tokenUrl}}}" );
{{/isApplication}} {{/isApplication}}
{{#isImplicit}} {{#isImplicit}}
properties.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-grant-type", "implicit" ); {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-grant-type", "implicit" );
properties.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-uri", "{{{authorizationUrl}}}" ); {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-uri", "{{{authorizationUrl}}}" );
{{/isImplicit}} {{/isImplicit}}
final PropertiesPropertySource propertiesPropertySource = new PropertiesPropertySource("{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}", properties ); configurableEnvironment.getPropertySources().addLast( new PropertiesPropertySource("{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}", {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}} ) );
configurableEnvironment.getPropertySources().addLast( propertiesPropertySource ); {{/isOAuth}}
{{/authMethods}}
} }
} }
{{/isOAuth}}
{{/authMethods}}

View File

@@ -459,7 +459,7 @@
{{/isInnerEnum}} {{/isInnerEnum}}
{{^isInnerEnum}} {{^isInnerEnum}}
{{#lambda.copy}} {{#lambda.copy}}
{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}RawValue {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}
{{/lambda.copy}} {{/lambda.copy}}
{{#required}} {{#required}}
{{#isNullable}} {{#isNullable}}
@@ -472,7 +472,7 @@
{{#enumVars}} {{#enumVars}}
{{#-first}} {{#-first}}
{{#isString}} {{#isString}}
if ({{#lambda.pasteLine}}{{/lambda.pasteLine}} != null){{! we cant use name here because enumVar also has a name property, so use the paste lambda instead }} if ({{#lambda.pasteLine}}{{/lambda.pasteLine}}RawValue != null){{! we cant use name here because enumVar also has a name property, so use the paste lambda instead }}
writer.WriteString("{{baseName}}", {{#lambda.camelcase_sanitize_param}}{{nameInPascalCase}}{{/lambda.camelcase_sanitize_param}}RawValue); writer.WriteString("{{baseName}}", {{#lambda.camelcase_sanitize_param}}{{nameInPascalCase}}{{/lambda.camelcase_sanitize_param}}RawValue);
else else
writer.WriteNull("{{baseName}}"); writer.WriteNull("{{baseName}}");
@@ -490,12 +490,12 @@
{{#allowableValues}} {{#allowableValues}}
{{#enumVars}} {{#enumVars}}
{{#-first}} {{#-first}}
{{#isString}} {{^isNumeric}}
writer.WriteString("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); writer.WriteString("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}RawValue);
{{/isString}} {{/isNumeric}}
{{^isString}} {{#isNumeric}}
writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_sanitize_param}}{{#lambda.pasteLine}}{{/lambda.pasteLine}}{{/lambda.camelcase_sanitize_param}}RawValue); writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_sanitize_param}}{{#lambda.pasteLine}}{{/lambda.pasteLine}}{{/lambda.camelcase_sanitize_param}}RawValue);
{{/isString}} {{/isNumeric}}
{{/-first}} {{/-first}}
{{/enumVars}} {{/enumVars}}
{{/allowableValues}} {{/allowableValues}}
@@ -507,16 +507,16 @@
{{#isNullable}} {{#isNullable}}
if ({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option{{nrt!}}.Value != null) if ({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option{{nrt!}}.Value != null)
{ {
var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.Value{{nrt!}}.Value); var {{#lambda.pasteLine}}{{/lambda.pasteLine}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.Value{{nrt!}}.Value);
writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{^isNumeric}}WriteString {{/isNumeric}}{{#isNumeric}}WriteNumber {{/isNumeric}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}RawValue);
} }
else else
writer.WriteNull("{{baseName}}"); writer.WriteNull("{{baseName}}");
{{/isNullable}} {{/isNullable}}
{{^isNullable}} {{^isNullable}}
{ {
var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{nrt!}}.Value); var {{#lambda.pasteLine}}{{/lambda.pasteLine}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{nrt!}}.Value);
writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{^isNumeric}}WriteString {{/isNumeric}}{{#isNumeric}}WriteNumber {{/isNumeric}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}RawValue);
} }
{{/isNullable}} {{/isNullable}}
{{/required}} {{/required}}

View File

@@ -1 +1 @@
{{#parentModel.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{parent}}{{/lambda.camelcase_sanitize_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.anyOf}}{{#allVars}}{{#isInherited}}{{^isNew}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{/isNew}}{{#isNew}}{{#isEnum}}{{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{^required}}.Value{{/required}}){{/isEnum}}{{^isEnum}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}.ToString(){{/isEnum}}{{/isNew}} {{/isInherited}}{{/allVars}} {{#parentModel.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{parent}}{{/lambda.camelcase_sanitize_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.anyOf}}{{#allVars}}{{#isInherited}}{{^isNew}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{/isNew}}{{#isNew}}{{#isEnum}}{{#isInnerEnum}}{{classname}}.{{{datatypeWithEnum}}}ToJsonValue{{/isInnerEnum}}{{^isInnerEnum}}{{{datatypeWithEnum}}}ValueConverter.ToJsonValue{{/isInnerEnum}}({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{^required}}.Value{{/required}}){{/isEnum}}{{^isEnum}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}.ToString(){{/isEnum}}{{/isNew}} {{/isInherited}}{{/allVars}}

View File

@@ -25,7 +25,7 @@
<ItemGroup> <ItemGroup>
{{#useCompareNetObjects}} {{#useCompareNetObjects}}
<PackageReference Include="CompareNETObjects" Version="4.82.0" /> <PackageReference Include="CompareNETObjects" Version="4.83.0" />
{{/useCompareNetObjects}} {{/useCompareNetObjects}}
{{^useGenericHost}} {{^useGenericHost}}
<PackageReference Include="JsonSubTypes" Version="2.0.1" /> <PackageReference Include="JsonSubTypes" Version="2.0.1" />
@@ -38,10 +38,10 @@
<PackageReference Include="Microsoft.Extensions.Http" Version="{{#lambda.first}}{{#netStandard}}5.0.0 {{/netStandard}}{{#net47}}7.0.0 {{/net47}}{{#net48}}7.0.0 {{/net48}}{{#net6.0}}6.0.0 {{/net6.0}}{{#net7.0}}7.0.0 {{/net7.0}}{{#net8.0}}8.0.0 {{/net8.0}}{{/lambda.first}}" /> <PackageReference Include="Microsoft.Extensions.Http" Version="{{#lambda.first}}{{#netStandard}}5.0.0 {{/netStandard}}{{#net47}}7.0.0 {{/net47}}{{#net48}}7.0.0 {{/net48}}{{#net6.0}}6.0.0 {{/net6.0}}{{#net7.0}}7.0.0 {{/net7.0}}{{#net8.0}}8.0.0 {{/net8.0}}{{/lambda.first}}" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="{{#lambda.first}}{{#netStandard}}5.0.0 {{/netStandard}}{{#net47}}7.0.0 {{/net47}}{{#net48}}7.0.0 {{/net48}}{{#net6.0}}6.0.1 {{/net6.0}}{{#net7.0}}7.0.1 {{/net7.0}}{{#net8.0}}8.0.0 {{/net8.0}}{{/lambda.first}}" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="{{#lambda.first}}{{#netStandard}}5.0.0 {{/netStandard}}{{#net47}}7.0.0 {{/net47}}{{#net48}}7.0.0 {{/net48}}{{#net6.0}}6.0.1 {{/net6.0}}{{#net7.0}}7.0.1 {{/net7.0}}{{#net8.0}}8.0.0 {{/net8.0}}{{/lambda.first}}" />
{{#supportsRetry}} {{#supportsRetry}}
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="{{#lambda.first}}{{#netStandard}}5.0.1 {{/netStandard}}{{#net47}}7.0.0 {{/net47}}{{#net48}}7.0.0 {{/net48}}{{#net6.0}}6.0.19 {{/net6.0}}{{#net7.0}}7.0.11 {{/net7.0}}{{#net8.0}}8.0.0 {{/net8.0}}{{/lambda.first}}" /> <PackageReference Include="Microsoft.Extensions.Http.Polly" Version="{{#lambda.first}}{{#netStandard}}5.0.1 {{/netStandard}}{{#net47}}7.0.0 {{/net47}}{{#net48}}7.0.0 {{/net48}}{{#net6.0}}6.0.19 {{/net6.0}}{{#net7.0}}7.0.11 {{/net7.0}}{{#net8.0}}8.0.3 {{/net8.0}}{{/lambda.first}}" />
{{/supportsRetry}} {{/supportsRetry}}
{{#net80OrLater}} {{#net80OrLater}}
<PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.0" /> <PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.3" />
{{/net80OrLater}} {{/net80OrLater}}
{{#netStandard}} {{#netStandard}}
<PackageReference Include="System.Threading.Channels" Version="8.0.0" /> <PackageReference Include="System.Threading.Channels" Version="8.0.0" />

View File

@@ -9,9 +9,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="{{^netStandard}}17.8.0{{/netStandard}}{{#netStandard}}15.9.2{{/netStandard}}" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="{{^netStandard}}17.9.0{{/netStandard}}{{#netStandard}}15.9.2{{/netStandard}}" />
<PackageReference Include="xunit" Version="{{^netStandard}}2.6.1{{/netStandard}}{{#netStandard}}2.4.2{{/netStandard}}" /> <PackageReference Include="xunit" Version="{{^netStandard}}2.7.0{{/netStandard}}{{#netStandard}}2.4.2{{/netStandard}}" />
<PackageReference Include="xunit.runner.visualstudio" Version="{{^netStandard}}2.5.3{{/netStandard}}{{#netStandard}}2.4.5{{/netStandard}}" /> <PackageReference Include="xunit.runner.visualstudio" Version="{{^netStandard}}2.5.7{{/netStandard}}{{#netStandard}}2.4.5{{/netStandard}}" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -13,7 +13,7 @@ require 'typhoeus'
{{#isFaraday}} {{#isFaraday}}
require 'faraday' require 'faraday'
require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0') require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
require 'filemagic' require 'marcel'
{{/isFaraday}} {{/isFaraday}}
{{#isHttpx}} {{#isHttpx}}
require 'httpx' require 'httpx'

View File

@@ -94,8 +94,7 @@
form_params.each do |key, value| form_params.each do |key, value|
case value case value
when ::File, ::Tempfile when ::File, ::Tempfile
filemagic = FileMagic.new(FileMagic::MAGIC_MIME) data[key] = Faraday::FilePart.new(value.path, Marcel::MimeType.for(Pathname.new(value.path)))
data[key] = Faraday::FilePart.new(value.path, filemagic.file(value.path, true))
when ::Array, nil when ::Array, nil
# let Faraday handle Array and nil parameters # let Faraday handle Array and nil parameters
data[key] = value data[key] = value

View File

@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
{{#isFaraday}} {{#isFaraday}}
s.add_runtime_dependency 'faraday', '>= 1.0.1', '< 3.0' s.add_runtime_dependency 'faraday', '>= 1.0.1', '< 3.0'
s.add_runtime_dependency 'faraday-multipart' s.add_runtime_dependency 'faraday-multipart'
s.add_runtime_dependency 'ruby-filemagic' s.add_runtime_dependency 'marcel'
{{/isFaraday}} {{/isFaraday}}
{{#isTyphoeus}} {{#isTyphoeus}}
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'

View File

@@ -168,6 +168,12 @@ public class OpenAPINormalizerTest {
Schema schema9 = openAPI.getComponents().getSchemas().get("AnyOfStringArrayOfString"); Schema schema9 = openAPI.getComponents().getSchemas().get("AnyOfStringArrayOfString");
assertEquals(schema9.getAnyOf().size(), 2); assertEquals(schema9.getAnyOf().size(), 2);
Schema schema11 = openAPI.getComponents().getSchemas().get("AnyOfAnyType");
assertEquals(schema11.getAnyOf().size(), 6);
Schema schema13 = openAPI.getComponents().getSchemas().get("OneOfAnyType");
assertEquals(schema13.getOneOf().size(), 6);
Map<String, String> options = new HashMap<>(); Map<String, String> options = new HashMap<>();
options.put("SIMPLIFY_ONEOF_ANYOF", "true"); options.put("SIMPLIFY_ONEOF_ANYOF", "true");
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options); OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
@@ -192,6 +198,15 @@ public class OpenAPINormalizerTest {
Schema schema10 = openAPI.getComponents().getSchemas().get("AnyOfStringArrayOfString"); Schema schema10 = openAPI.getComponents().getSchemas().get("AnyOfStringArrayOfString");
assertEquals(schema10.getAnyOf().size(), 2); assertEquals(schema10.getAnyOf().size(), 2);
Schema schema12 = openAPI.getComponents().getSchemas().get("AnyOfAnyType");
assertEquals(schema12.getAnyOf(), null);
assertEquals(schema12.getType(), null);
Schema schema14 = openAPI.getComponents().getSchemas().get("OneOfAnyType");
assertEquals(schema14.getOneOf(), null);
assertEquals(schema14.getType(), null);
} }
@Test @Test
@@ -514,6 +529,48 @@ public class OpenAPINormalizerTest {
assertEquals(((Schema) schema4.getProperties().get("map_property")).getNullable(), null); assertEquals(((Schema) schema4.getProperties().get("map_property")).getNullable(), null);
} }
@Test
public void testSetPrimitiveTypesToNullable() {
// test `string|integer|number|boolean`
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0//setPrimitiveTypesToNullable_test.yaml");
Schema schema = openAPI.getComponents().getSchemas().get("Person");
assertEquals(((Schema) schema.getProperties().get("lastName")).getNullable(), null);
assertEquals(((Schema) schema.getProperties().get("first_integer")).getNullable(), null);
assertEquals(((Schema) schema.getProperties().get("first_number")).getNullable(), null);
assertEquals(((Schema) schema.getProperties().get("first_boolean")).getNullable(), null);
Map<String, String> options = new HashMap<>();
options.put("SET_PRIMITIVE_TYPES_TO_NULLABLE", "string|integer|number|boolean");
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
openAPINormalizer.normalize();
Schema schema2 = openAPI.getComponents().getSchemas().get("Person");
assertEquals(((Schema) schema2.getProperties().get("lastName")).getNullable(), true);
assertEquals(((Schema) schema2.getProperties().get("first_integer")).getNullable(), true);
assertEquals(((Schema) schema2.getProperties().get("first_number")).getNullable(), true);
assertEquals(((Schema) schema2.getProperties().get("first_boolean")).getNullable(), true);
// test `number` only
OpenAPI openAPI2 = TestUtils.parseSpec("src/test/resources/3_0//setPrimitiveTypesToNullable_test.yaml");
Schema schema3 = openAPI2.getComponents().getSchemas().get("Person");
assertEquals(((Schema) schema3.getProperties().get("lastName")).getNullable(), null);
assertEquals(((Schema) schema3.getProperties().get("first_integer")).getNullable(), null);
assertEquals(((Schema) schema3.getProperties().get("first_number")).getNullable(), null);
assertEquals(((Schema) schema3.getProperties().get("first_boolean")).getNullable(), null);
options.put("SET_PRIMITIVE_TYPES_TO_NULLABLE", "number");
OpenAPINormalizer openAPINormalizer2 = new OpenAPINormalizer(openAPI2, options);
openAPINormalizer2.normalize();
Schema schema4 = openAPI2.getComponents().getSchemas().get("Person");
assertEquals(((Schema) schema4.getProperties().get("lastName")).getNullable(), null);
assertEquals(((Schema) schema4.getProperties().get("first_integer")).getNullable(), null);
assertEquals(((Schema) schema4.getProperties().get("first_number")).getNullable(), true);
assertEquals(((Schema) schema4.getProperties().get("first_boolean")).getNullable(), null);
}
@Test @Test
public void testOpenAPINormalizerSimplifyOneOfAnyOf31Spec() { public void testOpenAPINormalizerSimplifyOneOfAnyOf31Spec() {
// to test the rule SIMPLIFY_ONEOF_ANYOF in 3.1 spec // to test the rule SIMPLIFY_ONEOF_ANYOF in 3.1 spec

View File

@@ -57,7 +57,6 @@ import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.assertj.core.api.MapAssert; import org.assertj.core.api.MapAssert;
import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CliOption;
@@ -1198,7 +1197,7 @@ public class SpringCodegenTest {
output.deleteOnExit(); output.deleteOnExit();
OpenAPI openAPI = new OpenAPIParser() OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/3_0/issue_18090.yaml", null, new ParseOptions()).getOpenAPI(); .readLocation("src/test/resources/3_0/spring/petstore-auth.yaml", null, new ParseOptions()).getOpenAPI();
final SpringCodegen codegen = new SpringCodegen(); final SpringCodegen codegen = new SpringCodegen();
codegen.setOpenAPI(openAPI); codegen.setOpenAPI(openAPI);
@@ -1226,9 +1225,23 @@ public class SpringCodegenTest {
Path filePath = Paths.get(output.getAbsolutePath(), "src/main/java/org/openapitools/configuration/ClientPropertiesConfiguration.java"); Path filePath = Paths.get(output.getAbsolutePath(), "src/main/java/org/openapitools/configuration/ClientPropertiesConfiguration.java");
String content = new String(Files.readAllBytes(filePath), "UTF-8");
Assert.assertTrue(content.contains("properties.put(\"spring.security.oauth2.client.provider.oAuth2AccessCode.token-uri\", \"${tokenUrl}\" );")); assertFileContains(filePath,
Assert.assertTrue(content.contains("properties.put(\"spring.security.oauth2.client.provider.oAuth2AccessCode.authorization-uri\", \"${authorizationUrl}\" );")); "oAuth2AccessCode.put(\"spring.security.oauth2.client.registration.oAuth2AccessCode.redirect-uri\", \"set-oAuth2AccessCode-redirect-uri\" );",
"oAuth2AccessCode.put(\"spring.security.oauth2.client.registration.oAuth2AccessCode.authorization-grant-type\", \"authorization_code\" );",
"oAuth2AccessCode.put(\"spring.security.oauth2.client.registration.oAuth2AccessCode.client-id\", \"set-oAuth2AccessCode-client-id\" );",
"oAuth2AccessCode.put(\"spring.security.oauth2.client.registration.oAuth2AccessCode.scope\", \"openid,profile,aud\" );",
"oAuth2AccessCode.put(\"spring.security.oauth2.client.provider.oAuth2AccessCode.token-uri\", \"${tokenUrl}\" );",
"oAuth2AccessCode.put(\"spring.security.oauth2.client.provider.oAuth2AccessCode.authorization-uri\", \"${authorizationUrl}\" );",
"oAuth2Application.put(\"spring.security.oauth2.client.registration.oAuth2Application.client-id\", \"set-oAuth2Application-client-id\" );",
"oAuth2Application.put(\"spring.security.oauth2.client.registration.oAuth2Application.authorization-grant-type\", \"client_credentials\" );",
"oAuth2Application.put(\"spring.security.oauth2.client.provider.oAuth2Application.token-uri\", \"/openid-connect/token\" );"
);
assertFileNotContains(filePath,"spring.security.oauth2.client.registration.oAuth2Application.scope");
} }
@Test @Test
@@ -2706,6 +2719,26 @@ public class SpringCodegenTest {
.assertMethod("typeConverter"); .assertMethod("typeConverter");
} }
@Test
public void contractWithResolvedInnerEnumContainsEnumConverter() throws IOException {
File output = Files.createTempDirectory("test").toFile();
output.deleteOnExit();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("spring")
.setInputSpec("src/test/resources/3_0/inner_enum.yaml")
.addInlineSchemaOption("RESOLVE_INLINE_ENUMS", "true")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
Map<String, File> files = generator.opts(clientOptInput).generate().stream()
.collect(Collectors.toMap(File::getName, Function.identity()));
JavaFileAssert.assertThat(files.get("EnumConverterConfiguration.java"))
.assertMethod("ponyTypeConverter");
}
@Test @Test
public void shouldUseTheSameTagNameForTheInterfaceAndTheMethod_issue11570() throws IOException { public void shouldUseTheSameTagNameForTheInterfaceAndTheMethod_issue11570() throws IOException {
final Map<String, File> output = generateFromContract("src/test/resources/bugs/issue_11570.yml", SPRING_BOOT); final Map<String, File> output = generateFromContract("src/test/resources/bugs/issue_11570.yml", SPRING_BOOT);

View File

@@ -295,6 +295,25 @@ public class ModelUtilsTest {
Assert.assertEquals(decoded, "~1 Hallo/Welt"); Assert.assertEquals(decoded, "~1 Hallo/Welt");
} }
@Test
public void testRefToSchemaProperties() {
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/petstore.yaml");
Schema category = ModelUtils.getSchemaFromRefToSchemaWithProperties(openAPI, "#/components/schemas/Pet/properties/category");
Assert.assertEquals(category.get$ref(), "#/components/schemas/Category");
Schema name = ModelUtils.getSchemaFromRefToSchemaWithProperties(openAPI, "#/components/schemas/Pet/properties/name");
Assert.assertEquals(name.getType(), "string");
Schema id = ModelUtils.getSchemaFromRefToSchemaWithProperties(openAPI, "#/components/schemas/Pet/properties/id");
Assert.assertEquals(id.getType(), "integer");
Assert.assertEquals(id.getFormat(), "int64");
Assert.assertEquals(null, ModelUtils.getSchemaFromRefToSchemaWithProperties(openAPI, "#/components/schemas/Pet/prop/category"));
Assert.assertEquals(null, ModelUtils.getSchemaFromRefToSchemaWithProperties(openAPI, "#/components/schemas/Pet/properties/categoryyyy"));
Assert.assertEquals(null, ModelUtils.getSchemaFromRefToSchemaWithProperties(openAPI, "#/components/schemas/Pet"));
}
// 3.0 spec tests // 3.0 spec tests
@Test @Test

View File

@@ -0,0 +1,30 @@
openapi: 3.0.0
info:
title: Sample API
description: API description in Markdown.
version: 1.0.0
paths:
/ponies:
get:
summary: Returns all animals.
description: Optional extended description in Markdown.
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pony'
components:
schemas:
Pony:
type: object
properties:
type:
type: string
enum:
- Earth
- Pegasi
- Unicorn

View File

@@ -1,29 +0,0 @@
openapi: "3.0.3"
info:
title: Test for OAuth2 provider
version: 1.0.0
security:
- OAuth2:
- openid
- profile
paths:
/some/endpoint:
get:
responses:
"200":
description: OK
components:
securitySchemes:
OAuth2:
type: oauth2
x-tokenName: id_token
flows:
authorizationCode:
authorizationUrl: "${authorizationUrl}"
tokenUrl: "${tokenUrl}"
scopes:
openid: Access OpenId Connect info
profile: Profile info

View File

@@ -2655,3 +2655,23 @@ components:
PetComposition: PetComposition:
allOf: allOf:
- $ref: '#/components/schemas/Pet' - $ref: '#/components/schemas/Pet'
PetRef:
type: object
required:
- name
- photoUrls
properties:
id:
$ref: '#/components/schemas/Pet/properties/id'
category:
$ref: '#/components/schemas/Pet/properties/category'
name:
$ref: '#/components/schemas/Pet/properties/name'
photoUrls:
$ref: '#/components/schemas/Pet/properties/photoUrls'
tags:
$ref: '#/components/schemas/Pet/properties/tags'
status:
$ref: '#/components/schemas/Pet/properties/status'
xml:
name: Pet

View File

@@ -0,0 +1,29 @@
openapi: 3.0.1
info:
version: 1.0.0
title: Example - oneOf data type
license:
name: MIT
servers:
- url: http://api.example.xyz/v1
paths:
/example:
get:
operationId: list
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Example"
components:
schemas:
Example:
oneOf:
- type: array
items:
type: number
- type: array
items:
type: integer

View File

@@ -0,0 +1,28 @@
openapi: 3.0.1
info:
version: 1.0.0
title: Example - oneOf data type
license:
name: MIT
servers:
- url: http://api.example.xyz/v1
paths:
/example:
get:
operationId: list
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Example"
components:
schemas:
Example:
oneOf:
- type: string
format: uuid
- type: array
items:
type: integer

View File

@@ -0,0 +1,44 @@
openapi: 3.0.1
info:
version: 1.0.0
title: Example
license:
name: MIT
servers:
- url: http://api.example.xyz/v1
paths:
/person/display/{personId}:
get:
tags:
- person
- basic
parameters:
- name: personId
in: path
required: true
description: The id of the person to retrieve
schema:
type: string
operationId: list
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Person"
components:
schemas:
Person:
description: person
type: object
properties:
lastName:
type: string
first_integer:
type: integer
first_number:
type: number
first_boolean:
type: boolean

View File

@@ -88,4 +88,22 @@ components:
- type: string - type: string
- type: array - type: array
items: items:
type: string type: string
AnyOfAnyType:
anyOf:
- type: boolean
- type: array
items: {}
- type: object
- type: string
- type: number
- type: integer
OneOfAnyType:
oneOf:
- type: object
- type: boolean
- type: number
- type: string
- type: integer
- type: array
items: {}

View File

@@ -0,0 +1,37 @@
openapi: "3.0.3"
info:
description: 'This spec is mainly for testing Petstore server and contains fake
endpoints, models. Please do not use this for any other purpose. Special
characters: " \'
version: 1.0.0
title: OpenAPI Petstore Auth
license:
name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
security:
- OAuth2: [openid, profile, aud]
paths:
/some/endpoint:
get:
responses:
"200":
description: OK
components:
securitySchemes:
OAuth2:
type: oauth2
x-tokenName: id_token
flows:
authorizationCode:
authorizationUrl: "${authorizationUrl}"
tokenUrl: "${tokenUrl}"
scopes:
openid: Access OpenId Connect info
profile: Profile info
aud: Audience info
clientCredentials:
tokenUrl: '/openid-connect/token'
scopes: { }

View File

@@ -9,9 +9,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.6.1" /> <PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.5.7" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -240,8 +240,8 @@
<version>${jackson-databind-version}</version> <version>${jackson-databind-version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId> <groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId> <artifactId>jackson-jakarta-rs-json-provider</artifactId>
<version>${jackson-version}</version> <version>${jackson-version}</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -274,7 +274,7 @@
<jackson-version>2.15.2</jackson-version> <jackson-version>2.15.2</jackson-version>
<jackson-databind-version>2.15.2</jackson-databind-version> <jackson-databind-version>2.15.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version> <jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version> <jakarta-annotation-version>2.1.1</jakarta-annotation-version>
<junit-version>4.13.2</junit-version> <junit-version>4.13.2</junit-version>
</properties> </properties>
</project> </project>

View File

@@ -81,7 +81,7 @@ import org.openapitools.client.auth.Authentication;
import org.openapitools.client.auth.HttpBasicAuth; import org.openapitools.client.auth.HttpBasicAuth;
import org.openapitools.client.auth.HttpBearerAuth; import org.openapitools.client.auth.HttpBearerAuth;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class ApiClient extends JavaTimeFormatter { public class ApiClient extends JavaTimeFormatter {
private Map<String, String> defaultHeaderMap = new HashMap<String, String>(); private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private Map<String, String> defaultCookieMap = new HashMap<String, String>(); private Map<String, String> defaultCookieMap = new HashMap<String, String>();

View File

@@ -16,7 +16,7 @@ package org.openapitools.client;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class ApiException extends Exception { public class ApiException extends Exception {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -17,7 +17,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public abstract class BaseApi { public abstract class BaseApi {
protected ApiClient apiClient; protected ApiClient apiClient;

View File

@@ -13,7 +13,7 @@
package org.openapitools.client; package org.openapitools.client;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class Configuration { public class Configuration {
public static final String VERSION = "0.1.0"; public static final String VERSION = "0.1.0";

View File

@@ -20,7 +20,7 @@ import java.time.format.DateTimeParseException;
* Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class. * Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class.
* It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}. * It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}.
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class JavaTimeFormatter { public class JavaTimeFormatter {
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;

View File

@@ -13,7 +13,7 @@
package org.openapitools.client; package org.openapitools.client;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class Pair { public class Pair {
private String name = ""; private String name = "";
private String value = ""; private String value = "";

View File

@@ -16,7 +16,7 @@ package org.openapitools.client;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class StringUtil { public class StringUtil {
/** /**
* Check if the given array contains the given value (with case-insensitive comparison). * Check if the given array contains the given value (with case-insensitive comparison).

View File

@@ -29,7 +29,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringJoiner; import java.util.StringJoiner;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class AuthApi extends BaseApi { public class AuthApi extends BaseApi {
public AuthApi() { public AuthApi() {

View File

@@ -33,7 +33,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringJoiner; import java.util.StringJoiner;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class BodyApi extends BaseApi { public class BodyApi extends BaseApi {
public BodyApi() { public BodyApi() {

View File

@@ -30,7 +30,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringJoiner; import java.util.StringJoiner;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class FormApi extends BaseApi { public class FormApi extends BaseApi {
public FormApi() { public FormApi() {

View File

@@ -30,7 +30,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringJoiner; import java.util.StringJoiner;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class HeaderApi extends BaseApi { public class HeaderApi extends BaseApi {
public HeaderApi() { public HeaderApi() {

View File

@@ -30,7 +30,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringJoiner; import java.util.StringJoiner;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class PathApi extends BaseApi { public class PathApi extends BaseApi {
public PathApi() { public PathApi() {

View File

@@ -36,7 +36,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringJoiner; import java.util.StringJoiner;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class QueryApi extends BaseApi { public class QueryApi extends BaseApi {
public QueryApi() { public QueryApi() {

View File

@@ -18,7 +18,7 @@ import org.openapitools.client.Pair;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class ApiKeyAuth implements Authentication { public class ApiKeyAuth implements Authentication {
private final String location; private final String location;
private final String paramName; private final String paramName;

View File

@@ -21,7 +21,7 @@ import java.nio.charset.StandardCharsets;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class HttpBasicAuth implements Authentication { public class HttpBasicAuth implements Authentication {
private String username; private String username;
private String password; private String password;

View File

@@ -20,7 +20,7 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.function.Supplier; import java.util.function.Supplier;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class HttpBearerAuth implements Authentication { public class HttpBearerAuth implements Authentication {
private final String scheme; private final String scheme;
private Supplier<String> tokenSupplier; private Supplier<String> tokenSupplier;

View File

@@ -33,7 +33,7 @@ import java.util.StringJoiner;
Bird.JSON_PROPERTY_SIZE, Bird.JSON_PROPERTY_SIZE,
Bird.JSON_PROPERTY_COLOR Bird.JSON_PROPERTY_COLOR
}) })
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class Bird { public class Bird {
public static final String JSON_PROPERTY_SIZE = "size"; public static final String JSON_PROPERTY_SIZE = "size";
private String size; private String size;
@@ -54,7 +54,7 @@ public class Bird {
* Get size * Get size
* @return size * @return size
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SIZE) @JsonProperty(JSON_PROPERTY_SIZE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -80,7 +80,7 @@ public class Bird {
* Get color * Get color
* @return color * @return color
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_COLOR) @JsonProperty(JSON_PROPERTY_COLOR)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

View File

@@ -33,7 +33,7 @@ import java.util.StringJoiner;
Category.JSON_PROPERTY_ID, Category.JSON_PROPERTY_ID,
Category.JSON_PROPERTY_NAME Category.JSON_PROPERTY_NAME
}) })
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class Category { public class Category {
public static final String JSON_PROPERTY_ID = "id"; public static final String JSON_PROPERTY_ID = "id";
private Long id; private Long id;
@@ -54,7 +54,7 @@ public class Category {
* Get id * Get id
* @return id * @return id
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ID) @JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -80,7 +80,7 @@ public class Category {
* Get name * Get name
* @return name * @return name
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_NAME) @JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

View File

@@ -39,7 +39,7 @@ import java.util.StringJoiner;
DataQuery.JSON_PROPERTY_TEXT, DataQuery.JSON_PROPERTY_TEXT,
DataQuery.JSON_PROPERTY_DATE DataQuery.JSON_PROPERTY_DATE
}) })
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class DataQuery extends Query { public class DataQuery extends Query {
public static final String JSON_PROPERTY_SUFFIX = "suffix"; public static final String JSON_PROPERTY_SUFFIX = "suffix";
private String suffix; private String suffix;
@@ -64,7 +64,7 @@ public class DataQuery extends Query {
* test suffix * test suffix
* @return suffix * @return suffix
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SUFFIX) @JsonProperty(JSON_PROPERTY_SUFFIX)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -90,7 +90,7 @@ public class DataQuery extends Query {
* Some text containing white spaces * Some text containing white spaces
* @return text * @return text
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_TEXT) @JsonProperty(JSON_PROPERTY_TEXT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -116,7 +116,7 @@ public class DataQuery extends Query {
* A date * A date
* @return date * @return date
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_DATE) @JsonProperty(JSON_PROPERTY_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

View File

@@ -47,7 +47,7 @@ import java.util.StringJoiner;
DefaultValue.JSON_PROPERTY_ARRAY_STRING_EXTENSION_NULLABLE, DefaultValue.JSON_PROPERTY_ARRAY_STRING_EXTENSION_NULLABLE,
DefaultValue.JSON_PROPERTY_STRING_NULLABLE DefaultValue.JSON_PROPERTY_STRING_NULLABLE
}) })
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class DefaultValue { public class DefaultValue {
public static final String JSON_PROPERTY_ARRAY_STRING_ENUM_REF_DEFAULT = "array_string_enum_ref_default"; public static final String JSON_PROPERTY_ARRAY_STRING_ENUM_REF_DEFAULT = "array_string_enum_ref_default";
private List<StringEnumRef> arrayStringEnumRefDefault = new ArrayList<>(Arrays.asList(StringEnumRef.SUCCESS, StringEnumRef.FAILURE)); private List<StringEnumRef> arrayStringEnumRefDefault = new ArrayList<>(Arrays.asList(StringEnumRef.SUCCESS, StringEnumRef.FAILURE));
@@ -131,7 +131,7 @@ public class DefaultValue {
* Get arrayStringEnumRefDefault * Get arrayStringEnumRefDefault
* @return arrayStringEnumRefDefault * @return arrayStringEnumRefDefault
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_ENUM_REF_DEFAULT) @JsonProperty(JSON_PROPERTY_ARRAY_STRING_ENUM_REF_DEFAULT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -165,7 +165,7 @@ public class DefaultValue {
* Get arrayStringEnumDefault * Get arrayStringEnumDefault
* @return arrayStringEnumDefault * @return arrayStringEnumDefault
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_ENUM_DEFAULT) @JsonProperty(JSON_PROPERTY_ARRAY_STRING_ENUM_DEFAULT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -199,7 +199,7 @@ public class DefaultValue {
* Get arrayStringDefault * Get arrayStringDefault
* @return arrayStringDefault * @return arrayStringDefault
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_DEFAULT) @JsonProperty(JSON_PROPERTY_ARRAY_STRING_DEFAULT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -233,7 +233,7 @@ public class DefaultValue {
* Get arrayIntegerDefault * Get arrayIntegerDefault
* @return arrayIntegerDefault * @return arrayIntegerDefault
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ARRAY_INTEGER_DEFAULT) @JsonProperty(JSON_PROPERTY_ARRAY_INTEGER_DEFAULT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -267,7 +267,7 @@ public class DefaultValue {
* Get arrayString * Get arrayString
* @return arrayString * @return arrayString
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ARRAY_STRING) @JsonProperty(JSON_PROPERTY_ARRAY_STRING)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -305,7 +305,7 @@ public class DefaultValue {
* Get arrayStringNullable * Get arrayStringNullable
* @return arrayStringNullable * @return arrayStringNullable
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonIgnore @JsonIgnore
public List<String> getArrayStringNullable() { public List<String> getArrayStringNullable() {
@@ -351,7 +351,7 @@ public class DefaultValue {
* Get arrayStringExtensionNullable * Get arrayStringExtensionNullable
* @return arrayStringExtensionNullable * @return arrayStringExtensionNullable
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonIgnore @JsonIgnore
public List<String> getArrayStringExtensionNullable() { public List<String> getArrayStringExtensionNullable() {
@@ -385,7 +385,7 @@ public class DefaultValue {
* Get stringNullable * Get stringNullable
* @return stringNullable * @return stringNullable
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonIgnore @JsonIgnore
public String getStringNullable() { public String getStringNullable() {

View File

@@ -35,7 +35,7 @@ import java.util.StringJoiner;
NumberPropertiesOnly.JSON_PROPERTY_FLOAT, NumberPropertiesOnly.JSON_PROPERTY_FLOAT,
NumberPropertiesOnly.JSON_PROPERTY_DOUBLE NumberPropertiesOnly.JSON_PROPERTY_DOUBLE
}) })
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class NumberPropertiesOnly { public class NumberPropertiesOnly {
public static final String JSON_PROPERTY_NUMBER = "number"; public static final String JSON_PROPERTY_NUMBER = "number";
private BigDecimal number; private BigDecimal number;
@@ -59,7 +59,7 @@ public class NumberPropertiesOnly {
* Get number * Get number
* @return number * @return number
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_NUMBER) @JsonProperty(JSON_PROPERTY_NUMBER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -85,7 +85,7 @@ public class NumberPropertiesOnly {
* Get _float * Get _float
* @return _float * @return _float
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_FLOAT) @JsonProperty(JSON_PROPERTY_FLOAT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -113,7 +113,7 @@ public class NumberPropertiesOnly {
* maximum: 50.2 * maximum: 50.2
* @return _double * @return _double
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_DOUBLE) @JsonProperty(JSON_PROPERTY_DOUBLE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

View File

@@ -42,7 +42,7 @@ import java.util.StringJoiner;
Pet.JSON_PROPERTY_TAGS, Pet.JSON_PROPERTY_TAGS,
Pet.JSON_PROPERTY_STATUS Pet.JSON_PROPERTY_STATUS
}) })
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class Pet { public class Pet {
public static final String JSON_PROPERTY_ID = "id"; public static final String JSON_PROPERTY_ID = "id";
private Long id; private Long id;
@@ -112,7 +112,7 @@ public class Pet {
* Get id * Get id
* @return id * @return id
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ID) @JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -138,7 +138,7 @@ public class Pet {
* Get name * Get name
* @return name * @return name
**/ **/
@javax.annotation.Nonnull @jakarta.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_NAME) @JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS) @JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -164,7 +164,7 @@ public class Pet {
* Get category * Get category
* @return category * @return category
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_CATEGORY) @JsonProperty(JSON_PROPERTY_CATEGORY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -198,7 +198,7 @@ public class Pet {
* Get photoUrls * Get photoUrls
* @return photoUrls * @return photoUrls
**/ **/
@javax.annotation.Nonnull @jakarta.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonProperty(JSON_PROPERTY_PHOTO_URLS)
@JsonInclude(value = JsonInclude.Include.ALWAYS) @JsonInclude(value = JsonInclude.Include.ALWAYS)
@@ -232,7 +232,7 @@ public class Pet {
* Get tags * Get tags
* @return tags * @return tags
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_TAGS) @JsonProperty(JSON_PROPERTY_TAGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -258,7 +258,7 @@ public class Pet {
* pet status in the store * pet status in the store
* @return status * @return status
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_STATUS) @JsonProperty(JSON_PROPERTY_STATUS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

View File

@@ -36,7 +36,7 @@ import java.util.StringJoiner;
Query.JSON_PROPERTY_ID, Query.JSON_PROPERTY_ID,
Query.JSON_PROPERTY_OUTCOMES Query.JSON_PROPERTY_OUTCOMES
}) })
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT")
public class Query { public class Query {
public static final String JSON_PROPERTY_ID = "id"; public static final String JSON_PROPERTY_ID = "id";
private Long id; private Long id;
@@ -94,7 +94,7 @@ public class Query {
* Query * Query
* @return id * @return id
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ID) @JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@@ -128,7 +128,7 @@ public class Query {
* Get outcomes * Get outcomes
* @return outcomes * @return outcomes
**/ **/
@javax.annotation.Nullable @jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_OUTCOMES) @JsonProperty(JSON_PROPERTY_OUTCOMES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

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