Compare commits

..

35 Commits

Author SHA1 Message Date
William Cheng
9eb5231509 Merge branch 'move-samples' of https://github.com/devhl-labs/openapi-generator into devhl-labs-move-samples 2024-03-25 08:49:50 +08:00
devhl
417e0f79c0 commiting all but the file rename for these two files 2024-03-24 10:58:39 -04:00
devhl
4d046b1383 reverting changes bc git does not show the rename 2024-03-24 10:57:00 -04:00
devhl
13bdd37d29 updated appveyor 2024-03-24 10:46:25 -04:00
devhl
41627b1a24 update bin artifact 2024-03-23 23:37:32 -04:00
devhl
fab4e7bf88 update bin artifact 2024-03-23 23:30:28 -04:00
devhl
39405b459f update bin artifact 2024-03-23 23:24:43 -04:00
devhl
680c92f965 renamed bin artifacts 2024-03-23 22:47:30 -04:00
devhl
0801919ecc pinned the samples to their version 2024-03-23 22:44:23 -04:00
devhl
9e7eea689a updated bin artifacts 2024-03-23 22:39:07 -04:00
devhl
f260f4880d updated bin artifacts 2024-03-23 22:34:12 -04:00
devhl
075ef0cc2a renamed workflows 2024-03-23 22:12:51 -04:00
devhl
2a4642ae5f fixed workflows 2024-03-23 22:10:28 -04:00
devhl
1d01926af3 renamed standard2 to standard2.0 2024-03-23 21:48:52 -04:00
devhl
7720a6431e renamed standard2 to standard2.0 2024-03-23 21:48:36 -04:00
devhl
9f3f51eeb6 moved OpenAPIClientCoreAndNet47 2024-03-23 21:47:42 -04:00
devhl
9d84fd7a92 moved OpenAPIClientCore 2024-03-23 21:46:58 -04:00
devhl
3e40459b4c moved OpenAPIClient-unityWebRequest 2024-03-23 21:46:14 -04:00
devhl
19278f8ec9 moved OpenAPIClient-restsharp-name-parameter-mappings 2024-03-23 21:44:56 -04:00
devhl
a0460adb6d moved OpenAPIClient-net48 2024-03-23 21:44:02 -04:00
devhl
894ed5d946 moved OpenAPIClient-net47 2024-03-23 21:43:12 -04:00
devhl
7befce6bc6 moved OpenAPIClient-net7.0-useDateTimeForDate 2024-03-23 21:40:35 -04:00
devhl
c8bfdc964e moved OpenAPIClient-net5.0 2024-03-23 21:39:41 -04:00
devhl
3ba7d46885 moved OpenAPIClient-httpclient 2024-03-23 21:38:24 -04:00
devhl
adea1c413b moved OpenAPIClient-ConditionalSerialization 2024-03-23 21:37:08 -04:00
devhl
a3711980b0 moved OpenAPIClient 2024-03-23 21:36:01 -04:00
devhl
a165e22662 moved OpenAPIClient-generichost-netstandard2.0 2024-03-23 21:31:34 -04:00
devhl
314aedab0b moved OpenAPIClient-generichost-net7.0-useDateTimeForDate 2024-03-23 21:30:53 -04:00
devhl
7f75faea9d moved OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration 2024-03-23 21:30:17 -04:00
devhl
ba6b8d8f24 moved OpenAPIClient-generichost-net6.0-nrt 2024-03-23 21:29:41 -04:00
devhl
fc3b521b09 moved OpenAPIClient-generichost-net6.0 2024-03-23 21:29:05 -04:00
devhl
0caabded37 moved oneOf 2024-03-23 21:28:13 -04:00
devhl
377b28f524 moved anyOf 2024-03-23 21:27:47 -04:00
devhl
2e28e557f4 moved allOf 2024-03-23 21:27:13 -04:00
devhl
500aeada68 moved manual tests 2024-03-23 21:25:06 -04:00
5352 changed files with 9401 additions and 75373 deletions

View File

@@ -21,11 +21,11 @@ jobs:
fail-fast: false
matrix:
sample:
- 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/
- 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/
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4.0.0

View File

@@ -21,16 +21,14 @@ jobs:
fail-fast: false
matrix:
sample:
- 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
- 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
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4.0.0

View File

@@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
sample:
- samples/client/petstore/csharp/restsharp/net6/ParameterMappings/
- samples/client/petstore/csharp/restsharp/net6/OpenAPIClient-restsharp-name-parameter-mappings/
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4.0.0

View File

