mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-06 19:06:10 +00:00
Compare commits
22 Commits
devhl-labs
...
fix-bean-v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56eb5a63bf | ||
|
|
2934f5ac51 | ||
|
|
2ce71512d0 | ||
|
|
927768757b | ||
|
|
858499ffdd | ||
|
|
4719d9e55f | ||
|
|
2d7f0496ec | ||
|
|
2fac8e34db | ||
|
|
1704ae1194 | ||
|
|
370eca2889 | ||
|
|
d0f8468651 | ||
|
|
6252dac28e | ||
|
|
807aa5d3ae | ||
|
|
f73db59b0e | ||
|
|
34ebc1c644 | ||
|
|
de680de60e | ||
|
|
e78aeb6bc7 | ||
|
|
309918d03e | ||
|
|
6690b9f87d | ||
|
|
ee69a7983a | ||
|
|
204407daf0 | ||
|
|
d1860b95cf |
10
.github/workflows/samples-dotnet-standard.yaml
vendored
10
.github/workflows/samples-dotnet-standard.yaml
vendored
@@ -21,11 +21,11 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
- samples/client/petstore/csharp/generichost/standard2.0/OpenAPIClient-generichost-netstandard2.0/
|
||||
- samples/client/petstore/csharp/httpclient/standard2.0/OpenAPIClient-httpclient/
|
||||
- samples/client/petstore/csharp/restsharp/standard2.0/OpenAPIClient/
|
||||
- samples/client/petstore/csharp/restsharp/standard2.0/OpenAPIClient-ConditionalSerialization/
|
||||
- samples/client/petstore/csharp/unityWebRequest/standard2.0/OpenAPIClient-unityWebRequest/
|
||||
- samples/client/petstore/csharp/generichost/standard2.0/Petstore/
|
||||
- samples/client/petstore/csharp/httpclient/standard2.0/Petstore/
|
||||
- samples/client/petstore/csharp/restsharp/standard2.0/Petstore/
|
||||
- samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/
|
||||
# - samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v4.0.0
|
||||
|
||||
18
.github/workflows/samples-dotnet.yaml
vendored
18
.github/workflows/samples-dotnet.yaml
vendored
@@ -21,14 +21,16 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
- samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-manual-tests
|
||||
- samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-net6.0
|
||||
- samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-net6.0-nrt
|
||||
- samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration
|
||||
- samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-net7.0-useDateTimeForDate
|
||||
- samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-netcore-latest-allOf
|
||||
- samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-netcore-latest-anyOf
|
||||
- samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-netcore-latest-oneOf
|
||||
- samples/client/petstore/csharp/generichost/net8/AllOf
|
||||
- samples/client/petstore/csharp/generichost/net8/AnyOf
|
||||
- samples/client/petstore/csharp/generichost/net8/FormModels
|
||||
- samples/client/petstore/csharp/generichost/net8/ManualPetstoreTests
|
||||
- samples/client/petstore/csharp/generichost/net8/ManualSourceGenerationTests
|
||||
- samples/client/petstore/csharp/generichost/net8/NullReferenceTypes
|
||||
- samples/client/petstore/csharp/generichost/net8/OneOf
|
||||
- samples/client/petstore/csharp/generichost/net8/Petstore
|
||||
- samples/client/petstore/csharp/generichost/net8/SourceGeneration
|
||||
- samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v4.0.0
|
||||
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
- samples/client/petstore/csharp/restsharp/net6/OpenAPIClient-restsharp-name-parameter-mappings/
|
||||
- samples/client/petstore/csharp/restsharp/net6/ParameterMappings/
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v4.0.0
|
||||
|
||||
@@ -13,6 +13,8 @@ on:
|
||||
- samples/client/others/java/okhttp-gson-oneOf/**
|
||||
- samples/client/others/java/resttemplate-useAbstractionForFiles/**
|
||||
- samples/client/others/java/webclient-useAbstractionForFiles/**
|
||||
- samples/client/others/java/jersey2-oneOf-duplicates/**
|
||||
- samples/client/others/java/jersey2-oneOf-Mixed/**
|
||||
pull_request:
|
||||
paths:
|
||||
- 'samples/client/petstore/java/**'
|
||||
@@ -25,6 +27,8 @@ on:
|
||||
- samples/client/others/java/okhttp-gson-oneOf/**
|
||||
- samples/client/others/java/resttemplate-useAbstractionForFiles/**
|
||||
- samples/client/others/java/webclient-useAbstractionForFiles/**
|
||||
- samples/client/others/java/jersey2-oneOf-duplicates/**
|
||||
- samples/client/others/java/jersey2-oneOf-Mixed/**
|
||||
jobs:
|
||||
build:
|
||||
name: Build Java Client JDK11
|
||||
@@ -71,6 +75,8 @@ jobs:
|
||||
- samples/client/others/java/okhttp-gson-oneOf/
|
||||
- samples/client/others/java/resttemplate-useAbstractionForFiles/
|
||||
- samples/client/others/java/webclient-useAbstractionForFiles/
|
||||
- samples/client/others/java/jersey2-oneOf-duplicates/
|
||||
- samples/client/others/java/jersey2-oneOf-Mixed/
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v4
|
||||
|
||||
2
.github/workflows/samples-julia.yaml
vendored
2
.github/workflows/samples-julia.yaml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: julia-actions/setup-julia@v1
|
||||
- uses: julia-actions/setup-julia@v2
|
||||
with:
|
||||
version: 1.8
|
||||
arch: x64
|
||||
|
||||
1
.github/workflows/samples-spring.yaml
vendored
1
.github/workflows/samples-spring.yaml
vendored
@@ -34,6 +34,7 @@ jobs:
|
||||
- samples/openapi3/client/petstore/spring-cloud-async
|
||||
- samples/openapi3/client/petstore/spring-cloud-spring-pageable
|
||||
- samples/client/petstore/spring-cloud-tags
|
||||
- samples/client/petstore/spring-cloud-auth
|
||||
- samples/client/petstore/spring-cloud-deprecated
|
||||
# servers
|
||||
- samples/server/petstore/springboot
|
||||
|
||||
@@ -13,7 +13,7 @@ if [ "$NODE_INDEX" = "1" ]; then
|
||||
echo "Running node $NODE_INDEX ..."
|
||||
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/ruby && mvn integration-test)
|
||||
@@ -112,5 +112,3 @@ else
|
||||
(cd samples/client/petstore/java/apache-httpclient && mvn integration-test)
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -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/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/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
|
||||
|
||||
40
appveyor.yml
40
appveyor.yml
@@ -43,23 +43,29 @@ build_script:
|
||||
#- dotnet build samples\client\petstore\csharp\OpenAPIClient-ConditionalSerialization\Org.OpenAPITools.sln
|
||||
|
||||
test_script:
|
||||
# test c# API client (multiple frameworks)
|
||||
- dotnet test samples\client\petstore\csharp\restsharp\net4.7\OpenAPIClientCoreAndNet47\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# test c# API client (httpclient)
|
||||
- dotnet test samples\client\petstore\csharp\httpclient\standard2.0\OpenAPIClient-httpclient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# test c# API client (generichost)
|
||||
- dotnet test samples\client\petstore\csharp\generichost\standard2.0\OpenAPIClient-generichost-netstandard2.0\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# test c# API client (netcore)
|
||||
- dotnet test samples\client\petstore\csharp\restsharp\net7\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
#- dotnet test samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# test C# API client (.net framework 4.7)
|
||||
- dotnet test samples\client\petstore\csharp\restsharp\net4.7\OpenAPIClient-net47\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# test C# API client (.net framework 4.8)
|
||||
- dotnet test samples\client\petstore\csharp\restsharp\net4.8\OpenAPIClient-net48\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# test C# API client (.net 5.0)
|
||||
- dotnet test samples\client\petstore\csharp\restsharp\net7\OpenAPIClient-net5.0\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# test C# API Client using conditional-serialization
|
||||
- dotnet test samples\client\petstore\csharp\restsharp\standard2.0\OpenAPIClient-ConditionalSerialization\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp\generichost\net8\AllOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp\generichost\net8\AnyOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp\generichost\net8\FormModels\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp\generichost\net8\ManualSourceGenerationTests\ManualTests.Latest.UseSourceGeneration\ManualTests.Latest.UseSourceGeneration.csproj
|
||||
- dotnet test samples\client\petstore\csharp\generichost\net8\ManualPetstoreTests\OpenAPIClient-generichost-manual-tests\OpenAPIClient-generichost-manual-tests.csproj
|
||||
- dotnet test samples\client\petstore\csharp\generichost\net8\NullReferenceTypes\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp\generichost\net8\OneOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp\generichost\net8\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp\generichost\net8\SourceGeneration\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp\generichost\net8\UseDateTimeForDate\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp\generichost\standard2.0\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
|
||||
- dotnet test samples\client\petstore\csharp\httpclient\standard2.0\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
|
||||
- dotnet test samples\client\petstore\csharp\restsharp\net4.7\MultipleFrameworks\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp\restsharp\net4.7\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp\restsharp\net4.8\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp\restsharp\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
|
||||
# generate all petstore clients
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for csharp generichost
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-netcore-latest-allOf
|
||||
outputDir: samples/client/petstore/csharp/generichost/net8/AllOf
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/allOf.yaml
|
||||
library: generichost
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for csharp generichost
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-netcore-latest-anyOf
|
||||
outputDir: samples/client/petstore/csharp/generichost/net8/AnyOf
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/anyOf.yaml
|
||||
library: generichost
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
|
||||
16
bin/configs/csharp-generichost-net8-formModels.yaml
Normal file
16
bin/configs/csharp-generichost-net8-formModels.yaml
Normal 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
|
||||
@@ -1,6 +1,6 @@
|
||||
# for csharp generichost
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/generichost/net8/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
|
||||
library: generichost
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
@@ -9,6 +9,5 @@ additionalProperties:
|
||||
useCompareNetObjects: true
|
||||
disallowAdditionalPropertiesIfNotPresent: false
|
||||
useSourceGeneration: true
|
||||
packageName: UseSourceGeneration
|
||||
equatable: true
|
||||
targetFramework: net8.0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for csharp generichost
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/generichost/net8/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
|
||||
library: generichost
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for csharp generichost
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-netcore-latest-oneOf
|
||||
outputDir: samples/client/petstore/csharp/generichost/net8/OneOf
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf.yaml
|
||||
library: generichost
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for csharp generichost
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/generichost/net8/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
|
||||
library: generichost
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for csharp generichost
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/generichost/net8/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
|
||||
library: generichost
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
@@ -1,6 +1,6 @@
|
||||
# for csharp generichost
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/generichost/standard2.0/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
|
||||
library: generichost
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for .net standard httpclient
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/httpclient/standard2.0/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
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
library: httpclient
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/restsharp/net4.7/OpenAPIClientCoreAndNet47
|
||||
outputDir: samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
additionalProperties:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for .net standard
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/restsharp/net4.7/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
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
additionalProperties:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for .net standard
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/restsharp/net4.8/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
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
additionalProperties:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/restsharp/net6/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
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
nameMappings:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/restsharp/net7/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
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
additionalProperties:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for .net standard
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/restsharp/net7/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
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
additionalProperties:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for .net standard
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/restsharp/net7/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
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
additionalProperties:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for .net standard
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/restsharp/standard2.0/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
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
additionalProperties:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for .net standard
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/restsharp/standard2.0/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
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
additionalProperties:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# for .net Unity
|
||||
generatorName: csharp
|
||||
outputDir: samples/client/petstore/csharp/unityWebRequest/standard2.0/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
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp
|
||||
library: unityWebRequest
|
||||
|
||||
7
bin/configs/java-jersey2-8-oneOfDuplicateList.yaml
Normal file
7
bin/configs/java-jersey2-8-oneOfDuplicateList.yaml
Normal 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"
|
||||
7
bin/configs/java-jersey2-8-oneOfMixed.yaml
Normal file
7
bin/configs/java-jersey2-8-oneOfMixed.yaml
Normal 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"
|
||||
@@ -8,3 +8,4 @@ additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
disallowAdditionalPropertiesIfNotPresent: false
|
||||
useSingleRequestParameter: true
|
||||
useBeanValidation: true
|
||||
|
||||
9
bin/configs/spring-cloud-auth.yaml
Normal file
9
bin/configs/spring-cloud-auth.yaml
Normal 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"
|
||||
@@ -1,10 +1,10 @@
|
||||
---
|
||||
# csharp test files and image for upload
|
||||
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/OpenAPIClient/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs"
|
||||
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs"
|
||||
sha256: e323c7e646a0ceb6d1d8f34f287175ac666fdbbe057791b45d138de3d9582666
|
||||
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/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
|
||||
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/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
|
||||
# java okhttp gson test files
|
||||
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/ClientTest.java"
|
||||
|
||||
@@ -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"
|
||||
```
|
||||
|
||||
- `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"
|
||||
```
|
||||
|
||||
@@ -350,6 +350,8 @@ public interface CodegenConfig {
|
||||
*/
|
||||
String generatorLanguageVersion();
|
||||
|
||||
boolean isTypeErasedGenerics();
|
||||
|
||||
List<VendorExtension> getSupportedVendorExtensions();
|
||||
|
||||
boolean getUseInlineModelResolver();
|
||||
|
||||
@@ -1139,6 +1139,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
this.isEnum = isEnum;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("CodegenProperty{");
|
||||
|
||||
@@ -43,6 +43,8 @@ public class CodegenSecurity {
|
||||
// Oauth specific
|
||||
public String flow, authorizationUrl, tokenUrl, refreshUrl;
|
||||
public List<Map<String, Object>> scopes;
|
||||
public Boolean hasScopes;
|
||||
|
||||
public Boolean isCode, isPassword, isApplication, isImplicit;
|
||||
// OpenId specific
|
||||
public String openIdConnectUrl;
|
||||
|
||||
@@ -2464,6 +2464,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected String getSingleSchemaType(Schema 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
|
||||
// get the schema/model name from $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());
|
||||
CodegenProperty thisCp = discriminatorFound(composedSchemaName, (Schema) oneOf, discPropName, visitedSchemas);
|
||||
if (thisCp == null) {
|
||||
LOGGER.warn(
|
||||
once(LOGGER).warn(
|
||||
"'{}' defines discriminator '{}', but the referenced OneOf schema '{}' is missing {}",
|
||||
composedSchemaName, discPropName, modelName, discPropName);
|
||||
}
|
||||
@@ -3363,7 +3371,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
continue;
|
||||
}
|
||||
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",
|
||||
composedSchemaName, discPropName, modelName, discPropName, discPropName);
|
||||
}
|
||||
@@ -3377,7 +3385,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
String modelName = ModelUtils.getSimpleRef(((Schema) anyOf).get$ref());
|
||||
CodegenProperty thisCp = discriminatorFound(composedSchemaName, (Schema) anyOf, discPropName, visitedSchemas);
|
||||
if (thisCp == null) {
|
||||
LOGGER.warn(
|
||||
once(LOGGER).warn(
|
||||
"'{}' defines discriminator '{}', but the referenced AnyOf schema '{}' is missing {}",
|
||||
composedSchemaName, discPropName, modelName, discPropName);
|
||||
}
|
||||
@@ -3386,7 +3394,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
continue;
|
||||
}
|
||||
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",
|
||||
composedSchemaName, discPropName, modelName, discPropName, discPropName);
|
||||
}
|
||||
@@ -3454,7 +3462,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) {
|
||||
@@ -3483,7 +3491,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
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
|
||||
// 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
|
||||
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",
|
||||
composedSchemaName);
|
||||
}
|
||||
@@ -3554,14 +3562,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
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);
|
||||
}
|
||||
MappedModel mm = new MappedModel(modelName, toModelName(modelName));
|
||||
descendentSchemas.add(mm);
|
||||
Schema cs = ModelUtils.getSchema(openAPI, modelName);
|
||||
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 {
|
||||
Map<String, Object> vendorExtensions = cs.getExtensions();
|
||||
if (vendorExtensions != null && !vendorExtensions.isEmpty() && vendorExtensions.containsKey("x-discriminator-value")) {
|
||||
@@ -3674,7 +3682,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (e.getValue().indexOf('/') >= 0) {
|
||||
name = ModelUtils.getSimpleRef(e.getValue());
|
||||
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 {
|
||||
name = e.getValue();
|
||||
@@ -3983,6 +3991,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
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;
|
||||
// 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) {
|
||||
@@ -6780,6 +6795,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
enumVar.put("name", finalEnumName);
|
||||
enumVar.put("value", toEnumValue(String.valueOf(value), dataType));
|
||||
enumVar.put("isString", isDataTypeString(dataType));
|
||||
// TODO: add isNumeric
|
||||
enumVars.add(enumVar);
|
||||
}
|
||||
|
||||
@@ -6802,6 +6818,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
enumVar.put("name", toEnumVarName(enumName, dataType));
|
||||
enumVar.put("value", toEnumValue(enumValue, dataType));
|
||||
enumVar.put("isString", isDataTypeString(dataType));
|
||||
// TODO: add isNumeric
|
||||
enumVars.add(enumVar);
|
||||
}
|
||||
|
||||
@@ -6940,6 +6957,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
scopes.add(scope);
|
||||
}
|
||||
codegenSecurity.scopes = scopes;
|
||||
codegenSecurity.hasScopes = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8421,12 +8439,17 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
xOf.add(cp);
|
||||
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
|
||||
// in other sub-schemas of allOf/anyOf/oneOf
|
||||
cp.vendorExtensions.putIfAbsent("x-duplicated-data-type", true);
|
||||
} else {
|
||||
dataTypeSet.add(cp.dataType);
|
||||
if(isTypeErasedGenerics()) {
|
||||
dataTypeSet.add(cp.baseType);
|
||||
} else {
|
||||
dataTypeSet.add(cp.dataType);
|
||||
}
|
||||
}
|
||||
}
|
||||
return xOf;
|
||||
@@ -8463,11 +8486,16 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return openapiGeneratorIgnoreList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTypeErasedGenerics() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
A function to convert yaml or json ingested strings like property names
|
||||
And convert special characters like newline, tab, carriage return
|
||||
Into strings that can be rendered in the language that the generator will output to
|
||||
*/
|
||||
A function to convert yaml or json ingested strings like property names
|
||||
And convert special characters like newline, tab, carriage return
|
||||
Into strings that can be rendered in the language that the generator will output to
|
||||
*/
|
||||
protected String handleSpecialCharacters(String name) { return name; }
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,6 +38,8 @@ public class OpenAPINormalizer {
|
||||
private Map<String, String> inputRules = new HashMap<>();
|
||||
private Map<String, Boolean> rules = new HashMap<>();
|
||||
|
||||
private TreeSet<String> anyTypeTreeSet = new TreeSet<>();
|
||||
|
||||
final Logger LOGGER = LoggerFactory.getLogger(OpenAPINormalizer.class);
|
||||
|
||||
Set<String> ruleNames = new TreeSet<>();
|
||||
@@ -112,6 +114,14 @@ public class OpenAPINormalizer {
|
||||
boolean updateSetToNullable;
|
||||
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 =============
|
||||
|
||||
/**
|
||||
@@ -143,12 +153,23 @@ public class OpenAPINormalizer {
|
||||
ruleNames.add(NORMALIZE_31SPEC);
|
||||
ruleNames.add(REMOVE_X_INTERNAL);
|
||||
ruleNames.add(FILTER);
|
||||
ruleNames.add(SET_CONTAINER_TO_NULLABLE);
|
||||
ruleNames.add(SET_PRIMITIVE_TYPES_TO_NULLABLE);
|
||||
|
||||
|
||||
// rules that are default to true
|
||||
rules.put(SIMPLIFY_ONEOF_ANYOF, true);
|
||||
rules.put(SIMPLIFY_BOOLEAN_ENUM, true);
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
return processNormalize31Spec(schema, visitedSchemas);
|
||||
Schema result = processNormalize31Spec(schema, visitedSchemas);
|
||||
return processSetPrimitiveTypesToNullable(result);
|
||||
}
|
||||
|
||||
private void normalizeBooleanSchema(Schema schema, Set<Schema> visitedSchemas) {
|
||||
processSimplifyBooleanEnum(schema);
|
||||
processSetPrimitiveTypesToNullable(schema);
|
||||
}
|
||||
|
||||
private void normalizeIntegerSchema(Schema schema, Set<Schema> visitedSchemas) {
|
||||
processAddUnsignedToIntegerWithInvalidMaxValue(schema);
|
||||
processSetPrimitiveTypesToNullable(schema);
|
||||
}
|
||||
|
||||
private void normalizeProperties(Map<String, Schema> properties, Set<Schema> visitedSchemas) {
|
||||
@@ -888,6 +932,27 @@ public class OpenAPINormalizer {
|
||||
|
||||
List<Schema> oneOfSchemas = schema.getOneOf();
|
||||
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))) {
|
||||
schema.setNullable(true);
|
||||
|
||||
@@ -917,25 +982,49 @@ public class OpenAPINormalizer {
|
||||
|
||||
if (Boolean.TRUE.equals(schema.getUniqueItems())) { // a set
|
||||
if (updateSetToNullable) {
|
||||
if (schema.getNullable() != null || (schema.getExtensions() != null && schema.getExtensions().containsKey("x-nullable"))) {
|
||||
// already set, don't overwrite
|
||||
return schema;
|
||||
}
|
||||
schema.setNullable(true);
|
||||
return setNullable(schema);
|
||||
}
|
||||
} else { // array
|
||||
if (updateArrayToNullable) {
|
||||
if (schema.getNullable() != null || (schema.getExtensions() != null && schema.getExtensions().containsKey("x-nullable"))) {
|
||||
// already set, don't overwrite
|
||||
return schema;
|
||||
}
|
||||
schema.setNullable(true);
|
||||
return setNullable(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.
|
||||
*
|
||||
@@ -948,11 +1037,7 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
|
||||
if (updateMapToNullable) {
|
||||
if (schema.getNullable() != null || (schema.getExtensions() != null && schema.getExtensions().containsKey("x-nullable"))) {
|
||||
// already set, don't override
|
||||
return schema;
|
||||
}
|
||||
schema.setNullable(true);
|
||||
return setNullable(schema);
|
||||
}
|
||||
|
||||
return schema;
|
||||
@@ -972,6 +1057,27 @@ public class OpenAPINormalizer {
|
||||
|
||||
List<Schema> anyOfSchemas = schema.getAnyOf();
|
||||
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))) {
|
||||
schema.setNullable(true);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.PathItem;
|
||||
@@ -139,7 +140,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
protected boolean implicitHeaders = false;
|
||||
protected String implicitHeadersRegex = null;
|
||||
protected boolean camelCaseDollarSign = false;
|
||||
protected boolean useJakartaEe = false;
|
||||
protected boolean useJakartaEe = true;
|
||||
protected boolean containerDefaultToNull = false;
|
||||
|
||||
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()));
|
||||
}
|
||||
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
|
||||
@@ -1592,15 +1601,29 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
|
||||
// additional import for different cases
|
||||
addAdditionalImports(codegenModel, codegenModel.oneOf);
|
||||
addAdditionalImports(codegenModel, codegenModel.anyOf);
|
||||
addAdditionalImports(codegenModel, codegenModel.getComposedSchemas());
|
||||
return codegenModel;
|
||||
}
|
||||
|
||||
private void addAdditionalImports(CodegenModel model, Set<String> dataTypeSet) {
|
||||
for (String dataType : dataTypeSet) {
|
||||
if (null != importMapping().get(dataType)) {
|
||||
model.imports.add(dataType);
|
||||
private void addAdditionalImports(CodegenModel model, CodegenComposedSchemas composedSchemas) {
|
||||
if(composedSchemas == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTypeErasedGenerics() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -615,10 +615,6 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
additionalProperties.put(USE_FEIGN_CLIENT, "true");
|
||||
} else if (SPRING_BOOT.equals(library)) {
|
||||
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",
|
||||
("src.main.resources").replace(".", java.io.File.separator), "application.properties"));
|
||||
supportingFiles.add(new SupportingFile("homeController.mustache",
|
||||
@@ -786,6 +782,12 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
@Override
|
||||
public void preprocessOpenAPI(OpenAPI 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
|
||||
* ("/".equals(swagger.getBasePath())) { swagger.setBasePath(""); }
|
||||
|
||||
@@ -929,16 +929,76 @@ public class ModelUtils {
|
||||
* @return schema without '$ref'
|
||||
*/
|
||||
public static Schema getReferencedSchema(OpenAPI openAPI, Schema schema) {
|
||||
if (schema != null && StringUtils.isNotEmpty(schema.get$ref())) {
|
||||
String name = getSimpleRef(schema.get$ref());
|
||||
Schema referencedSchema = getSchema(openAPI, name);
|
||||
if (referencedSchema != null) {
|
||||
return referencedSchema;
|
||||
}
|
||||
if (schema == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
if (name == null) {
|
||||
return null;
|
||||
@@ -1272,7 +1332,9 @@ public class ModelUtils {
|
||||
}
|
||||
Schema ref = allSchemas.get(simpleRef);
|
||||
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;
|
||||
} else if (ref.getEnum() != null && !ref.getEnum().isEmpty()) {
|
||||
// top-level enum class
|
||||
|
||||
@@ -5,9 +5,9 @@ package {{package}};
|
||||
import {{invokerPackage}}.ApiException;
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Assert;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
@@ -19,7 +19,7 @@ import java.util.Map;
|
||||
/**
|
||||
* API tests for {{classname}}
|
||||
*/
|
||||
public class {{classname}}Test {
|
||||
class {{classname}}Test {
|
||||
|
||||
private final {{classname}} api = new {{classname}}();
|
||||
|
||||
@@ -38,7 +38,7 @@ public class {{classname}}Test {
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void {{operationId}}Test() throws ApiException {
|
||||
void {{operationId}}Test() throws ApiException {
|
||||
//{{#allParams}}
|
||||
//{{{dataType}}} {{paramName}} = null;
|
||||
//{{/allParams}}
|
||||
|
||||
@@ -125,7 +125,7 @@ ext {
|
||||
{{/useBeanValidation}}
|
||||
jersey_version = "1.19.4"
|
||||
jodatime_version = "2.9.9"
|
||||
junit_version = "4.13.2"
|
||||
junit_version = "5.10.2"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -149,4 +149,20 @@ dependencies {
|
||||
implementation "jakarta.validation:jakarta.validation-api:$bean_validation_version"
|
||||
{{/useBeanValidation}}
|
||||
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"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,37 +78,74 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
|
||||
int match = 0;
|
||||
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
|
||||
{{#composedSchemas}}
|
||||
{{#oneOf}}
|
||||
// deserialize {{{.}}}
|
||||
// deserialize {{{dataType}}}{{#isNullable}} (nullable){{/isNullable}}
|
||||
try {
|
||||
{{^isArray}}
|
||||
boolean attemptParsing = true;
|
||||
// ensure that we respect type coercion as set on the client ObjectMapper
|
||||
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;
|
||||
if (!attemptParsing) {
|
||||
attemptParsing |= (({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
|
||||
attemptParsing |= (({{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
|
||||
attemptParsing |= ({{{.}}}.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
|
||||
attemptParsing |= ({{{.}}}.class.equals(String.class) && token == JsonToken.VALUE_STRING);
|
||||
{{#isNullable}}
|
||||
attemptParsing |= (token == JsonToken.VALUE_NULL);
|
||||
{{/isNullable}}
|
||||
}
|
||||
{{#isPrimitiveType}}
|
||||
attemptParsing = typeCoercion; //respect type coercion setting
|
||||
if (!attemptParsing) {
|
||||
{{#isString}}
|
||||
attemptParsing |= (token == JsonToken.VALUE_STRING);
|
||||
{{/isString}}
|
||||
{{#isInteger}}
|
||||
attemptParsing |= (token == JsonToken.VALUE_NUMBER_INT);
|
||||
{{/isInteger}}
|
||||
{{#isLong}}
|
||||
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) {
|
||||
deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class);
|
||||
deserialized = tree.traverse(jp.getCodec()).readValueAs({{{dataType}}}.class);
|
||||
// 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 '{{{.}}}'");
|
||||
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) {
|
||||
// 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}}
|
||||
{{/composedSchemas}}
|
||||
if (match == 1) {
|
||||
{{classname}} ret = new {{classname}}();
|
||||
ret.setActualInstance(deserialized);
|
||||
@@ -152,13 +189,17 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties);
|
||||
}
|
||||
{{/additionalPropertiesType}}
|
||||
{{#composedSchemas}}
|
||||
{{#oneOf}}
|
||||
public {{classname}}({{{.}}} o) {
|
||||
{{^vendorExtensions.x-duplicated-data-type}}
|
||||
public {{classname}}({{{baseType}}} o) {
|
||||
super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
|
||||
setActualInstance(o);
|
||||
}
|
||||
{{/vendorExtensions.x-duplicated-data-type}}
|
||||
|
||||
{{/oneOf}}
|
||||
{{/composedSchemas}}
|
||||
static {
|
||||
{{#oneOf}}
|
||||
schemas.put("{{{.}}}", new GenericType<{{{.}}}>() {
|
||||
@@ -198,13 +239,17 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
}
|
||||
|
||||
{{/isNullable}}
|
||||
{{#composedSchemas}}
|
||||
{{#oneOf}}
|
||||
if (JSON.isInstanceOf({{{.}}}.class, instance, new HashSet<>())) {
|
||||
{{^vendorExtensions.x-duplicated-data-type}}
|
||||
if (JSON.isInstanceOf({{{baseType}}}.class, instance, new HashSet<>())) {
|
||||
super.setActualInstance(instance);
|
||||
return;
|
||||
}
|
||||
|
||||
{{/vendorExtensions.x-duplicated-data-type}}
|
||||
{{/oneOf}}
|
||||
{{/composedSchemas}}
|
||||
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();
|
||||
}
|
||||
|
||||
{{#composedSchemas}}
|
||||
{{#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.
|
||||
*
|
||||
* @return The actual instance of `{{{.}}}`
|
||||
* @throws ClassCastException if the instance is not `{{{.}}}`
|
||||
* @return The actual instance of `{{{dataType}}}`
|
||||
* @throws ClassCastException if the instance is not `{{{dataType}}}`
|
||||
*/
|
||||
public {{{.}}} get{{{.}}}() throws ClassCastException {
|
||||
return ({{{.}}})super.getActualInstance();
|
||||
{{^isArray}}
|
||||
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}}
|
||||
{{/composedSchemas}}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import {{invokerPackage}}.JSON;
|
||||
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}}
|
||||
@JsonDeserialize(using={{classname}}.{{classname}}Deserializer.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());
|
||||
|
||||
public static class {{classname}}Serializer extends StdSerializer<{{classname}}> {
|
||||
|
||||
@@ -23,7 +23,7 @@ import {{invokerPackage}}.JSON;
|
||||
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}}
|
||||
@JsonDeserialize(using = {{classname}}.{{classname}}Deserializer.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());
|
||||
|
||||
public static class {{classname}}Serializer extends StdSerializer<{{classname}}> {
|
||||
|
||||
@@ -112,8 +112,8 @@ ext {
|
||||
dependencies {
|
||||
implementation 'io.swagger:swagger-annotations:1.6.8'
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
|
||||
implementation 'com.google.code.gson:gson:2.9.1'
|
||||
implementation 'io.gsonfire:gson-fire:1.9.0'
|
||||
implementation 'javax.ws.rs:jsr311-api:1.1.1'
|
||||
|
||||
@@ -10,8 +10,8 @@ lazy val root = (project in file(".")).
|
||||
resolvers += Resolver.mavenLocal,
|
||||
libraryDependencies ++= Seq(
|
||||
"io.swagger" % "swagger-annotations" % "1.6.5",
|
||||
"com.squareup.okhttp3" % "okhttp" % "4.10.0",
|
||||
"com.squareup.okhttp3" % "logging-interceptor" % "4.10.0",
|
||||
"com.squareup.okhttp3" % "okhttp" % "4.12.0",
|
||||
"com.squareup.okhttp3" % "logging-interceptor" % "4.12.0",
|
||||
"com.google.code.gson" % "gson" % "2.9.1",
|
||||
"org.apache.commons" % "commons-lang3" % "3.12.0",
|
||||
"javax.ws.rs" % "jsr311-api" % "1.1.1",
|
||||
|
||||
@@ -4,8 +4,9 @@ package {{package}};
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
@@ -17,8 +18,8 @@ import java.util.Map;
|
||||
/**
|
||||
* API tests for {{classname}}
|
||||
*/
|
||||
@Ignore
|
||||
public class {{classname}}Test {
|
||||
@Disabled
|
||||
class {{classname}}Test {
|
||||
|
||||
private final {{classname}} api = new {{classname}}();
|
||||
|
||||
@@ -28,11 +29,11 @@ public class {{classname}}Test {
|
||||
*
|
||||
* {{notes}}
|
||||
*
|
||||
* @throws ApiException
|
||||
* @throws RestClientException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void {{operationId}}Test() {
|
||||
void {{operationId}}Test() {
|
||||
{{#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;
|
||||
{{/allParams}}
|
||||
|
||||
@@ -121,15 +121,15 @@ ext {
|
||||
jackson_databind_nullable_version = "0.2.6"
|
||||
{{/openApiNullable}}
|
||||
{{#useJakartaEe}}
|
||||
spring_web_version = "6.0.17"
|
||||
spring_web_version = "6.1.5"
|
||||
jakarta_annotation_version = "2.1.1"
|
||||
{{/useJakartaEe}}
|
||||
{{^useJakartaEe}}
|
||||
spring_web_version = "5.3.32"
|
||||
spring_web_version = "5.3.33"
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
{{/useJakartaEe}}
|
||||
jodatime_version = "2.9.9"
|
||||
junit_version = "4.13.2"
|
||||
junit_version = "5.10.2"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -158,5 +158,20 @@ dependencies {
|
||||
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
|
||||
{{/withXml}}
|
||||
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"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -76,6 +76,14 @@
|
||||
<forkMode>pertest</forkMode>
|
||||
<useUnlimitedThreads>true</useUnlimitedThreads>
|
||||
</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>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
@@ -339,11 +347,17 @@
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
<artifactId>junit-platform-runner</artifactId>
|
||||
<version>${junit-platform-runner.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -354,10 +368,10 @@
|
||||
<swagger-annotations-version>2.2.15</swagger-annotations-version>
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
{{#useJakartaEe}}
|
||||
<spring-web-version>6.0.17</spring-web-version>
|
||||
<spring-web-version>6.1.5</spring-web-version>
|
||||
{{/useJakartaEe}}
|
||||
{{^useJakartaEe}}
|
||||
<spring-web-version>5.3.32</spring-web-version>
|
||||
<spring-web-version>5.3.33</spring-web-version>
|
||||
{{/useJakartaEe}}
|
||||
<jackson-version>2.15.2</jackson-version>
|
||||
<jackson-databind-version>2.15.2</jackson-databind-version>
|
||||
@@ -379,6 +393,7 @@
|
||||
{{#performBeanValidation}}
|
||||
<hibernate-validator-version>5.4.3.Final</hibernate-validator-version>
|
||||
{{/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>
|
||||
</project>
|
||||
|
||||
@@ -4,14 +4,14 @@ package {{package}};
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Model tests for {{classname}}
|
||||
*/
|
||||
public class {{classname}}Test {
|
||||
class {{classname}}Test {
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{^vendorExtensions.x-is-one-of-interface}}
|
||||
@@ -23,7 +23,7 @@ public class {{classname}}Test {
|
||||
* Model tests for {{classname}}
|
||||
*/
|
||||
@Test
|
||||
public void test{{classname}}() {
|
||||
void test{{classname}}() {
|
||||
// TODO: test {{classname}}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class {{classname}}Test {
|
||||
* Test the property '{{name}}'
|
||||
*/
|
||||
@Test
|
||||
public void {{name}}Test() {
|
||||
void {{name}}Test() {
|
||||
// TODO: test {{name}}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,14 @@
|
||||
<parallel>methods</parallel>
|
||||
<forkMode>pertest</forkMode>
|
||||
</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>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
@@ -335,11 +343,17 @@
|
||||
</dependency>
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
<artifactId>junit-platform-runner</artifactId>
|
||||
<version>${junit-platform-runner.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -362,6 +376,7 @@
|
||||
<beanvalidation-version>3.0.2</beanvalidation-version>
|
||||
{{/useBeanValidation}}
|
||||
<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>
|
||||
</project>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package {{configPackage}};
|
||||
|
||||
{{#authMethods}}
|
||||
{{#isOAuth}}
|
||||
|
||||
import java.util.Properties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
@@ -11,31 +10,34 @@ import org.springframework.core.env.PropertiesPropertySource;
|
||||
public class ClientPropertiesConfiguration {
|
||||
|
||||
public ClientPropertiesConfiguration( final ConfigurableEnvironment configurableEnvironment ) {
|
||||
final Properties properties = new Properties();
|
||||
properties.put("spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.client-id", "set-{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}-client-id" );
|
||||
properties.put("{{#scopes}}{{#-first}}spring.security.oauth2.client.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.scope", "{{/-first}}{{scope}}{{^-last}},{{/-last}}{{/scopes}}" );
|
||||
{{#authMethods}}
|
||||
{{#isOAuth}}
|
||||
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}}
|
||||
properties.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" );
|
||||
properties.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.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}}.redirect-uri", "set-{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}-redirect-uri" );
|
||||
{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.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}}.authorization-uri", "{{{authorizationUrl}}}" );
|
||||
{{/isCode}}
|
||||
{{#isPassword}}
|
||||
properties.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.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-grant-type", "password" );
|
||||
{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.token-uri", "{{{tokenUrl}}}" );
|
||||
{{/isPassword}}
|
||||
{{#isApplication}}
|
||||
properties.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.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-grant-type", "client_credentials" );
|
||||
{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.token-uri", "{{{tokenUrl}}}" );
|
||||
{{/isApplication}}
|
||||
{{#isImplicit}}
|
||||
properties.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.registration.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-grant-type", "implicit" );
|
||||
{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.put("spring.security.oauth2.client.provider.{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}.authorization-uri", "{{{authorizationUrl}}}" );
|
||||
{{/isImplicit}}
|
||||
final PropertiesPropertySource propertiesPropertySource = new PropertiesPropertySource("{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}", properties );
|
||||
configurableEnvironment.getPropertySources().addLast( propertiesPropertySource );
|
||||
configurableEnvironment.getPropertySources().addLast( new PropertiesPropertySource("{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}", {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}} ) );
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
}
|
||||
|
||||
}
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
|
||||
@@ -459,7 +459,7 @@
|
||||
{{/isInnerEnum}}
|
||||
{{^isInnerEnum}}
|
||||
{{#lambda.copy}}
|
||||
{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}RawValue
|
||||
{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}
|
||||
{{/lambda.copy}}
|
||||
{{#required}}
|
||||
{{#isNullable}}
|
||||
@@ -472,7 +472,7 @@
|
||||
{{#enumVars}}
|
||||
{{#-first}}
|
||||
{{#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);
|
||||
else
|
||||
writer.WriteNull("{{baseName}}");
|
||||
@@ -490,12 +490,12 @@
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{#-first}}
|
||||
{{#isString}}
|
||||
writer.WriteString("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}});
|
||||
{{/isString}}
|
||||
{{^isString}}
|
||||
{{^isNumeric}}
|
||||
writer.WriteString("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}RawValue);
|
||||
{{/isNumeric}}
|
||||
{{#isNumeric}}
|
||||
writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_sanitize_param}}{{#lambda.pasteLine}}{{/lambda.pasteLine}}{{/lambda.camelcase_sanitize_param}}RawValue);
|
||||
{{/isString}}
|
||||
{{/isNumeric}}
|
||||
{{/-first}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
@@ -507,16 +507,16 @@
|
||||
{{#isNullable}}
|
||||
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);
|
||||
writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}});
|
||||
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}}{{^isNumeric}}WriteString {{/isNumeric}}{{#isNumeric}}WriteNumber {{/isNumeric}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}RawValue);
|
||||
}
|
||||
else
|
||||
writer.WriteNull("{{baseName}}");
|
||||
{{/isNullable}}
|
||||
{{^isNullable}}
|
||||
{
|
||||
var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{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}});
|
||||
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}}{{^isNumeric}}WriteString {{/isNumeric}}{{#isNumeric}}WriteNumber {{/isNumeric}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}RawValue);
|
||||
}
|
||||
{{/isNullable}}
|
||||
{{/required}}
|
||||
|
||||
@@ -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}}
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
{{#useCompareNetObjects}}
|
||||
<PackageReference Include="CompareNETObjects" Version="4.82.0" />
|
||||
<PackageReference Include="CompareNETObjects" Version="4.83.0" />
|
||||
{{/useCompareNetObjects}}
|
||||
{{^useGenericHost}}
|
||||
<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.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}}
|
||||
<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}}
|
||||
{{#net80OrLater}}
|
||||
<PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.3" />
|
||||
{{/net80OrLater}}
|
||||
{{#netStandard}}
|
||||
<PackageReference Include="System.Threading.Channels" Version="8.0.0" />
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="{{^netStandard}}17.8.0{{/netStandard}}{{#netStandard}}15.9.2{{/netStandard}}" />
|
||||
<PackageReference Include="xunit" Version="{{^netStandard}}2.6.1{{/netStandard}}{{#netStandard}}2.4.2{{/netStandard}}" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="{{^netStandard}}2.5.3{{/netStandard}}{{#netStandard}}2.4.5{{/netStandard}}" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="{{^netStandard}}17.9.0{{/netStandard}}{{#netStandard}}15.9.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.7{{/netStandard}}{{#netStandard}}2.4.5{{/netStandard}}" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -13,7 +13,7 @@ require 'typhoeus'
|
||||
{{#isFaraday}}
|
||||
require 'faraday'
|
||||
require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
|
||||
require 'filemagic'
|
||||
require 'marcel'
|
||||
{{/isFaraday}}
|
||||
{{#isHttpx}}
|
||||
require 'httpx'
|
||||
|
||||
@@ -94,8 +94,7 @@
|
||||
form_params.each do |key, value|
|
||||
case value
|
||||
when ::File, ::Tempfile
|
||||
filemagic = FileMagic.new(FileMagic::MAGIC_MIME)
|
||||
data[key] = Faraday::FilePart.new(value.path, filemagic.file(value.path, true))
|
||||
data[key] = Faraday::FilePart.new(value.path, Marcel::MimeType.for(Pathname.new(value.path)))
|
||||
when ::Array, nil
|
||||
# let Faraday handle Array and nil parameters
|
||||
data[key] = value
|
||||
|
||||
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
||||
{{#isFaraday}}
|
||||
s.add_runtime_dependency 'faraday', '>= 1.0.1', '< 3.0'
|
||||
s.add_runtime_dependency 'faraday-multipart'
|
||||
s.add_runtime_dependency 'ruby-filemagic'
|
||||
s.add_runtime_dependency 'marcel'
|
||||
{{/isFaraday}}
|
||||
{{#isTyphoeus}}
|
||||
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
||||
|
||||
@@ -168,6 +168,12 @@ public class OpenAPINormalizerTest {
|
||||
Schema schema9 = openAPI.getComponents().getSchemas().get("AnyOfStringArrayOfString");
|
||||
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<>();
|
||||
options.put("SIMPLIFY_ONEOF_ANYOF", "true");
|
||||
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
|
||||
@@ -192,6 +198,15 @@ public class OpenAPINormalizerTest {
|
||||
|
||||
Schema schema10 = openAPI.getComponents().getSchemas().get("AnyOfStringArrayOfString");
|
||||
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
|
||||
@@ -514,6 +529,48 @@ public class OpenAPINormalizerTest {
|
||||
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
|
||||
public void testOpenAPINormalizerSimplifyOneOfAnyOf31Spec() {
|
||||
// to test the rule SIMPLIFY_ONEOF_ANYOF in 3.1 spec
|
||||
|
||||
@@ -57,7 +57,6 @@ import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.assertj.core.api.MapAssert;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
@@ -1198,7 +1197,7 @@ public class SpringCodegenTest {
|
||||
output.deleteOnExit();
|
||||
|
||||
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();
|
||||
codegen.setOpenAPI(openAPI);
|
||||
@@ -1226,9 +1225,23 @@ public class SpringCodegenTest {
|
||||
|
||||
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}\" );"));
|
||||
Assert.assertTrue(content.contains("properties.put(\"spring.security.oauth2.client.provider.oAuth2AccessCode.authorization-uri\", \"${authorizationUrl}\" );"));
|
||||
|
||||
assertFileContains(filePath,
|
||||
"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
|
||||
@@ -2706,6 +2719,26 @@ public class SpringCodegenTest {
|
||||
.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
|
||||
public void shouldUseTheSameTagNameForTheInterfaceAndTheMethod_issue11570() throws IOException {
|
||||
final Map<String, File> output = generateFromContract("src/test/resources/bugs/issue_11570.yml", SPRING_BOOT);
|
||||
|
||||
@@ -295,6 +295,25 @@ public class ModelUtilsTest {
|
||||
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
|
||||
@Test
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -2655,3 +2655,23 @@ components:
|
||||
PetComposition:
|
||||
allOf:
|
||||
- $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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -88,4 +88,22 @@ components:
|
||||
- type: string
|
||||
- type: array
|
||||
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: {}
|
||||
@@ -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: { }
|
||||
@@ -9,9 +9,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="xunit" Version="2.6.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
|
||||
<PackageReference Include="xunit" Version="2.7.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -240,8 +240,8 @@
|
||||
<version>${jackson-databind-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
|
||||
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -274,7 +274,7 @@
|
||||
<jackson-version>2.15.2</jackson-version>
|
||||
<jackson-databind-version>2.15.2</jackson-databind-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>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@@ -81,7 +81,7 @@ import org.openapitools.client.auth.Authentication;
|
||||
import org.openapitools.client.auth.HttpBasicAuth;
|
||||
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 {
|
||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||
|
||||
@@ -16,7 +16,7 @@ package org.openapitools.client;
|
||||
import java.util.Map;
|
||||
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 {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import java.util.Collections;
|
||||
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 {
|
||||
|
||||
protected ApiClient apiClient;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
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 static final String VERSION = "0.1.0";
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.time.format.DateTimeParseException;
|
||||
* 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}.
|
||||
*/
|
||||
@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 {
|
||||
|
||||
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
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 {
|
||||
private String name = "";
|
||||
private String value = "";
|
||||
|
||||
@@ -16,7 +16,7 @@ package org.openapitools.client;
|
||||
import java.util.Collection;
|
||||
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 {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
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 AuthApi() {
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
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 BodyApi() {
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
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 FormApi() {
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
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 HeaderApi() {
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
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 PathApi() {
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
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 QueryApi() {
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.openapitools.client.Pair;
|
||||
import java.util.Map;
|
||||
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 {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
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 {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
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 {
|
||||
private final String scheme;
|
||||
private Supplier<String> tokenSupplier;
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.StringJoiner;
|
||||
Bird.JSON_PROPERTY_SIZE,
|
||||
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 static final String JSON_PROPERTY_SIZE = "size";
|
||||
private String size;
|
||||
@@ -54,7 +54,7 @@ public class Bird {
|
||||
* Get size
|
||||
* @return size
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_SIZE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -80,7 +80,7 @@ public class Bird {
|
||||
* Get color
|
||||
* @return color
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_COLOR)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.StringJoiner;
|
||||
Category.JSON_PROPERTY_ID,
|
||||
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 static final String JSON_PROPERTY_ID = "id";
|
||||
private Long id;
|
||||
@@ -54,7 +54,7 @@ public class Category {
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -80,7 +80,7 @@ public class Category {
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_NAME)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.StringJoiner;
|
||||
DataQuery.JSON_PROPERTY_TEXT,
|
||||
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 static final String JSON_PROPERTY_SUFFIX = "suffix";
|
||||
private String suffix;
|
||||
@@ -64,7 +64,7 @@ public class DataQuery extends Query {
|
||||
* test suffix
|
||||
* @return suffix
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_SUFFIX)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -90,7 +90,7 @@ public class DataQuery extends Query {
|
||||
* Some text containing white spaces
|
||||
* @return text
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_TEXT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -116,7 +116,7 @@ public class DataQuery extends Query {
|
||||
* A date
|
||||
* @return date
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_DATE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ import java.util.StringJoiner;
|
||||
DefaultValue.JSON_PROPERTY_ARRAY_STRING_EXTENSION_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 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));
|
||||
@@ -131,7 +131,7 @@ public class DefaultValue {
|
||||
* Get arrayStringEnumRefDefault
|
||||
* @return arrayStringEnumRefDefault
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_ENUM_REF_DEFAULT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -165,7 +165,7 @@ public class DefaultValue {
|
||||
* Get arrayStringEnumDefault
|
||||
* @return arrayStringEnumDefault
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_ENUM_DEFAULT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -199,7 +199,7 @@ public class DefaultValue {
|
||||
* Get arrayStringDefault
|
||||
* @return arrayStringDefault
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_DEFAULT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -233,7 +233,7 @@ public class DefaultValue {
|
||||
* Get arrayIntegerDefault
|
||||
* @return arrayIntegerDefault
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_INTEGER_DEFAULT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -267,7 +267,7 @@ public class DefaultValue {
|
||||
* Get arrayString
|
||||
* @return arrayString
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -305,7 +305,7 @@ public class DefaultValue {
|
||||
* Get arrayStringNullable
|
||||
* @return arrayStringNullable
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonIgnore
|
||||
|
||||
public List<String> getArrayStringNullable() {
|
||||
@@ -351,7 +351,7 @@ public class DefaultValue {
|
||||
* Get arrayStringExtensionNullable
|
||||
* @return arrayStringExtensionNullable
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonIgnore
|
||||
|
||||
public List<String> getArrayStringExtensionNullable() {
|
||||
@@ -385,7 +385,7 @@ public class DefaultValue {
|
||||
* Get stringNullable
|
||||
* @return stringNullable
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonIgnore
|
||||
|
||||
public String getStringNullable() {
|
||||
|
||||
@@ -35,7 +35,7 @@ import java.util.StringJoiner;
|
||||
NumberPropertiesOnly.JSON_PROPERTY_FLOAT,
|
||||
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 static final String JSON_PROPERTY_NUMBER = "number";
|
||||
private BigDecimal number;
|
||||
@@ -59,7 +59,7 @@ public class NumberPropertiesOnly {
|
||||
* Get number
|
||||
* @return number
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_NUMBER)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -85,7 +85,7 @@ public class NumberPropertiesOnly {
|
||||
* Get _float
|
||||
* @return _float
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_FLOAT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -113,7 +113,7 @@ public class NumberPropertiesOnly {
|
||||
* maximum: 50.2
|
||||
* @return _double
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_DOUBLE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import java.util.StringJoiner;
|
||||
Pet.JSON_PROPERTY_TAGS,
|
||||
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 static final String JSON_PROPERTY_ID = "id";
|
||||
private Long id;
|
||||
@@ -112,7 +112,7 @@ public class Pet {
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -138,7 +138,7 @@ public class Pet {
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
@javax.annotation.Nonnull
|
||||
@jakarta.annotation.Nonnull
|
||||
@JsonProperty(JSON_PROPERTY_NAME)
|
||||
@JsonInclude(value = JsonInclude.Include.ALWAYS)
|
||||
|
||||
@@ -164,7 +164,7 @@ public class Pet {
|
||||
* Get category
|
||||
* @return category
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_CATEGORY)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -198,7 +198,7 @@ public class Pet {
|
||||
* Get photoUrls
|
||||
* @return photoUrls
|
||||
**/
|
||||
@javax.annotation.Nonnull
|
||||
@jakarta.annotation.Nonnull
|
||||
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
|
||||
@JsonInclude(value = JsonInclude.Include.ALWAYS)
|
||||
|
||||
@@ -232,7 +232,7 @@ public class Pet {
|
||||
* Get tags
|
||||
* @return tags
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_TAGS)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -258,7 +258,7 @@ public class Pet {
|
||||
* pet status in the store
|
||||
* @return status
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_STATUS)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.StringJoiner;
|
||||
Query.JSON_PROPERTY_ID,
|
||||
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 static final String JSON_PROPERTY_ID = "id";
|
||||
private Long id;
|
||||
@@ -94,7 +94,7 @@ public class Query {
|
||||
* Query
|
||||
* @return id
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
@@ -128,7 +128,7 @@ public class Query {
|
||||
* Get outcomes
|
||||
* @return outcomes
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_OUTCOMES)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user