@@ -13,8 +13,6 @@ 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/**'
@@ -27,8 +25,6 @@ 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
@@ -75,8 +71,6 @@ 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

View File

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

View File

@@ -34,7 +34,6 @@ 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

View File

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

View File

@@ -68,7 +68,6 @@ 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

View File

@@ -43,29 +43,23 @@ build_script:
#- dotnet build samples\client\petstore\csharp\OpenAPIClient-ConditionalSerialization\Org.OpenAPITools.sln
test_script:
- 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
# 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
### TODO: Execute all generators via powershell or other
# generate all petstore clients

View File

@@ -1,6 +1,6 @@
# for csharp generichost
generatorName: csharp
outputDir: samples/client/petstore/csharp/generichost/net8/Petstore
outputDir: samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-net6.0
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

View File

@@ -1,6 +1,6 @@
# for csharp generichost
generatorName: csharp
outputDir: samples/client/petstore/csharp/generichost/net8/AllOf
outputDir: samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-netcore-latest-allOf
inputSpec: modules/openapi-generator/src/test/resources/3_0/allOf.yaml
library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp

View File

@@ -1,6 +1,6 @@
# for csharp generichost
generatorName: csharp
outputDir: samples/client/petstore/csharp/generichost/net8/AnyOf
outputDir: samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-netcore-latest-anyOf
inputSpec: modules/openapi-generator/src/test/resources/3_0/anyOf.yaml
library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp

View File

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

View File

@@ -1,6 +1,6 @@
# for csharp generichost
generatorName: csharp
outputDir: samples/client/petstore/csharp/generichost/net8/SourceGeneration
outputDir: samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration
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,5 +9,6 @@ additionalProperties:
useCompareNetObjects: true
disallowAdditionalPropertiesIfNotPresent: false
useSourceGeneration: true
packageName: UseSourceGeneration
equatable: true
targetFramework: net8.0

View File

@@ -1,6 +1,6 @@
# for csharp generichost
generatorName: csharp
outputDir: samples/client/petstore/csharp/generichost/net8/NullReferenceTypes
outputDir: samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-net6.0-nrt
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

View File

@@ -1,6 +1,6 @@
# for csharp generichost
generatorName: csharp
outputDir: samples/client/petstore/csharp/generichost/net8/OneOf
outputDir: samples/client/petstore/csharp/generichost/net8/OpenAPIClient-generichost-netcore-latest-oneOf
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf.yaml
library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp

View File

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

View File

@@ -1,6 +1,6 @@
# for csharp generichost
generatorName: csharp
outputDir: samples/client/petstore/csharp/generichost/standard2.0/Petstore
outputDir: samples/client/petstore/csharp/generichost/standard2.0/OpenAPIClient-generichost-netstandard2.0
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

View File

@@ -1,6 +1,6 @@
# for .net standard httpclient
generatorName: csharp
outputDir: samples/client/petstore/csharp/httpclient/standard2.0/Petstore
outputDir: samples/client/petstore/csharp/httpclient/standard2.0/OpenAPIClient-httpclient
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

View File

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

View File

@@ -1,6 +1,6 @@
# for .net standard
generatorName: csharp
outputDir: samples/client/petstore/csharp/restsharp/net4.7/Petstore
outputDir: samples/client/petstore/csharp/restsharp/net4.7/OpenAPIClient-net47
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:

View File

@@ -1,6 +1,6 @@
# for .net standard
generatorName: csharp
outputDir: samples/client/petstore/csharp/restsharp/net4.8/Petstore
outputDir: samples/client/petstore/csharp/restsharp/net4.8/OpenAPIClient-net48
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:

View File

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

View File

@@ -1,5 +1,5 @@
generatorName: csharp
outputDir: samples/client/petstore/csharp/restsharp/net7/Petstore
outputDir: samples/client/petstore/csharp/restsharp/net7/OpenAPIClientCore
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:

View File

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

View File

@@ -1,6 +1,6 @@
# for .net standard
generatorName: csharp
outputDir: samples/client/petstore/csharp/restsharp/net7/EnumMappings
outputDir: samples/client/petstore/csharp/restsharp/net7/OpenAPIClient-net5.0
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:

View File

@@ -1,6 +1,6 @@
# for .net standard
generatorName: csharp
outputDir: samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization
outputDir: samples/client/petstore/csharp/restsharp/standard2.0/OpenAPIClient-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:

View File

@@ -1,6 +1,6 @@
# for .net standard
generatorName: csharp
outputDir: samples/client/petstore/csharp/restsharp/standard2.0/Petstore
outputDir: samples/client/petstore/csharp/restsharp/standard2.0/OpenAPIClient
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:

View File

@@ -1,6 +1,6 @@
# for .net Unity
generatorName: csharp
outputDir: samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore
outputDir: samples/client/petstore/csharp/unityWebRequest/standard2.0/OpenAPIClient-unityWebRequest
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

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,10 @@
---
# csharp test files and image for upload
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs"
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/OpenAPIClient/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs"
sha256: e323c7e646a0ceb6d1d8f34f287175ac666fdbbe057791b45d138de3d9582666
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs"
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs"
sha256: 7dad88554fe630d25c787cae05305d302d5e34ca810aee4fa23f20055f9188e1
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/linux-logo.png"
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/OpenAPIClient/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"

View File

@@ -605,10 +605,3 @@ 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"
```

View File

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

View File

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

View File

@@ -43,8 +43,6 @@ 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;

View File

@@ -97,6 +97,8 @@ public class DefaultCodegen implements CodegenConfig {
private static final Cache<SanitizeNameOptions, String> sanitizedNameCache;
private static final String xSchemaTestExamplesKey = "x-schema-test-examples";
private static final String xSchemaTestExamplesRefPrefix = "#/components/x-schema-test-examples/";
protected static Schema falseSchema;
protected static Schema trueSchema = new Schema();
static {
DefaultFeatureSet = FeatureSet.newBuilder()
@@ -149,6 +151,8 @@ public class DefaultCodegen implements CodegenConfig {
.expireAfterAccess(cacheExpiry, TimeUnit.SECONDS)
.ticker(Ticker.systemTicker())
.build();
falseSchema = new Schema();
falseSchema.setNot(new Schema());
}
protected GeneratorMetadata generatorMetadata;
@@ -300,6 +304,8 @@ public class DefaultCodegen implements CodegenConfig {
// A cache to efficiently lookup schema `toModelName()` based on the schema Key
private final Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
protected boolean loadDeepObjectIntoItems = true;
// if true then baseTypes will be imported
protected boolean importBaseType = true;
@@ -2458,14 +2464,6 @@ 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());
@@ -3116,6 +3114,11 @@ public class DefaultCodegen implements CodegenConfig {
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
CodegenModel m = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
if (schema.equals(trueSchema)) {
m.setIsBooleanSchemaTrue(true);
} else if (schema.equals(falseSchema)) {
m.setIsBooleanSchemaFalse(true);
}
// unalias schema
schema = unaliasSchema(schema);
if (schema == null) {
@@ -3351,7 +3354,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) {
once(LOGGER).warn(
LOGGER.warn(
"'{}' defines discriminator '{}', but the referenced OneOf schema '{}' is missing {}",
composedSchemaName, discPropName, modelName, discPropName);
}
@@ -3360,7 +3363,7 @@ public class DefaultCodegen implements CodegenConfig {
continue;
}
if (cp != thisCp) {
once(LOGGER).warn(
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);
}
@@ -3374,7 +3377,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) {
once(LOGGER).warn(
LOGGER.warn(
"'{}' defines discriminator '{}', but the referenced AnyOf schema '{}' is missing {}",
composedSchemaName, discPropName, modelName, discPropName);
}
@@ -3383,7 +3386,7 @@ public class DefaultCodegen implements CodegenConfig {
continue;
}
if (cp != thisCp) {
once(LOGGER).warn(
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);
}
@@ -3451,7 +3454,7 @@ public class DefaultCodegen implements CodegenConfig {
}
}
if (discriminatorsPropNames.size() > 1) {
once(LOGGER).warn("The oneOf schemas have conflicting discriminator property names. " +
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) {
@@ -3480,7 +3483,7 @@ public class DefaultCodegen implements CodegenConfig {
}
}
if (discriminatorsPropNames.size() > 1) {
once(LOGGER).warn("The anyOf schemas have conflicting discriminator property names. " +
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) {
@@ -3529,7 +3532,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
once(LOGGER).warn(
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);
}
@@ -3551,14 +3554,14 @@ public class DefaultCodegen implements CodegenConfig {
msgSuffix += spacer + "invalid optional definition of " + discPropName + ", include it in required";
}
}
once(LOGGER).warn("'{}' defines discriminator '{}', but the referenced schema '{}' is incorrect. {}",
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
once(LOGGER).error("Failed to lookup the schema '{}' when processing oneOf/anyOf. Please check to ensure it's defined properly.", modelName);
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")) {
@@ -3671,7 +3674,7 @@ public class DefaultCodegen implements CodegenConfig {
if (e.getValue().indexOf('/') >= 0) {
name = ModelUtils.getSimpleRef(e.getValue());
if (ModelUtils.getSchema(openAPI, name) == null) {
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);
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();
@@ -3980,13 +3983,6 @@ 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) {
@@ -4001,6 +3997,11 @@ public class DefaultCodegen implements CodegenConfig {
}
CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
if (p.equals(trueSchema)) {
property.setIsBooleanSchemaTrue(true);
} else if (p.equals(falseSchema)) {
property.setIsBooleanSchemaFalse(true);
}
// unalias schema
p = unaliasSchema(p);
@@ -5474,7 +5475,7 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.pattern = toRegularExpression(parameterSchema.getPattern());
if (codegenParameter.isQueryParam && codegenParameter.isDeepObject) {
if (codegenParameter.isQueryParam && codegenParameter.isDeepObject && loadDeepObjectIntoItems) {
Schema schema = parameterSchema;
if (schema.get$ref() != null) {
schema = ModelUtils.getReferencedSchema(openAPI, schema);
@@ -6779,7 +6780,6 @@ 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,7 +6802,6 @@ 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);
}
@@ -6941,7 +6940,6 @@ public class DefaultCodegen implements CodegenConfig {
scopes.add(scope);
}
codegenSecurity.scopes = scopes;
codegenSecurity.hasScopes = true;
}
}
@@ -8423,17 +8421,12 @@ public class DefaultCodegen implements CodegenConfig {
xOf.add(cp);
i += 1;
if (dataTypeSet.contains(cp.dataType)
|| (isTypeErasedGenerics() && dataTypeSet.contains(cp.baseType))) {
if (dataTypeSet.contains(cp.dataType)) {
// 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 {
if(isTypeErasedGenerics()) {
dataTypeSet.add(cp.baseType);
} else {
dataTypeSet.add(cp.dataType);
}
dataTypeSet.add(cp.dataType);
}
}
return xOf;
@@ -8470,18 +8463,41 @@ 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; }
/**
* Used to ensure that null or Schema is returned given an input Boolean/Schema/null
* This will be used in openapi 3.1.0 spec processing to ensure that Booleans become Schemas
* Because our generators only understand Schemas
* Note: use getIsBooleanSchemaTrue or getIsBooleanSchemaFalse on the IJsonSchemaValidationProperties
* if you need to be able to detect if the original schema's value was true or false
*
* @param schema the input Boolean or Schema data to convert to a Schema
* @return Schema the input data converted to a Schema if possible
*/
protected Schema getSchemaFromBooleanOrSchema(Object schema) {
if (schema == null) {
return null;
} else if (schema instanceof Boolean) {
if (Boolean.TRUE.equals(schema)) {
return trueSchema;
} else if (Boolean.FALSE.equals(schema)) {
return falseSchema;
}
// null case
return null;
} else if (schema instanceof Schema) {
return (Schema) schema;
} else {
throw new IllegalArgumentException("Invalid schema type; type must be Boolean or Schema");
}
}
public void setAutosetConstants(boolean autosetConstants) {
this.autosetConstants = autosetConstants;
}

View File

@@ -38,8 +38,6 @@ 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<>();
@@ -114,14 +112,6 @@ 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 =============
/**
@@ -153,23 +143,12 @@ 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");
}
/**
@@ -244,26 +223,6 @@ 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));
}
}
}
/**
@@ -574,18 +533,15 @@ public class OpenAPINormalizer {
}
private Schema normalizeSimpleSchema(Schema schema, Set<Schema> visitedSchemas) {
Schema result = processNormalize31Spec(schema, visitedSchemas);
return processSetPrimitiveTypesToNullable(result);
return processNormalize31Spec(schema, visitedSchemas);
}
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) {
@@ -932,27 +888,6 @@ 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);
@@ -982,49 +917,25 @@ public class OpenAPINormalizer {
if (Boolean.TRUE.equals(schema.getUniqueItems())) { // a set
if (updateSetToNullable) {
return setNullable(schema);
if (schema.getNullable() != null || (schema.getExtensions() != null && schema.getExtensions().containsKey("x-nullable"))) {
// already set, don't overwrite
return schema;
}
schema.setNullable(true);
}
} else { // array
if (updateArrayToNullable) {
return setNullable(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 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.
*
@@ -1037,7 +948,11 @@ public class OpenAPINormalizer {
}
if (updateMapToNullable) {
return setNullable(schema);
if (schema.getNullable() != null || (schema.getExtensions() != null && schema.getExtensions().containsKey("x-nullable"))) {
// already set, don't override
return schema;
}
schema.setNullable(true);
}
return schema;
@@ -1057,27 +972,6 @@ 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);
}

View File

@@ -734,11 +734,6 @@ 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;
}

View File

@@ -21,7 +21,6 @@ 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;
@@ -667,14 +666,6 @@ 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
@@ -1601,29 +1592,15 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
}
// additional import for different cases
addAdditionalImports(codegenModel, codegenModel.getComposedSchemas());
addAdditionalImports(codegenModel, codegenModel.oneOf);
addAdditionalImports(codegenModel, codegenModel.anyOf);
return codegenModel;
}
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);
}
private void addAdditionalImports(CodegenModel model, Set<String> dataTypeSet) {
for (String dataType : dataTypeSet) {
if (null != importMapping().get(dataType)) {
model.imports.add(dataType);
}
}
}
@@ -2530,9 +2507,4 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
imports.add(importsItem);
}
}
@Override
public boolean isTypeErasedGenerics() {
return true;
}
}

View File

@@ -615,6 +615,10 @@ 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",
@@ -782,12 +786,6 @@ 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(""); }

View File

@@ -929,76 +929,16 @@ public class ModelUtils {
* @return schema without '$ref'
*/
public static Schema getReferencedSchema(OpenAPI openAPI, Schema schema) {
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;
if (schema != null && StringUtils.isNotEmpty(schema.get$ref())) {
String name = getSimpleRef(schema.get$ref());
Schema referencedSchema = getSchema(openAPI, name);
if (referencedSchema != null) {
return referencedSchema;
}
} 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;
@@ -1332,9 +1272,7 @@ public class ModelUtils {
}
Schema ref = allSchemas.get(simpleRef);
if (ref == null) {
if (!isRefToSchemaWithProperties(schema.get$ref())) {
once(LOGGER).warn("{} is not defined", 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

View File

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

View File

@@ -125,7 +125,7 @@ ext {
{{/useBeanValidation}}
jersey_version = "1.19.4"
jodatime_version = "2.9.9"
junit_version = "5.10.2"
junit_version = "4.13.2"
}
dependencies {
@@ -149,20 +149,4 @@ 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"
}
}

View File

@@ -78,74 +78,37 @@ 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 {{{dataType}}}{{#isNullable}} (nullable){{/isNullable}}
// deserialize {{{.}}}
try {
{{^isArray}}
boolean attemptParsing = true;
{{#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}}
// 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}}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs({{{dataType}}}.class);
deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.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 '{{{dataType}}}'");
log.log(Level.FINER, "Input data matches schema '{{{.}}}'");
}
{{/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 '{{{dataType}}}'", e);
log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e);
}
{{/oneOf}}
{{/composedSchemas}}
if (match == 1) {
{{classname}} ret = new {{classname}}();
ret.setActualInstance(deserialized);
@@ -189,17 +152,13 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return Objects.hash(getActualInstance(), isNullable(), getSchemaType(), additionalProperties);
}
{{/additionalPropertiesType}}
{{#composedSchemas}}
{{#oneOf}}
{{^vendorExtensions.x-duplicated-data-type}}
public {{classname}}({{{baseType}}} o) {
public {{classname}}({{{.}}} 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<{{{.}}}>() {
@@ -239,17 +198,13 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
}
{{/isNullable}}
{{#composedSchemas}}
{{#oneOf}}
{{^vendorExtensions.x-duplicated-data-type}}
if (JSON.isInstanceOf({{{baseType}}}.class, instance, new HashSet<>())) {
if (JSON.isInstanceOf({{{.}}}.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}}");
}
@@ -264,26 +219,17 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return super.getActualInstance();
}
{{#composedSchemas}}
{{#oneOf}}
/**
* Get the actual instance of `{{{dataType}}}`. If the actual instance is not `{{{dataType}}}`,
* Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `{{{dataType}}}`
* @throws ClassCastException if the instance is not `{{{dataType}}}`
* @return The actual instance of `{{{.}}}`
* @throws ClassCastException if the instance is not `{{{.}}}`
*/
{{^isArray}}
public {{{dataType}}} get{{{dataType}}}() throws ClassCastException {
return ({{{dataType}}})super.getActualInstance();
public {{{.}}} get{{{.}}}() throws ClassCastException {
return ({{{.}}})super.getActualInstance();
}
{{/isArray}}
{{#isArray}}
public {{{dataType}}} get{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}() throws ClassCastException {
return ({{{dataType}}})super.getActualInstance();
}
{{/isArray}}
{{/oneOf}}
{{/composedSchemas}}
}

View File

@@ -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}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} {
public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} {
private static final Logger log = Logger.getLogger({{classname}}.class.getName());
public static class {{classname}}Serializer extends StdSerializer<{{classname}}> {

View File

@@ -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}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} {
public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} {
private static final Logger log = Logger.getLogger({{classname}}.class.getName());
public static class {{classname}}Serializer extends StdSerializer<{{classname}}> {

View File

@@ -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.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.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'

View File

@@ -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.12.0",
"com.squareup.okhttp3" % "logging-interceptor" % "4.12.0",
"com.squareup.okhttp3" % "okhttp" % "4.10.0",
"com.squareup.okhttp3" % "logging-interceptor" % "4.10.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",

View File

@@ -4,9 +4,8 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.web.client.RestClientException;
import org.junit.Test;
import org.junit.Ignore;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -18,8 +17,8 @@ import java.util.Map;
/**
* API tests for {{classname}}
*/
@Disabled
class {{classname}}Test {
@Ignore
public class {{classname}}Test {
private final {{classname}} api = new {{classname}}();
@@ -29,11 +28,11 @@ class {{classname}}Test {
*
* {{notes}}
*
* @throws RestClientException
* @throws ApiException
* if the Api call fails
*/
@Test
void {{operationId}}Test() {
public 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}}

View File

@@ -121,15 +121,15 @@ ext {
jackson_databind_nullable_version = "0.2.6"
{{/openApiNullable}}
{{#useJakartaEe}}
spring_web_version = "6.1.5"
spring_web_version = "6.0.17"
jakarta_annotation_version = "2.1.1"
{{/useJakartaEe}}
{{^useJakartaEe}}
spring_web_version = "5.3.33"
spring_web_version = "5.3.32"
jakarta_annotation_version = "1.3.5"
{{/useJakartaEe}}
jodatime_version = "2.9.9"
junit_version = "5.10.2"
junit_version = "4.13.2"
}
dependencies {
@@ -158,20 +158,5 @@ dependencies {
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
{{/withXml}}
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_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"
}
testImplementation "junit:junit:$junit_version"
}

View File

@@ -76,14 +76,6 @@
<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>
@@ -347,17 +339,11 @@
<!-- test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<groupId>junit</groupId>
<artifactId>junit</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>
@@ -368,10 +354,10 @@
<swagger-annotations-version>2.2.15</swagger-annotations-version>
{{/swagger2AnnotationLibrary}}
{{#useJakartaEe}}
<spring-web-version>6.1.5</spring-web-version>
<spring-web-version>6.0.17</spring-web-version>
{{/useJakartaEe}}
{{^useJakartaEe}}
<spring-web-version>5.3.33</spring-web-version>
<spring-web-version>5.3.32</spring-web-version>
{{/useJakartaEe}}
<jackson-version>2.15.2</jackson-version>
<jackson-databind-version>2.15.2</jackson-databind-version>
@@ -393,7 +379,6 @@
{{#performBeanValidation}}
<hibernate-validator-version>5.4.3.Final</hibernate-validator-version>
{{/performBeanValidation}}
<junit-version>5.10.2</junit-version>
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
<junit-version>4.13.2</junit-version>
</properties>
</project>

View File

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

View File

@@ -92,14 +92,6 @@
<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>
@@ -343,17 +335,11 @@
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<groupId>junit</groupId>
<artifactId>junit</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>
@@ -376,7 +362,6 @@
<beanvalidation-version>3.0.2</beanvalidation-version>
{{/useBeanValidation}}
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>5.10.2</junit-version>
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
<junit-version>4.13.2</junit-version>
</properties>
</project>

View File

@@ -1,6 +1,7 @@
package {{configPackage}};
{{#authMethods}}
{{#isOAuth}}
import java.util.Properties;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.ConfigurableEnvironment;
@@ -10,34 +11,31 @@ import org.springframework.core.env.PropertiesPropertySource;
public class ClientPropertiesConfiguration {
public ClientPropertiesConfiguration( final ConfigurableEnvironment configurableEnvironment ) {
{{#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}}
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}}" );
{{#isCode}}
{{{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}}}" );
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}}}" );
{{/isCode}}
{{#isPassword}}
{{{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}}}" );
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}}}" );
{{/isPassword}}
{{#isApplication}}
{{{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}}}" );
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}}}" );
{{/isApplication}}
{{#isImplicit}}
{{{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}}}" );
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}}}" );
{{/isImplicit}}
configurableEnvironment.getPropertySources().addLast( new PropertiesPropertySource("{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}", {{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}} ) );
{{/isOAuth}}
{{/authMethods}}
final PropertiesPropertySource propertiesPropertySource = new PropertiesPropertySource("{{{name}}}{{#lambda.pascalcase}}{{{flow}}}{{/lambda.pascalcase}}", properties );
configurableEnvironment.getPropertySources().addLast( propertiesPropertySource );
}
}
{{/isOAuth}}
{{/authMethods}}

View File

@@ -459,7 +459,7 @@
{{/isInnerEnum}}
{{^isInnerEnum}}
{{#lambda.copy}}
{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}
{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}RawValue
{{/lambda.copy}}
{{#required}}
{{#isNullable}}
@@ -472,7 +472,7 @@
{{#enumVars}}
{{#-first}}
{{#isString}}
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 }}
if ({{#lambda.pasteLine}}{{/lambda.pasteLine}} != 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}}
{{^isNumeric}}
writer.WriteString("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}RawValue);
{{/isNumeric}}
{{#isNumeric}}
{{#isString}}
writer.WriteString("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}});
{{/isString}}
{{^isString}}
writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_sanitize_param}}{{#lambda.pasteLine}}{{/lambda.pasteLine}}{{/lambda.camelcase_sanitize_param}}RawValue);
{{/isNumeric}}
{{/isString}}
{{/-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}}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);
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}});
}
else
writer.WriteNull("{{baseName}}");
{{/isNullable}}
{{^isNullable}}
{
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);
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}});
}
{{/isNullable}}
{{/required}}

View File

@@ -1 +1 @@
{{#parentModel.composedSchemas.anyOf}}{{#lambda.camelcase_sanitize_param}}{{parent}}{{/lambda.camelcase_sanitize_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.anyOf}}{{#allVars}}{{#isInherited}}{{^isNew}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}{{/isNew}}{{#isNew}}{{#isEnum}}{{#isInnerEnum}}{{classname}}.{{{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}}
{{#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}}

View File

@@ -25,7 +25,7 @@
<ItemGroup>
{{#useCompareNetObjects}}
<PackageReference Include="CompareNETObjects" Version="4.83.0" />
<PackageReference Include="CompareNETObjects" Version="4.82.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.3 {{/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.0 {{/net8.0}}{{/lambda.first}}" />
{{/supportsRetry}}
{{#net80OrLater}}
<PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.3" />
<PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.0" />
{{/net80OrLater}}
{{#netStandard}}
<PackageReference Include="System.Threading.Channels" Version="8.0.0" />

View File

@@ -9,9 +9,9 @@
</PropertyGroup>
<ItemGroup>
<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}}" />
<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}}" />
</ItemGroup>
<ItemGroup>

View File

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

View File

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

View File

@@ -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 'marcel'
s.add_runtime_dependency 'ruby-filemagic'
{{/isFaraday}}
{{#isTyphoeus}}
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'

View File

@@ -168,12 +168,6 @@ 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);
@@ -198,15 +192,6 @@ 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
@@ -529,48 +514,6 @@ 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

View File

@@ -57,6 +57,7 @@ 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;
@@ -1197,7 +1198,7 @@ public class SpringCodegenTest {
output.deleteOnExit();
OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/3_0/spring/petstore-auth.yaml", null, new ParseOptions()).getOpenAPI();
.readLocation("src/test/resources/3_0/issue_18090.yaml", null, new ParseOptions()).getOpenAPI();
final SpringCodegen codegen = new SpringCodegen();
codegen.setOpenAPI(openAPI);
@@ -1225,23 +1226,9 @@ public class SpringCodegenTest {
Path filePath = Paths.get(output.getAbsolutePath(), "src/main/java/org/openapitools/configuration/ClientPropertiesConfiguration.java");
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");
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}\" );"));
}
@Test
@@ -2719,26 +2706,6 @@ 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);

View File

@@ -295,25 +295,6 @@ 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

View File

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

View File

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

View File

@@ -2655,23 +2655,3 @@ 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

View File

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

View File

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

View File

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

View File

@@ -88,22 +88,4 @@ components:
- type: string
- type: array
items:
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: {}
type: string

View File

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

View File

@@ -9,9 +9,9 @@
</PropertyGroup>
<ItemGroup>
<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" />
<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" />
</ItemGroup>
<ItemGroup>

View File

@@ -108,8 +108,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.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.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'

View File

@@ -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.12.0",
"com.squareup.okhttp3" % "logging-interceptor" % "4.12.0",
"com.squareup.okhttp3" % "okhttp" % "4.10.0",
"com.squareup.okhttp3" % "logging-interceptor" % "4.10.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",

View File

@@ -100,10 +100,10 @@ ext {
jackson_version = "2.14.2"
jackson_databind_version = "2.15.1"
jackson_databind_nullable_version = "0.2.6"
spring_web_version = "5.3.33"
spring_web_version = "5.3.32"
jakarta_annotation_version = "1.3.5"
jodatime_version = "2.9.9"
junit_version = "5.10.2"
junit_version = "4.13.2"
}
dependencies {
@@ -117,20 +117,5 @@ dependencies {
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_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"
}
testImplementation "junit:junit:$junit_version"
}

View File

@@ -69,14 +69,6 @@
<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>
@@ -266,26 +258,19 @@
<!-- test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<groupId>junit</groupId>
<artifactId>junit</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>
<spring-web-version>5.3.33</spring-web-version>
<spring-web-version>5.3.32</spring-web-version>
<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>
<junit-version>5.10.2</junit-version>
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
<junit-version>4.13.2</junit-version>
</properties>
</project>

View File

@@ -17,7 +17,7 @@ require 'tempfile'
require 'time'
require 'faraday'
require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
require 'marcel'
require 'filemagic'
module OpenapiClient
@@ -141,7 +141,8 @@ module OpenapiClient
form_params.each do |key, value|
case value
when ::File, ::Tempfile
data[key] = Faraday::FilePart.new(value.path, Marcel::MimeType.for(Pathname.new(value.path)))
filemagic = FileMagic.new(FileMagic::MAGIC_MIME)
data[key] = Faraday::FilePart.new(value.path, filemagic.file(value.path, true))
when ::Array, nil
# let Faraday handle Array and nil parameters
data[key] = value

View File

@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'faraday', '>= 1.0.1', '< 3.0'
s.add_runtime_dependency 'faraday-multipart'
s.add_runtime_dependency 'marcel'
s.add_runtime_dependency 'ruby-filemagic'
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'

View File

@@ -20,7 +20,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CompareNETObjects" Version="4.83.0" />
<PackageReference Include="CompareNETObjects" Version="4.82.0" />
<PackageReference Include="JsonSubTypes" Version="2.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="RestSharp" Version="110.2.0" />

View File

@@ -1,30 +0,0 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
#
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
name: Java CI with Maven
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
build:
name: Build Example - oneOf data type
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8' ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --no-transfer-progress --file pom.xml

View File

@@ -1,21 +0,0 @@
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# exclude jar for gradle wrapper
!gradle/wrapper/*.jar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# build files
**/target
target
.gradle
build

View File

@@ -1,36 +0,0 @@
.github/workflows/maven.yml
.gitignore
.travis.yml
README.md
api/openapi.yaml
build.gradle
build.sbt
docs/DefaultApi.md
docs/Example.md
git_push.sh
gradle.properties
gradle/wrapper/gradle-wrapper.jar
gradle/wrapper/gradle-wrapper.properties
gradlew
gradlew.bat
pom.xml
settings.gradle
src/main/AndroidManifest.xml
src/main/java/org/openapitools/client/ApiClient.java
src/main/java/org/openapitools/client/ApiException.java
src/main/java/org/openapitools/client/ApiResponse.java
src/main/java/org/openapitools/client/Configuration.java
src/main/java/org/openapitools/client/JSON.java
src/main/java/org/openapitools/client/JavaTimeFormatter.java
src/main/java/org/openapitools/client/Pair.java
src/main/java/org/openapitools/client/RFC3339DateFormat.java
src/main/java/org/openapitools/client/ServerConfiguration.java
src/main/java/org/openapitools/client/ServerVariable.java
src/main/java/org/openapitools/client/StringUtil.java
src/main/java/org/openapitools/client/api/DefaultApi.java
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
src/main/java/org/openapitools/client/auth/Authentication.java
src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
src/main/java/org/openapitools/client/auth/HttpBearerAuth.java
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
src/main/java/org/openapitools/client/model/Example.java

View File

@@ -1,22 +0,0 @@
#
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
# Ref: https://docs.travis-ci.com/user/languages/java/
#
language: java
jdk:
- openjdk12
- openjdk11
- openjdk10
- openjdk9
- openjdk8
before_install:
# ensure gradlew has proper permission
- chmod a+x ./gradlew
script:
# test using maven
#- mvn test
# test using gradle
- gradle test
# test using sbt
# - sbt test

View File

@@ -1,163 +0,0 @@
# openapi-java-client
Example - oneOf data type
- API version: 1.0.0
- Generator version: 7.5.0-SNAPSHOT
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
## Requirements
Building the API client library requires:
1. Java 1.8+
2. Maven (3.8.3+)/Gradle (7.2+)
## Installation
To install the API client library to your local Maven repository, simply execute:
```shell
mvn clean install
```
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
```shell
mvn clean deploy
```
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
### Maven users
Add this dependency to your project's POM:
```xml
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-java-client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
```
### Gradle users
Add this dependency to your project's build file:
```groovy
repositories {
mavenCentral() // Needed if the 'openapi-java-client' jar has been published to maven central.
mavenLocal() // Needed if the 'openapi-java-client' jar has been published to the local maven repo.
}
dependencies {
implementation "org.openapitools:openapi-java-client:1.0.0"
}
```
### Others
At first generate the JAR by executing:
```shell
mvn clean package
```
Then manually install the following JARs:
- `target/openapi-java-client-1.0.0.jar`
- `target/lib/*.jar`
## Usage
To add a HTTP proxy for the API client, use `ClientConfig`:
```java
import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.openapitools.client.*;
import org.openapitools.client.api.DefaultApi;
...
ApiClient defaultClient = Configuration.getDefaultApiClient();
ClientConfig clientConfig = defaultClient.getClientConfig();
clientConfig.connectorProvider(new ApacheConnectorProvider());
clientConfig.property(ClientProperties.PROXY_URI, "http://proxy_url_here");
clientConfig.property(ClientProperties.PROXY_USERNAME, "proxy_username");
clientConfig.property(ClientProperties.PROXY_PASSWORD, "proxy_password");
defaultClient.setClientConfig(clientConfig);
DefaultApi apiInstance = new DefaultApi(defaultClient);
```
## Getting Started
Please follow the [installation](#installation) instruction and execute the following Java code:
```java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;
public class DefaultApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://api.example.xyz/v1");
DefaultApi apiInstance = new DefaultApi(defaultClient);
try {
Example result = apiInstance.callList();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#callList");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
## Documentation for API Endpoints
All URIs are relative to *http://api.example.xyz/v1*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**callList**](docs/DefaultApi.md#callList) | **GET** /example |
## Documentation for Models
- [Example](docs/Example.md)
<a id="documentation-for-authorization"></a>
## Documentation for Authorization
Endpoints do not require authorization.
## Recommendation
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
## Author

View File

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

View File

@@ -1,158 +0,0 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'com.diffplug.spotless'
group = 'org.openapitools'
version = '1.0.0'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.3.0'
}
}
repositories {
mavenCentral()
}
if(hasProperty('target') && target == 'android') {
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// Rename the aar correctly
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
dependencies {
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}
afterEvaluate {
android.libraryVariants.all { variant ->
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
task.description = "Create jar artifact for ${variant.name}"
task.dependsOn variant.javaCompile
task.from variant.javaCompile.destinationDirectory
task.destinationDirectory = project.file("${project.buildDir}/outputs/jar")
task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar"
artifacts.add('archives', task);
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
artifacts {
archives sourcesJar
}
} else {
apply plugin: 'java'
apply plugin: 'maven-publish'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
publishing {
publications {
maven(MavenPublication) {
artifactId = 'openapi-java-client'
from components.java
}
}
}
task execute(type:JavaExec) {
main = System.getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath
}
}
ext {
swagger_annotations_version = "1.6.5"
jackson_version = "2.13.4"
jackson_databind_version = "2.13.4.2"
jackson_databind_nullable_version = "0.2.6"
jakarta_annotation_version = "1.3.5"
jersey_version = "2.35"
junit_version = "5.8.2"
}
dependencies {
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation "org.glassfish.jersey.core:jersey-client:$jersey_version"
implementation "org.glassfish.jersey.inject:jersey-hk2:$jersey_version"
implementation "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version"
implementation "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version"
implementation "org.glassfish.jersey.connectors:jersey-apache-connector:$jersey_version"
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
}
test {
useJUnitPlatform()
}
javadoc {
options.tags = [ "http.response.details:a:Http Response Details" ]
}
// Use spotless plugin to automatically format code, remove unused import, etc
// To apply changes directly to the file, run `gradlew spotlessApply`
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
spotless {
// comment out below to run spotless as part of the `check` task
enforceCheck false
format 'misc', {
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to
target '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces() // Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// don't need to set target, it is inferred from java
// apply a specific flavor of google-java-format
googleJavaFormat('1.8').aosp().reflowLongStrings()
removeUnusedImports()
importOrder()
}
}

View File

@@ -1,27 +0,0 @@
lazy val root = (project in file(".")).
settings(
organization := "org.openapitools",
name := "openapi-java-client",
version := "1.0.0",
scalaVersion := "2.11.4",
scalacOptions ++= Seq("-feature"),
Compile / javacOptions ++= Seq("-Xlint:deprecation"),
Compile / packageDoc / publishArtifact := false,
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"com.google.code.findbugs" % "jsr305" % "3.0.0",
"io.swagger" % "swagger-annotations" % "1.6.5",
"org.glassfish.jersey.core" % "jersey-client" % "2.35",
"org.glassfish.jersey.inject" % "jersey-hk2" % "2.35",
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.35",
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.35",
"org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35",
"com.fasterxml.jackson.core" % "jackson-core" % "2.13.2" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.4.1" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.2" % "compile",
"org.openapitools" % "jackson-databind-nullable" % "0.2.6" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test"
)
)

View File

@@ -1,68 +0,0 @@
# DefaultApi
All URIs are relative to *http://api.example.xyz/v1*
| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**callList**](DefaultApi.md#callList) | **GET** /example | |
## callList
> Example callList()
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://api.example.xyz/v1");
DefaultApi apiInstance = new DefaultApi(defaultClient);
try {
Example result = apiInstance.callList();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#callList");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**Example**](Example.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | OK | - |

View File

@@ -1,37 +0,0 @@
# Example
## oneOf schemas
* [List<Integer>](List<Integer>.md)
* [UUID](UUID.md)
## Example
```java
// Import classes:
import org.openapitools.client.model.Example;
import org.openapitools.client.model.List<Integer>;
import org.openapitools.client.model.UUID;
public class Example {
public static void main(String[] args) {
Example exampleExample = new Example();
// create a new List<Integer>
List<Integer> exampleList<Integer> = new List<Integer>();
// set Example to List<Integer>
exampleExample.setActualInstance(exampleList<Integer>);
// to get back the List<Integer> set earlier
List<Integer> testList<Integer> = (List<Integer>) exampleExample.getActualInstance();
// create a new UUID
UUID exampleUUID = new UUID();
// set Example to UUID
exampleExample.setActualInstance(exampleUUID);
// to get back the UUID set earlier
UUID testUUID = (UUID) exampleExample.getActualInstance();
}
}
```

View File

@@ -1,6 +0,0 @@
# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator).
# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option.
#
# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
# For example, uncomment below to build for Android
#target = android

View File

@@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -1,234 +0,0 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

View File

@@ -1,89 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -1,339 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>openapi-java-client</artifactId>
<packaging>jar</packaging>
<name>openapi-java-client</name>
<version>1.0.0</version>
<url>https://github.com/openapitools/openapi-generator</url>
<description>OpenAPI Java</description>
<scm>
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>
<developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection>
<url>https://github.com/openapitools/openapi-generator</url>
</scm>
<licenses>
<license>
<name>Unlicense</name>
<url>http://unlicense.org</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>OpenAPI-Generator Contributors</name>
<email>team@openapitools.org</email>
<organization>OpenAPITools.org</organization>
<organizationUrl>http://openapitools.org</organizationUrl>
</developer>
</developers>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>2.2.0</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<systemPropertyVariables>
<property>
<name>loggerPath</name>
<value>conf/log4j.properties</value>
</property>
</systemPropertyVariables>
<argLine>-Xms512m -Xmx1500m</argLine>
<parallel>methods</parallel>
<threadCount>10</threadCount>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- attach test jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>add_sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add_test_sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
<compilerArgs>
<arg>-Xlint:all</arg>
<arg>-J-Xss4m</arg><!-- Compiling the generated JSON.java file may require larger stack size. -->
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<doclint>none</doclint>
<source>1.8</source>
<tags>
<tag>
<name>http.response.details</name>
<placement>a</placement>
<head>Http Response Details:</head>
</tag>
</tags>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Use spotless plugin to automatically format code, remove unused import, etc
To apply changes directly to the file, run `mvn spotless:apply`
Ref: https://github.com/diffplug/spotless/tree/main/plugin-maven
-->
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.version}</version>
<configuration>
<formats>
<!-- you can define as many formats as you want, each is independent -->
<format>
<!-- define the files to apply to -->
<includes>
<include>.gitignore</include>
</includes>
<!-- define the steps to apply to those files -->
<trimTrailingWhitespace/>
<endWithNewline/>
<indent>
<spaces>true</spaces> <!-- or <tabs>true</tabs> -->
<spacesPerTab>4</spacesPerTab> <!-- optional, default is 4 -->
</indent>
</format>
</formats>
<!-- define a language-specific format -->
<java>
<!-- no need to specify files, inferred automatically, but you can if you want -->
<!-- apply a specific flavor of google-java-format and reflow long strings -->
<googleJavaFormat>
<version>1.8</version>
<style>AOSP</style>
<reflowLongStrings>true</reflowLongStrings>
</googleJavaFormat>
<removeUnusedImports/>
<importOrder/>
</java>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>sign-artifacts</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<!-- @Nullable annotation -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<!-- HTTP client: jersey-client -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey-version}</version>
</dependency>
<!-- JSON processing: jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind-version}</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>${jackson-databind-nullable-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-apache-connector</artifactId>
<version>${jersey-version}</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jersey-version>2.37</jersey-version>
<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>
<junit-version>5.10.0</junit-version>
<spotless.version>2.21.0</spotless.version>
</properties>
</project>

View File

@@ -1 +0,0 @@
rootProject.name = "openapi-java-client"

View File

@@ -1,3 +0,0 @@
<manifest package="org.openapitools.client" xmlns:android="http://schemas.android.com/apk/res/android">
<application />
</manifest>

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