mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-22 09:30:02 +00:00
Compare commits
93 Commits
dependabot
...
jdk21-25
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b240a067d | ||
|
|
b05d7762b5 | ||
|
|
7510ed3d5a | ||
|
|
8786ffcc35 | ||
|
|
d13eecd661 | ||
|
|
e0df52a5d6 | ||
|
|
739d1edd6b | ||
|
|
c073b146d4 | ||
|
|
f9913734fc | ||
|
|
54cedcb0c2 | ||
|
|
4603cc90bf | ||
|
|
8ef4a480cb | ||
|
|
b3244e93bf | ||
|
|
3e0a9f7ace | ||
|
|
276d69075e | ||
|
|
e3826f0491 | ||
|
|
39765e6fca | ||
|
|
5b8d04248e | ||
|
|
c6a3073162 | ||
|
|
fe4dc03504 | ||
|
|
eaa79e29a3 | ||
|
|
274510c6b5 | ||
|
|
1a09c7abd3 | ||
|
|
d8afb229fa | ||
|
|
a2fd144758 | ||
|
|
a04b9a5960 | ||
|
|
1462933d01 | ||
|
|
dc4155051d | ||
|
|
a7eedd9df5 | ||
|
|
44bc527f8b | ||
|
|
067c9b2897 | ||
|
|
0a5f5a87e3 | ||
|
|
325dd614d6 | ||
|
|
6804ceaece | ||
|
|
0d2ff8c69b | ||
|
|
cca5dda026 | ||
|
|
5a168266f8 | ||
|
|
6cf78e789b | ||
|
|
33a4456a05 | ||
|
|
07fa852fe2 | ||
|
|
401ae651ab | ||
|
|
b13e9080af | ||
|
|
5c6ab3eb63 | ||
|
|
3f76a05174 | ||
|
|
5e913233bc | ||
|
|
f151c4640e | ||
|
|
c0a76525c4 | ||
|
|
c08597440e | ||
|
|
99a857fb28 | ||
|
|
2d82875882 | ||
|
|
4d83cfecdf | ||
|
|
054af0e0aa | ||
|
|
1778c1ba4d | ||
|
|
68dc149fa1 | ||
|
|
86b3529f3e | ||
|
|
19f57501fb | ||
|
|
2eaa15a53b | ||
|
|
c7db8cf651 | ||
|
|
94fcce533f | ||
|
|
e0fbba641e | ||
|
|
8b8013dc7c | ||
|
|
cdf22acb54 | ||
|
|
e6304a8db2 | ||
|
|
bbc1cf4c66 | ||
|
|
f255c24480 | ||
|
|
16250e5f09 | ||
|
|
a648392a39 | ||
|
|
50d55f7400 | ||
|
|
5944d8e50e | ||
|
|
b7a6df9ae8 | ||
|
|
c1b0782373 | ||
|
|
7a8903fae6 | ||
|
|
16f5c8b7ac | ||
|
|
87ded7275e | ||
|
|
80d16e7d2a | ||
|
|
df992150f5 | ||
|
|
6e57564d2c | ||
|
|
538587f05c | ||
|
|
80f2d7f74d | ||
|
|
6d335cd96d | ||
|
|
3972c65a2a | ||
|
|
1283d1bf0f | ||
|
|
cbdee19f87 | ||
|
|
0869cad083 | ||
|
|
845386ec9c | ||
|
|
dedd2fc280 | ||
|
|
d9dd07aeac | ||
|
|
d11bc86748 | ||
|
|
3deee65ee4 | ||
|
|
9afa74a3cb | ||
|
|
536016bcb7 | ||
|
|
910caaae92 | ||
|
|
c2c7c34dcb |
6
.github/workflows/docker-release.yml
vendored
6
.github/workflows/docker-release.yml
vendored
@@ -31,11 +31,11 @@ jobs:
|
||||
|
||||
# docker workflow
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
uses: docker/setup-qemu-action@v4
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
uses: docker/setup-buildx-action@v4
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
2
.github/workflows/linux.yaml
vendored
2
.github/workflows/linux.yaml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
java: [11, 17]
|
||||
java: [11, 17, 21, 25]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
- samples/server/petstore/aspnet/fastendpoints-useValidators
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v5.1.0
|
||||
- uses: actions/setup-dotnet@v5.2.0
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Build
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
- samples/client/petstore/csharp/restsharp/standard2.0/Petstore/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v5.1.0
|
||||
- uses: actions/setup-dotnet@v5.2.0
|
||||
with:
|
||||
dotnet-version: '7.0.x'
|
||||
- name: Build
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
# - samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v5.1.0
|
||||
- uses: actions/setup-dotnet@v5.2.0
|
||||
with:
|
||||
dotnet-version: 3.1.*
|
||||
- name: Build
|
||||
|
||||
2
.github/workflows/samples-dotnet10.yaml
vendored
2
.github/workflows/samples-dotnet10.yaml
vendored
@@ -48,7 +48,7 @@ jobs:
|
||||
# - samples/client/petstore/csharp/unityWebRequest/net10/Petstore
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v5.1.0
|
||||
- uses: actions/setup-dotnet@v5.2.0
|
||||
with:
|
||||
dotnet-version: '10.x'
|
||||
- name: Build
|
||||
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
- samples/server/petstore/aspnetcore-6.0-useSwashBuckle
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v5.1.0
|
||||
- uses: actions/setup-dotnet@v5.2.0
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
- name: Build
|
||||
|
||||
2
.github/workflows/samples-dotnet7-client.yml
vendored
2
.github/workflows/samples-dotnet7-client.yml
vendored
@@ -43,7 +43,7 @@ jobs:
|
||||
- samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v5.1.0
|
||||
- uses: actions/setup-dotnet@v5.2.0
|
||||
with:
|
||||
dotnet-version: '7.0.x'
|
||||
- name: Build
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
- samples/client/echo_api/csharp/restsharp/net8/EchoApi
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v5.1.0
|
||||
- uses: actions/setup-dotnet@v5.2.0
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Run echo server
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
- samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v5.1.0
|
||||
- uses: actions/setup-dotnet@v5.2.0
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Build
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
- samples/server/petstore/aspnetcore-8.0-use-centralized-package-version-management
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v5.1.0
|
||||
- uses: actions/setup-dotnet@v5.2.0
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Build
|
||||
|
||||
2
.github/workflows/samples-dotnet8.yaml
vendored
2
.github/workflows/samples-dotnet8.yaml
vendored
@@ -34,7 +34,7 @@ jobs:
|
||||
- samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v5.1.0
|
||||
- uses: actions/setup-dotnet@v5.2.0
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Build
|
||||
|
||||
2
.github/workflows/samples-dotnet9.yaml
vendored
2
.github/workflows/samples-dotnet9.yaml
vendored
@@ -41,7 +41,7 @@ jobs:
|
||||
#- samples/client/petstore/csharp/unityWebRequest/net9/Petstore
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-dotnet@v5.1.0
|
||||
- uses: actions/setup-dotnet@v5.2.0
|
||||
with:
|
||||
dotnet-version: '9.0.x'
|
||||
- name: Build
|
||||
|
||||
@@ -4,6 +4,7 @@ on:
|
||||
push:
|
||||
paths:
|
||||
- samples/client/petstore/java/resttemplate-jakarta/**
|
||||
- samples/client/petstore/java/resttemplate-springBoot4-*/**
|
||||
- samples/client/petstore/java/webclient-jakarta/**
|
||||
- samples/client/petstore/java/restclient-*/**
|
||||
- samples/client/others/java/webclient-sealedInterface/**
|
||||
@@ -13,6 +14,7 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/client/petstore/java/resttemplate-jakarta/**
|
||||
- samples/client/petstore/java/resttemplate-springBoot4-*/**
|
||||
- samples/client/petstore/java/webclient-jakarta/**
|
||||
- samples/client/petstore/java/restclient-*/**
|
||||
- samples/client/others/java/webclient-sealedInterface/**
|
||||
@@ -29,14 +31,19 @@ jobs:
|
||||
sample:
|
||||
# clients
|
||||
- samples/client/petstore/java/resttemplate-jakarta
|
||||
- samples/client/petstore/java/resttemplate-springBoot4-jackson2
|
||||
- samples/client/petstore/java/resttemplate-springBoot4-jackson3
|
||||
- samples/client/petstore/java/webclient-jakarta
|
||||
- samples/client/petstore/java/restclient
|
||||
- samples/client/petstore/java/restclient-nullable-arrays
|
||||
- samples/client/petstore/java/restclient-springBoot4-jackson2
|
||||
- samples/client/petstore/java/restclient-springBoot4-jackson3
|
||||
- samples/client/petstore/java/restclient-swagger2
|
||||
- samples/client/petstore/java/restclient-useSingleRequestParameter
|
||||
- samples/client/petstore/java/restclient-useSingleRequestParameter-static
|
||||
- samples/client/others/java/webclient-sealedInterface
|
||||
- samples/client/others/java/webclient-sealedInterface_3_1
|
||||
- samples/client/petstore/java/webclient-springBoot4-jackson3
|
||||
- samples/client/petstore/java/webclient-useSingleRequestParameter
|
||||
- samples/client/others/java/restclient-enum-in-multipart
|
||||
steps:
|
||||
|
||||
1
.github/workflows/samples-kotlin-client.yaml
vendored
1
.github/workflows/samples-kotlin-client.yaml
vendored
@@ -48,6 +48,7 @@ jobs:
|
||||
- samples/client/petstore/kotlin-default-values-jvm-okhttp4
|
||||
- samples/client/petstore/kotlin-default-values-jvm-retrofit2
|
||||
- samples/client/petstore/kotlin-default-values-multiplatform
|
||||
- samples/client/petstore/kotlin-enum-integers-multiplatform
|
||||
- samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4
|
||||
- samples/client/petstore/kotlin-array-simple-string-multiplatform
|
||||
- samples/client/petstore/kotlin-bigdecimal-default-multiplatform
|
||||
|
||||
@@ -27,7 +27,7 @@ on:
|
||||
# - samples/server/petstore/kotlin-spring-default/**
|
||||
|
||||
env:
|
||||
GRADLE_VERSION: '8.10'
|
||||
GRADLE_VERSION: '8.14'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -48,12 +48,14 @@ jobs:
|
||||
- samples/server/petstore/kotlin-springboot-additionalproperties
|
||||
- samples/server/petstore/kotlin-springboot-delegate-nodefaults
|
||||
- samples/server/petstore/kotlin-springboot-request-cookie
|
||||
- samples/server/petstore/kotlin-springboot-4
|
||||
- samples/server/petstore/kotlin-server/jaxrs-spec
|
||||
- samples/server/petstore/kotlin-server/jaxrs-spec-mutiny
|
||||
- samples/server/petstore/kotlin-server/javalin
|
||||
- samples/server/petstore/kotlin-server/javalin-6
|
||||
- samples/server/petstore/kotlin-server/ktor
|
||||
- samples/server/petstore/kotlin-server/ktor2
|
||||
- samples/server/petstore/kotlin-server-modelMutable
|
||||
- samples/server/petstore/kotlin-misk
|
||||
- samples/server/petstore/kotlin-spring-declarative-interface
|
||||
- samples/server/petstore/kotlin-spring-declarative-interface-reactive-coroutines
|
||||
|
||||
@@ -13,7 +13,7 @@ on:
|
||||
- 'samples/server/petstore/kotlin-server-required-and-nullable-properties/**'
|
||||
|
||||
env:
|
||||
GRADLE_VERSION: '8.10'
|
||||
GRADLE_VERSION: '8.14'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
2
.github/workflows/samples-kotlin-server.yaml
vendored
2
.github/workflows/samples-kotlin-server.yaml
vendored
@@ -42,11 +42,9 @@ jobs:
|
||||
- samples/server/petstore/kotlin-springboot-springfox
|
||||
- samples/server/petstore/kotlin-springboot-x-kotlin-implements
|
||||
- samples/server/petstore/kotlin-springboot-include-http-request-context-delegate
|
||||
- samples/server/petstore/kotlin-server/ktor
|
||||
- samples/server/petstore/kotlin-server/ktor2
|
||||
- samples/server/petstore/kotlin-server/jaxrs-spec
|
||||
- samples/server/petstore/kotlin-server/jaxrs-spec-mutiny
|
||||
- samples/server/petstore/kotlin-server-modelMutable
|
||||
- samples/server/petstore/kotlin-server/javalin
|
||||
- samples/server/others/kotlin-server/jaxrs-spec
|
||||
- samples/server/others/kotlin-server/jaxrs-spec-array-response
|
||||
|
||||
50
.github/workflows/samples-spring-jdk17.yaml
vendored
50
.github/workflows/samples-spring-jdk17.yaml
vendored
@@ -3,32 +3,32 @@ name: Samples Java Spring (JDK17)
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
|
||||
- samples/openapi3/client/petstore/spring-cloud-4-with-optional
|
||||
- samples/client/petstore/spring-http-interface-springboot-4
|
||||
- samples/openapi3/server/petstore/springboot-3
|
||||
- samples/openapi3/server/petstore/springboot-4
|
||||
- samples/server/petstore/springboot-api-response-examples
|
||||
- samples/server/petstore/springboot-lombok-data
|
||||
- samples/server/petstore/springboot-lombok-tostring
|
||||
- samples/server/petstore/springboot-file-delegate-optional
|
||||
- samples/server/petstore/springboot-petstore-with-api-response-examples
|
||||
- samples/server/petstore/spring-boot-oneof-sealed
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof-interface
|
||||
- samples/openapi3/client/petstore/spring-cloud-3-with-optional/**
|
||||
- samples/openapi3/client/petstore/spring-cloud-4-with-optional/**
|
||||
- samples/client/petstore/spring-http-interface-springboot-4/**
|
||||
- samples/openapi3/server/petstore/springboot-3/**
|
||||
- samples/openapi3/server/petstore/springboot-4/**
|
||||
- samples/server/petstore/springboot-api-response-examples/**
|
||||
- samples/server/petstore/springboot-lombok-data/**
|
||||
- samples/server/petstore/springboot-lombok-tostring/**
|
||||
- samples/server/petstore/springboot-file-delegate-optional/**
|
||||
- samples/server/petstore/springboot-petstore-with-api-response-examples/**
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof-sealed/**
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof-interface/**
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
|
||||
- samples/openapi3/client/petstore/spring-cloud-4-with-optional
|
||||
- samples/client/petstore/spring-http-interface-springboot-4
|
||||
- samples/openapi3/server/petstore/springboot-3
|
||||
- samples/openapi3/server/petstore/springboot-4
|
||||
- samples/server/petstore/springboot-api-response-examples
|
||||
- samples/server/petstore/springboot-lombok-data
|
||||
- samples/server/petstore/springboot-lombok-tostring
|
||||
- samples/server/petstore/springboot-file-delegate-optional
|
||||
- samples/server/petstore/springboot-petstore-with-api-response-examples
|
||||
- samples/server/petstore/spring-boot-oneof-sealed
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof-interface
|
||||
- samples/openapi3/client/petstore/spring-cloud-3-with-optional/**
|
||||
- samples/openapi3/client/petstore/spring-cloud-4-with-optional/**
|
||||
- samples/client/petstore/spring-http-interface-springboot-4/**
|
||||
- samples/openapi3/server/petstore/springboot-3/**
|
||||
- samples/openapi3/server/petstore/springboot-4/**
|
||||
- samples/server/petstore/springboot-api-response-examples/**
|
||||
- samples/server/petstore/springboot-lombok-data/**
|
||||
- samples/server/petstore/springboot-lombok-tostring/**
|
||||
- samples/server/petstore/springboot-file-delegate-optional/**
|
||||
- samples/server/petstore/springboot-petstore-with-api-response-examples/**
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof-sealed/**
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof-interface/**
|
||||
jobs:
|
||||
build:
|
||||
name: Build Java Spring (JDK17)
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
- samples/server/petstore/springboot-lombok-tostring
|
||||
- samples/server/petstore/springboot-file-delegate-optional
|
||||
- samples/server/petstore/springboot-petstore-with-api-response-examples
|
||||
- samples/server/petstore/spring-boot-oneof-sealed
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof-sealed
|
||||
- samples/openapi3/server/petstore/spring-boot-oneof-interface
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
@@ -5,6 +5,7 @@ on:
|
||||
paths:
|
||||
- samples/server/petstore/typescript-nestjs-server/**
|
||||
- .github/workflows/samples-typescript-nestjs-server.yaml
|
||||
- .github/workflows/samples-typescript-nestjs-server-parameters.yaml
|
||||
jobs:
|
||||
build:
|
||||
name: Test TypeScript NestJS Server
|
||||
|
||||
@@ -4,6 +4,7 @@ inputSpec: modules/openapi-generator/src/test/resources/2_0/c/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/C-libcurl
|
||||
additionalProperties:
|
||||
useJsonUnformatted: true
|
||||
declareNumberBooleanWithoutPointer: true
|
||||
modelNameMappings:
|
||||
another_model: MappedModel
|
||||
another_property: mappedProperty
|
||||
|
||||
10
bin/configs/java-restclient-springBoot4-jackson2.yaml
Normal file
10
bin/configs/java-restclient-springBoot4-jackson2.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/petstore/java/restclient-springBoot4-jackson2
|
||||
library: restclient
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-addpet-only.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: petstore-restclient
|
||||
hideGenerationTimestamp: "true"
|
||||
containerDefaultToNull: "true"
|
||||
useSpringBoot4: true
|
||||
12
bin/configs/java-restclient-springBoot4-jackson3.yaml
Normal file
12
bin/configs/java-restclient-springBoot4-jackson3.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/petstore/java/restclient-springBoot4-jackson3
|
||||
library: restclient
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-addpet-only.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: petstore-restclient
|
||||
hideGenerationTimestamp: "true"
|
||||
containerDefaultToNull: "true"
|
||||
useSpringBoot4: true
|
||||
useJackson3: true
|
||||
openApiNullable: false
|
||||
12
bin/configs/java-resttemplate-springBoot4-jackson2.yaml
Normal file
12
bin/configs/java-resttemplate-springBoot4-jackson2.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/petstore/java/resttemplate-springBoot4-jackson2
|
||||
library: resttemplate
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-addpet-only.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: petstore-resttemplate
|
||||
hideGenerationTimestamp: "true"
|
||||
containerDefaultToNull: "true"
|
||||
useJakartaEe: true
|
||||
useSpringBoot4: true
|
||||
|
||||
13
bin/configs/java-resttemplate-springBoot4-jackson3.yaml
Normal file
13
bin/configs/java-resttemplate-springBoot4-jackson3.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/petstore/java/resttemplate-springBoot4-jackson3
|
||||
library: resttemplate
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-addpet-only.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: petstore-resttemplate
|
||||
hideGenerationTimestamp: "true"
|
||||
containerDefaultToNull: "true"
|
||||
useJakartaEe: true
|
||||
useSpringBoot4: true
|
||||
useJackson3: true
|
||||
openApiNullable: false
|
||||
12
bin/configs/java-webclient-springBoot4-jackson3.yaml
Normal file
12
bin/configs/java-webclient-springBoot4-jackson3.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/petstore/java/webclient-springBoot4-jackson3
|
||||
library: webclient
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-addpet-only.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: petstore-webclient
|
||||
hideGenerationTimestamp: "true"
|
||||
containerDefaultToNull: "true"
|
||||
useSpringBoot4: true
|
||||
useJackson3: true
|
||||
openApiNullable: false
|
||||
9
bin/configs/kotlin-enum-integers-multiplatform.yaml
Normal file
9
bin/configs/kotlin-enum-integers-multiplatform.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
generatorName: kotlin
|
||||
outputDir: samples/client/petstore/kotlin-enum-integers-multiplatform
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue_21204_enum_integers.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
|
||||
additionalProperties:
|
||||
artifactId: kotlin-enum-integers-multiplatform
|
||||
library: multiplatform
|
||||
dateLibrary: kotlinx-datetime
|
||||
sortParamsByRequiredFlag: false
|
||||
@@ -1,7 +1,8 @@
|
||||
generatorName: kotlin
|
||||
outputDir: samples/client/petstore/kotlin-gson
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
|
||||
additionalProperties:
|
||||
serializationLibrary: gson
|
||||
artifactId: kotlin-petstore-gson
|
||||
companionObject: true
|
||||
|
||||
16
bin/configs/kotlin-spring-boot-4.yaml
Normal file
16
bin/configs/kotlin-spring-boot-4.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
generatorName: kotlin-spring
|
||||
outputDir: samples/server/petstore/kotlin-springboot-4
|
||||
library: spring-boot
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
|
||||
additionalProperties:
|
||||
documentationProvider: none
|
||||
annotationLibrary: none
|
||||
useSwaggerUI: "false"
|
||||
serviceImplementation: "true"
|
||||
serializableModel: "true"
|
||||
beanValidations: "true"
|
||||
useSpringBoot4: "true"
|
||||
useJackson3: "true"
|
||||
requestMappingMode: api_interface
|
||||
gradleBuildFile: "true"
|
||||
@@ -3,6 +3,7 @@ outputDir: samples/server/petstore/springboot-x-implements-skip
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing-x-implements.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
|
||||
additionalProperties:
|
||||
additionalNotNullAnnotations: true
|
||||
documentationProvider: springfox
|
||||
artifactId: springboot
|
||||
snapshotVersion: "true"
|
||||
@@ -12,4 +13,4 @@ additionalProperties:
|
||||
xImplementsSkip: [ com.custompackage.InterfaceToSkip ]
|
||||
schemaImplements:
|
||||
Foo: [ com.custompackage.WithBar, com.custompackage.WithDefaultMethod ]
|
||||
Animal: com.custompackage.WithColor
|
||||
Animal: com.custompackage.WithColor
|
||||
|
||||
6
bin/configs/typescript-nestjs-server-parameters.yaml
Normal file
6
bin/configs/typescript-nestjs-server-parameters.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
generatorName: typescript-nestjs-server
|
||||
outputDir: samples/server/petstore/typescript-nestjs-server/builds/parameters
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/parameter-test-spec.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-nestjs-server
|
||||
additionalProperties:
|
||||
"useSingleRequestParameter" : true
|
||||
@@ -19,6 +19,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|declareNumberBooleanWithoutPointer|Declare number, boolean types without pointer using model-body, model-header templates from OpenAPI Generator v7.20.0.| |false|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|
||||
|
||||
@@ -20,6 +20,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|
||||
|additionalNotNullAnnotations|Add @NotNull to path variables (required by default) and requestBody.| |false|
|
||||
|additionalOneOfTypeAnnotations|Additional annotations for oneOf interfaces(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|annotationLibrary|Select the complementary documentation annotation library.|<dl><dt>**none**</dt><dd>Do not annotate Model and Api with complementary annotations.</dd><dt>**swagger1**</dt><dd>Annotate Model and Api using the Swagger Annotations 1.x library.</dd><dt>**swagger2**</dt><dd>Annotate Model and Api using the Swagger Annotations 2.x library.</dd></dl>|swagger2|
|
||||
|
||||
@@ -64,7 +64,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
|
||||
|invokerPackage|root package for generated code| |org.openapitools.client|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.17.1</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.1.1. JSON processing: Jackson 2.17.1</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 13.2.1. JSON processing: Jackson 2.17.1 or Gson 2.10.1</dd><dt>**feign-hc5**</dt><dd>HTTP client: OpenFeign 13.2.1/HttpClient5 5.4.2. JSON processing: Jackson 2.17.1 or Gson 2.10.1</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1 (Retrofit 2.5.0) or Jackson 2.17.1. Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 5.3.33 (6.1.5 if `useJakartaEe=true`). JSON processing: Jackson 2.17.1</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.1.18. JSON processing: Jackson 2.17.1</dd><dt>**restclient**</dt><dd>HTTP client: Spring RestClient 6.1.6. JSON processing: Jackson 2.17.1</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 4.7.6. JSON processing: Jackson 2.17.1</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.5.2. JSON processing: Jackson 2.17.1</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 2.2.0. JSON processing: Jackson 2.17.1</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured 5.3.2. JSON processing: Gson 2.10.1 or Jackson 2.17.1. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.17.1. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 2.0 (default, set desired version via `microprofileRestClientVersion=x.x.x`). JSON processing: JSON-B 1.0.2 or Jackson 2.17.1</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 5.2.1. JSON processing: Jackson 2.17.1</dd></dl>|okhttp-gson|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.17.1</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.1.1. JSON processing: Jackson 2.17.1</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 13.2.1. JSON processing: Jackson 2.17.1 or Gson 2.10.1</dd><dt>**feign-hc5**</dt><dd>HTTP client: OpenFeign 13.2.1/HttpClient5 5.4.2. JSON processing: Jackson 2.17.1 or Gson 2.10.1</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1 (Retrofit 2.5.0) or Jackson 2.17.1. Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 5.3.33 (6.2.x if `useJakartaEe=true`, 7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.x (3.x if `useJackson3=true`)</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.1.18. JSON processing: Jackson 2.17.1</dd><dt>**restclient**</dt><dd>HTTP client: Spring RestClient 6.1.6. JSON processing: Jackson 2.17.1</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 4.7.6. JSON processing: Jackson 2.17.1</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.5.2. JSON processing: Jackson 2.17.1</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 2.2.0. JSON processing: Jackson 2.17.1</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured 5.3.2. JSON processing: Gson 2.10.1 or Jackson 2.17.1. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.17.1. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 2.0 (default, set desired version via `microprofileRestClientVersion=x.x.x`). JSON processing: JSON-B 1.0.2 or Jackson 2.17.1</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 5.2.1. JSON processing: Jackson 2.17.1</dd></dl>|okhttp-gson|
|
||||
|licenseName|The name of the license| |Unlicense|
|
||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||
|microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null|
|
||||
@@ -97,6 +97,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useBeanValidation|Use BeanValidation API annotations| |false|
|
||||
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
|
||||
|useGzipFeature|Send gzip-encoded requests| |false|
|
||||
|useJackson3|Set it in order to use jackson 3 dependencies (only allowed when `useSpringBoot4` is set and incompatible with `openApiNullable`).| |false|
|
||||
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|
||||
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false|
|
||||
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false|
|
||||
@@ -107,6 +108,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
|
||||
|useSealedOneOfInterfaces|Generate the oneOf interfaces as sealed interfaces. Only supported for WebClient and RestClient.| |false|
|
||||
|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static with single parameter instantiation.| |false|
|
||||
|useSpringBoot4|Generate code and provide dependencies for use with Spring Boot 4.x.| |false|
|
||||
|useUnaryInterceptor|If true it will generate ResponseInterceptors using a UnaryOperator. This can be usefull for manipulating the request before it gets passed, for example doing your own decryption| |false|
|
||||
|webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false|
|
||||
|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false|
|
||||
|
||||
@@ -64,7 +64,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
|
||||
|invokerPackage|root package for generated code| |org.openapitools.client|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.17.1</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.1.1. JSON processing: Jackson 2.17.1</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 13.2.1. JSON processing: Jackson 2.17.1 or Gson 2.10.1</dd><dt>**feign-hc5**</dt><dd>HTTP client: OpenFeign 13.2.1/HttpClient5 5.4.2. JSON processing: Jackson 2.17.1 or Gson 2.10.1</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1 (Retrofit 2.5.0) or Jackson 2.17.1. Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 5.3.33 (6.1.5 if `useJakartaEe=true`). JSON processing: Jackson 2.17.1</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.1.18. JSON processing: Jackson 2.17.1</dd><dt>**restclient**</dt><dd>HTTP client: Spring RestClient 6.1.6. JSON processing: Jackson 2.17.1</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 4.7.6. JSON processing: Jackson 2.17.1</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.5.2. JSON processing: Jackson 2.17.1</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 2.2.0. JSON processing: Jackson 2.17.1</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured 5.3.2. JSON processing: Gson 2.10.1 or Jackson 2.17.1. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.17.1. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 2.0 (default, set desired version via `microprofileRestClientVersion=x.x.x`). JSON processing: JSON-B 1.0.2 or Jackson 2.17.1</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 5.2.1. JSON processing: Jackson 2.17.1</dd></dl>|okhttp-gson|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.17.1</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.1.1. JSON processing: Jackson 2.17.1</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 13.2.1. JSON processing: Jackson 2.17.1 or Gson 2.10.1</dd><dt>**feign-hc5**</dt><dd>HTTP client: OpenFeign 13.2.1/HttpClient5 5.4.2. JSON processing: Jackson 2.17.1 or Gson 2.10.1</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1 (Retrofit 2.5.0) or Jackson 2.17.1. Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 5.3.33 (6.2.x if `useJakartaEe=true`, 7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.x (3.x if `useJackson3=true`)</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.1.18. JSON processing: Jackson 2.17.1</dd><dt>**restclient**</dt><dd>HTTP client: Spring RestClient 6.1.6. JSON processing: Jackson 2.17.1</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 4.7.6. JSON processing: Jackson 2.17.1</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.5.2. JSON processing: Jackson 2.17.1</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 2.2.0. JSON processing: Jackson 2.17.1</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured 5.3.2. JSON processing: Gson 2.10.1 or Jackson 2.17.1. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.17.1. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 2.0 (default, set desired version via `microprofileRestClientVersion=x.x.x`). JSON processing: JSON-B 1.0.2 or Jackson 2.17.1</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 5.2.1. JSON processing: Jackson 2.17.1</dd></dl>|okhttp-gson|
|
||||
|licenseName|The name of the license| |Unlicense|
|
||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||
|microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null|
|
||||
@@ -97,6 +97,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useBeanValidation|Use BeanValidation API annotations| |false|
|
||||
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
|
||||
|useGzipFeature|Send gzip-encoded requests| |false|
|
||||
|useJackson3|Set it in order to use jackson 3 dependencies (only allowed when `useSpringBoot4` is set and incompatible with `openApiNullable`).| |false|
|
||||
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|
||||
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false|
|
||||
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false|
|
||||
@@ -107,6 +108,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
|
||||
|useSealedOneOfInterfaces|Generate the oneOf interfaces as sealed interfaces. Only supported for WebClient and RestClient.| |false|
|
||||
|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static with single parameter instantiation.| |false|
|
||||
|useSpringBoot4|Generate code and provide dependencies for use with Spring Boot 4.x.| |false|
|
||||
|useUnaryInterceptor|If true it will generate ResponseInterceptors using a UnaryOperator. This can be usefull for manipulating the request before it gets passed, for example doing your own decryption| |false|
|
||||
|webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false|
|
||||
|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|autoXSpringPaginated|Automatically add x-spring-paginated to operations that have 'page', 'size', and 'sort' query parameters. When enabled, operations with all three parameters will have Pageable support automatically applied. Operations with x-spring-paginated explicitly set to false will not be auto-detected.| |false|
|
||||
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|
||||
|beanQualifiers|Whether to add fully-qualifier class names as bean qualifiers in @Component and @RestController annotations. May be used to prevent bean names clash if multiple generated libraries (contexts) added to single project.| |false|
|
||||
|companionObject|Whether to generate companion objects in data classes, enabling companion extensions.| |false|
|
||||
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|
||||
|declarativeInterfaceReactiveMode|What type of reactive style to use in Spring Http declarative interface|<dl><dt>**coroutines**</dt><dd>Use kotlin-idiomatic 'suspend' functions</dd><dt>**reactor**</dt><dd>Use reactor return wrappers 'Mono' and 'Flux'</dd></dl>|coroutines|
|
||||
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|
||||
@@ -58,9 +59,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useBeanValidation|Use BeanValidation API annotations to validate data types| |true|
|
||||
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|
||||
|useFlowForArrayReturnType|Whether to use Flow for array/collection return types when reactive is enabled. If false, will use List instead.| |true|
|
||||
|useJackson3|Use Jackson 3 dependencies (tools.jackson package). Only available with `useSpringBoot4`. Defaults to true when `useSpringBoot4` is enabled. Incompatible with `openApiNullable`.| |false|
|
||||
|useResponseEntity|Whether (when false) to return actual type (e.g. List<Fruit>) and handle non-happy path responses via exceptions flow or (when true) return entire ResponseEntity (e.g. ResponseEntity<List<Fruit>>). If disabled, method are annotated using a @ResponseStatus annotation, which has the status of the first response declared in the Api definition| |true|
|
||||
|useSealedResponseInterfaces|Generate sealed interfaces for endpoint responses that all possible response types implement. Allows controllers to return any valid response type in a type-safe manner (e.g., sealed interface CreateUserResponse implemented by User, ConflictResponse, ErrorResponse)| |false|
|
||||
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot ≥ 3 (use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|
||||
|useSpringBoot4|Generate code and provide dependencies for use with Spring Boot 4.x. Enabling this option will also enable `useJakartaEe`.| |false|
|
||||
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|
||||
|useTags|Whether to use tags for creating interface and controller class names| |false|
|
||||
|xKotlinImplementsFieldsSkip|A list of fields per schema name that should NOT be created with `override` keyword despite their presence in vendor extension `x-kotlin-implements-fields` for the schema. Example: yaml `xKotlinImplementsFieldsSkip: Pet: [photoUrls]` skips `override` for `photoUrls` in schema `Pet`| |empty map|
|
||||
|
||||
@@ -23,6 +23,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|Generated artifact id (name of jar).| |kotlin-client|
|
||||
|artifactVersion|Generated artifact's package version.| |1.0.0|
|
||||
|collectionType|Option. Collection type to use|<dl><dt>**array**</dt><dd>kotlin.Array</dd><dt>**list**</dt><dd>kotlin.collections.List</dd></dl>|list|
|
||||
|companionObject|Whether to generate companion objects in data classes, enabling companion extensions.| |false|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**threetenbp-localdatetime**</dt><dd>Threetenbp - Backport of JSR310 (jvm only, for legacy app only)</dd><dt>**kotlinx-datetime**</dt><dd>kotlinx-datetime (preferred for multiplatform)</dd><dt>**string**</dt><dd>String</dd><dt>**java8-localdatetime**</dt><dd>Java 8 native JSR310 (jvm only, for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (jvm only, preferred for jdk 1.8+)</dd><dt>**threetenbp**</dt><dd>Threetenbp - Backport of JSR310 (jvm only, preferred for jdk < 1.8)</dd></dl>|java8|
|
||||
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
|
||||
|explicitApi|Generates code with explicit access modifiers to comply with Kotlin Explicit API Mode.| |false|
|
||||
@@ -49,6 +50,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
|supportAndroidApiLevel25AndBelow|[WARNING] This flag will generate code that has a known security vulnerability. It uses `kotlin.io.createTempFile` instead of `java.nio.file.Files.createTempFile` in order to support Android API level 25 and below. For more info, please check the following links https://github.com/OpenAPITools/openapi-generator/security/advisories/GHSA-23x4-m842-fmwf, https://github.com/OpenAPITools/openapi-generator/pull/9284| |false|
|
||||
|useCoroutines|Whether to use the Coroutines adapter with the retrofit2 library.| |false|
|
||||
|useJackson3|Use Jackson 3 dependencies (tools.jackson package). Not yet supported for kotlin-client; reserved for future use.| |false|
|
||||
|useNonAsciiHeaders|Allow to use non-ascii headers with the okhttp library| |false|
|
||||
|useResponseAsReturnType|When using retrofit2 and coroutines, use `Response`<`T`> as return type instead of `T`.| |true|
|
||||
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library.| |false|
|
||||
|
||||
@@ -20,6 +20,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|
||||
|additionalNotNullAnnotations|Add @NotNull to path variables (required by default) and requestBody.| |false|
|
||||
|additionalOneOfTypeAnnotations|Additional annotations for oneOf interfaces(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|annotationLibrary|Select the complementary documentation annotation library.|<dl><dt>**none**</dt><dd>Do not annotate Model and Api with complementary annotations.</dd><dt>**swagger1**</dt><dd>Annotate Model and Api using the Swagger Annotations 1.x library.</dd><dt>**swagger2**</dt><dd>Annotate Model and Api using the Swagger Annotations 2.x library.</dd></dl>|swagger2|
|
||||
|
||||
@@ -47,6 +47,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|useSquareBracketsInArrayNames|Setting this property to true will add brackets to array attribute names, e.g. my_values[].| |false|
|
||||
|validationAttributes|Setting this property to true will generate the validation attributes of model properties.| |false|
|
||||
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|
||||
|withRequestOptsInInterface|Setting this property to true will include *RequestOpts methods in the API interface declarations. Set to false to keep them only on the class.| |true|
|
||||
|withoutRuntimeChecks|Setting this property to true will remove any runtime checks on the request and response payloads. Payloads will be casted to their expected types.| |false|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
@@ -40,14 +40,14 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|rxjsVersion|The version of RxJS compatible with Angular (see ngVersion option).| |null|
|
||||
|rxjsVersion|The version of RxJS.| |null|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|stringEnums|Generate string enums instead of objects for enum values.| |false|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|taggedUnions|Use discriminators to create tagged unions instead of extending interfaces.| |false|
|
||||
|tsVersion|The version of typescript compatible with Angular (see ngVersion option).| |null|
|
||||
|tsVersion|The version of typescript.| |null|
|
||||
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |false|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
6
flake.lock
generated
6
flake.lock
generated
@@ -20,11 +20,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1737989155,
|
||||
"narHash": "sha256-TFJAGK7tt/jj1v747xNOzopxZ4odBIeDi6EJlYDg/bI=",
|
||||
"lastModified": 1771575107,
|
||||
"narHash": "sha256-RMiV8PRAuFFtJ0l6EZcADdBW1JP+DUIPpDXnMJp0w/k=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5861228f6e9e9dd5d3f8e0a26411f682fdade93a",
|
||||
"rev": "6b0f198fe0363867d9f8cea387a3b9212b468839",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
devShells.default = pkgs.mkShell
|
||||
{
|
||||
buildInputs = with pkgs;[
|
||||
jdk11
|
||||
jdk17
|
||||
maven
|
||||
gradle
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class GenerateTaskConfigurationCacheTest : TestBase() {
|
||||
}
|
||||
|
||||
@DataProvider(name = "gradle_version_provider")
|
||||
private fun gradleVersionProviderWithConfigurationCache(): Array<Array<String>> = arrayOf(arrayOf("8.14.4"), arrayOf("8.5"))
|
||||
private fun gradleVersionProviderWithConfigurationCache(): Array<Array<String>> = arrayOf(arrayOf("8.14.4"), arrayOf("8.14.4"))
|
||||
|
||||
@DataProvider(name = "gradle_version_provider_without_cc")
|
||||
private fun gradleVersionProviderWithoutConfigurationCache(): Array<Array<String>> = arrayOf(arrayOf("5.6.1"))
|
||||
|
||||
@@ -22,7 +22,7 @@ class GenerateTaskFromCacheTest : TestBase() {
|
||||
}
|
||||
|
||||
@DataProvider(name = "gradle_version_provider")
|
||||
private fun gradleVersionProvider(): Array<Array<String>> = arrayOf(arrayOf("8.14.4"), arrayOf("8.5"))
|
||||
private fun gradleVersionProvider(): Array<Array<String>> = arrayOf(arrayOf("8.14.4"), arrayOf("8.14.4"))
|
||||
|
||||
// inputSpec tests
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import kotlin.test.assertEquals
|
||||
class GenerateTaskUpToDateTest : TestBase() {
|
||||
|
||||
@DataProvider(name = "gradle_version_provider")
|
||||
private fun gradleVersionProvider(): Array<Array<String>> = arrayOf(arrayOf("8.14.4"), arrayOf("8.5"))
|
||||
private fun gradleVersionProvider(): Array<Array<String>> = arrayOf(arrayOf("8.14.4"), arrayOf("8.14.4"))
|
||||
|
||||
// inputSpec tests
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class ValidateTaskDslTest : TestBase() {
|
||||
@DataProvider(name = "gradle_version_provider")
|
||||
fun gradleVersionProvider(): Array<Array<String?>> = arrayOf(
|
||||
arrayOf(null), // uses the version of Gradle used to build the plugin itself
|
||||
arrayOf("8.5")
|
||||
arrayOf("8.14.4")
|
||||
)
|
||||
|
||||
private fun getGradleRunner(gradleVersion: String?): GradleRunner {
|
||||
|
||||
@@ -433,7 +433,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<version>${jackson-annotations.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.joschi.jackson</groupId>
|
||||
|
||||
@@ -1769,8 +1769,16 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
innerExample = p.items.defaultValue;
|
||||
}
|
||||
example = "Arrays.asList(" + innerExample + ")";
|
||||
if (p.uniqueItems) {
|
||||
example = "new LinkedHashSet<>(" + example + ")";
|
||||
}
|
||||
} else {
|
||||
example = "Arrays.asList()";
|
||||
if (p.uniqueItems) {
|
||||
example = "new LinkedHashSet<>()";
|
||||
}
|
||||
else {
|
||||
example = "Arrays.asList()";
|
||||
}
|
||||
}
|
||||
} else if (Boolean.TRUE.equals(p.isMap)) {
|
||||
example = "new HashMap()";
|
||||
|
||||
@@ -56,6 +56,10 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
|
||||
public static final String JAVAX_PACKAGE = "javaxPackage";
|
||||
public static final String USE_JAKARTA_EE = "useJakartaEe";
|
||||
public static final String USE_JACKSON_3 = "useJackson3";
|
||||
public static final String JACKSON2_PACKAGE = "com.fasterxml.jackson";
|
||||
public static final String JACKSON3_PACKAGE = "tools.jackson";
|
||||
public static final String JACKSON_PACKAGE = "jacksonPackage";
|
||||
public static final String SCHEMA_IMPLEMENTS = "schemaImplements";
|
||||
public static final String SCHEMA_IMPLEMENTS_FIELDS = "schemaImplementsFields";
|
||||
public static final String X_KOTLIN_IMPLEMENTS_SKIP = "xKotlinImplementsSkip";
|
||||
@@ -80,6 +84,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
protected boolean serializableModel = false;
|
||||
|
||||
@Setter protected boolean useJakartaEe = false;
|
||||
@Getter @Setter protected boolean useJackson3 = false;
|
||||
|
||||
@Setter protected boolean nonPublicApi = false;
|
||||
|
||||
@@ -394,7 +399,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
inner = new StringSchema().description("TODO default missing map inner type to string");
|
||||
p.setAdditionalProperties(inner);
|
||||
}
|
||||
return getSchemaType(target) + "<kotlin.String, " + getTypeDeclaration(inner) + ">";
|
||||
return getSchemaType(target) + "<kotlin.String, " + getItemsTypeDeclaration(inner) + ">";
|
||||
}
|
||||
return super.getTypeDeclaration(target);
|
||||
}
|
||||
@@ -569,6 +574,17 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
} else {
|
||||
applyJavaxPackage();
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(USE_JACKSON_3)) {
|
||||
setUseJackson3(Boolean.parseBoolean(additionalProperties.get(USE_JACKSON_3).toString()));
|
||||
}
|
||||
additionalProperties.put(USE_JACKSON_3, useJackson3);
|
||||
|
||||
if (useJackson3) {
|
||||
applyJackson3Package();
|
||||
} else {
|
||||
applyJackson2Package();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isModelMutable() {
|
||||
@@ -844,6 +860,14 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
writePropertyBack(JAVAX_PACKAGE, "jakarta");
|
||||
}
|
||||
|
||||
protected void applyJackson2Package() {
|
||||
writePropertyBack(JACKSON_PACKAGE, JACKSON2_PACKAGE);
|
||||
}
|
||||
|
||||
protected void applyJackson3Package() {
|
||||
writePropertyBack(JACKSON_PACKAGE, JACKSON3_PACKAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isReservedWord(String word) {
|
||||
// We want case-sensitive escaping, to avoid unnecessary backtick-escaping.
|
||||
|
||||
@@ -41,6 +41,9 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
|
||||
public static final String USE_JSON_UNFORMATTED = "useJsonUnformatted";
|
||||
public static final String USE_JSON_UNFORMATTED_DESC = "Use cJSON_PrintUnformatted instead of cJSON_Print when creating the JSON string.";
|
||||
|
||||
public static final String DECLARE_NUMBER_BOOLEAN_WITHOUT_POINTER = "declareNumberBooleanWithoutPointer";
|
||||
public static final String DECLARE_NUMBER_BOOLEAN_WITHOUT_POINTER_DESC = "Declare number, boolean types without pointer using model-body, model-header templates from OpenAPI Generator v7.20.0.";
|
||||
|
||||
public static final String PROJECT_NAME = "projectName";
|
||||
protected String moduleName;
|
||||
protected String projectName;
|
||||
@@ -270,7 +273,6 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
|
||||
// primitives in C lang
|
||||
languageSpecificPrimitives.add("int");
|
||||
languageSpecificPrimitives.add("short");
|
||||
languageSpecificPrimitives.add("int");
|
||||
languageSpecificPrimitives.add("long");
|
||||
languageSpecificPrimitives.add("float");
|
||||
languageSpecificPrimitives.add("double");
|
||||
@@ -315,6 +317,9 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
|
||||
|
||||
cliOptions.add(new CliOption(USE_JSON_UNFORMATTED, USE_JSON_UNFORMATTED_DESC).
|
||||
defaultValue(Boolean.FALSE.toString()));
|
||||
|
||||
cliOptions.add(new CliOption(DECLARE_NUMBER_BOOLEAN_WITHOUT_POINTER, DECLARE_NUMBER_BOOLEAN_WITHOUT_POINTER_DESC).
|
||||
defaultValue(Boolean.FALSE.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -336,6 +341,16 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
|
||||
additionalProperties.put("cJSONPrint", "cJSON_Print");
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(DECLARE_NUMBER_BOOLEAN_WITHOUT_POINTER)) {
|
||||
if (Boolean.parseBoolean(additionalProperties.get(DECLARE_NUMBER_BOOLEAN_WITHOUT_POINTER).toString())) {
|
||||
modelTemplateFiles.put("model-header-v7_20_0.mustache", ".h");
|
||||
modelTemplateFiles.put("model-body-v7_20_0.mustache", ".c");
|
||||
|
||||
modelTemplateFiles.remove("model-header.mustache");
|
||||
modelTemplateFiles.remove("model-body.mustache");
|
||||
}
|
||||
}
|
||||
|
||||
// make api and model doc path available in mustache template
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
|
||||
@@ -47,6 +47,7 @@ import java.util.regex.Pattern;
|
||||
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
|
||||
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
|
||||
import static java.util.Collections.sort;
|
||||
import static org.openapitools.codegen.CodegenConstants.SERIALIZATION_LIBRARY;
|
||||
import static org.openapitools.codegen.CodegenConstants.X_IMPLEMENTS;
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
@@ -117,6 +118,12 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
public static final String SERIALIZATION_LIBRARY_JACKSON = "jackson";
|
||||
public static final String SERIALIZATION_LIBRARY_JSONB = "jsonb";
|
||||
|
||||
public static final String USE_SPRING_BOOT4 = "useSpringBoot4";
|
||||
public static final String USE_JACKSON_3 = "useJackson3";
|
||||
private static final String JACKSON2_PACKAGE = "com.fasterxml.jackson";
|
||||
private static final String JACKSON3_PACKAGE = "tools.jackson";
|
||||
private static final String JACKSON_PACKAGE = "jacksonPackage";
|
||||
|
||||
public static final String GENERATE_CLIENT_AS_BEAN = "generateClientAsBean";
|
||||
|
||||
protected String gradleWrapperPackage = "gradle.wrapper";
|
||||
@@ -134,7 +141,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
@Setter protected boolean microProfileRegisterExceptionMapper = true;
|
||||
@Setter protected String configKey = null;
|
||||
@Setter(AccessLevel.PRIVATE) protected boolean configKeyFromClassName = false;
|
||||
|
||||
@Setter protected boolean asyncNative = false;
|
||||
@Setter protected boolean parcelableModel = false;
|
||||
@Setter protected boolean performBeanValidation = false;
|
||||
@@ -158,6 +164,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
* Serialization library.
|
||||
*/
|
||||
@Getter protected String serializationLibrary = null;
|
||||
@Getter @Setter protected boolean useSpringBoot4 = false;
|
||||
@Getter @Setter protected boolean useJackson3 = false;
|
||||
@Setter protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
|
||||
protected String rootJavaEEPackage;
|
||||
protected Map<String, MpRestClientVersion> mpRestClientVersions = new LinkedHashMap<>();
|
||||
@@ -272,7 +280,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
supportedLibraries.put(FEIGN_HC5, "HTTP client: OpenFeign 13.2.1/HttpClient5 5.4.2. JSON processing: Jackson 2.17.1 or Gson 2.10.1");
|
||||
supportedLibraries.put(OKHTTP_GSON, "[DEFAULT] HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.");
|
||||
supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1 (Retrofit 2.5.0) or Jackson 2.17.1. Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)");
|
||||
supportedLibraries.put(RESTTEMPLATE, "HTTP client: Spring RestTemplate 5.3.33 (6.1.5 if `useJakartaEe=true`). JSON processing: Jackson 2.17.1");
|
||||
supportedLibraries.put(RESTTEMPLATE, "HTTP client: Spring RestTemplate 5.3.33 (6.2.x if `useJakartaEe=true`, 7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.x (3.x if `useJackson3=true`)");
|
||||
supportedLibraries.put(WEBCLIENT, "HTTP client: Spring WebClient 5.1.18. JSON processing: Jackson 2.17.1");
|
||||
supportedLibraries.put(RESTCLIENT, "HTTP client: Spring RestClient 6.1.6. JSON processing: Jackson 2.17.1");
|
||||
supportedLibraries.put(RESTEASY, "HTTP client: Resteasy client 4.7.6. JSON processing: Jackson 2.17.1");
|
||||
@@ -298,8 +306,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
serializationOptions.put(SERIALIZATION_LIBRARY_JSONB, "Use JSON-B as serialization library");
|
||||
serializationLibrary.setEnum(serializationOptions);
|
||||
cliOptions.add(serializationLibrary);
|
||||
|
||||
// Ensure the OAS 3.x discriminator mappings include any descendent schemas that allOf
|
||||
cliOptions.add(CliOption.newBoolean(USE_SPRING_BOOT4, "Generate code and provide dependencies for use with Spring Boot 4.x.", useSpringBoot4));
|
||||
cliOptions.add(CliOption.newBoolean(USE_JACKSON_3, "Set it in order to use jackson 3 dependencies (only allowed when `" + USE_SPRING_BOOT4 + "` is set and incompatible with `" + OPENAPI_NULLABLE + "`).", useJackson3)); // Ensure the OAS 3.x discriminator mappings include any descendent schemas that allOf
|
||||
// inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values,
|
||||
// and the discriminator mapping schemas in the OAS document.
|
||||
this.setLegacyDiscriminatorBehavior(false);
|
||||
@@ -367,8 +375,29 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
// default jackson unless overridden by setSerializationLibrary
|
||||
this.jackson = !additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY) ||
|
||||
SERIALIZATION_LIBRARY_JACKSON.equals(additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY));
|
||||
|
||||
convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, this::setUseOneOfDiscriminatorLookup);
|
||||
convertPropertyToBooleanAndWriteBack(USE_JACKSON_3, this::setUseJackson3);
|
||||
convertPropertyToBooleanAndWriteBack(USE_SPRING_BOOT4, this::setUseSpringBoot4);
|
||||
if (isUseJackson3() && !isUseSpringBoot4()) {
|
||||
throw new IllegalArgumentException("useJackson3 is only available with Spring Boot >= 4");
|
||||
}
|
||||
if (isUseJackson3() && isOpenApiNullable()) {
|
||||
throw new IllegalArgumentException("openApiNullable cannot be set with useJackson3");
|
||||
}
|
||||
|
||||
if (this.useJackson3) {
|
||||
this.applyJackson3Package();
|
||||
} else {
|
||||
this.applyJackson2Package();
|
||||
}
|
||||
|
||||
if(this.useSpringBoot4) {
|
||||
setUseJakartaEe(true);
|
||||
applyJakartaPackage();
|
||||
}
|
||||
|
||||
// override parent one
|
||||
importMapping.put("JsonDeserialize", (useJackson3 ? JACKSON3_PACKAGE : JACKSON2_PACKAGE) + ".databind.annotation.JsonDeserialize");
|
||||
|
||||
// RxJava
|
||||
if (additionalProperties.containsKey(USE_RX_JAVA2) && additionalProperties.containsKey(USE_RX_JAVA3)) {
|
||||
@@ -790,8 +819,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
additionalProperties.remove(SERIALIZATION_LIBRARY_GSON);
|
||||
additionalProperties.remove(SERIALIZATION_LIBRARY_JSONB);
|
||||
supportingFiles.add(new SupportingFile("RFC3339DateFormat.mustache", invokerFolder, "RFC3339DateFormat.java"));
|
||||
supportingFiles.add(new SupportingFile("RFC3339InstantDeserializer.mustache", invokerFolder, "RFC3339InstantDeserializer.java"));
|
||||
supportingFiles.add(new SupportingFile("RFC3339JavaTimeModule.mustache", invokerFolder, "RFC3339JavaTimeModule.java"));
|
||||
if (!useJackson3) {
|
||||
supportingFiles.add(new SupportingFile("RFC3339InstantDeserializer.mustache", invokerFolder, "RFC3339InstantDeserializer.java"));
|
||||
supportingFiles.add(new SupportingFile("RFC3339JavaTimeModule.mustache", invokerFolder, "RFC3339JavaTimeModule.java"));
|
||||
}
|
||||
break;
|
||||
case SERIALIZATION_LIBRARY_GSON:
|
||||
additionalProperties.put(SERIALIZATION_LIBRARY_GSON, "true");
|
||||
@@ -809,7 +840,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
additionalProperties.remove(SERIALIZATION_LIBRARY_JSONB);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (isLibrary(FEIGN)) {
|
||||
additionalProperties.put("feign-okhttp", "true");
|
||||
} else if (isLibrary(FEIGN_HC5)) {
|
||||
@@ -1028,6 +1059,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
@Override
|
||||
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
||||
super.postProcessModelProperty(model, property);
|
||||
|
||||
if (!model.isEnum) {
|
||||
//Needed imports for Jackson based libraries
|
||||
if (additionalProperties.containsKey(SERIALIZATION_LIBRARY_JACKSON)) {
|
||||
@@ -1241,6 +1273,14 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
this.caseInsensitiveResponseHeaders = caseInsensitiveResponseHeaders;
|
||||
}
|
||||
|
||||
protected void applyJackson2Package() {
|
||||
writePropertyBack(JACKSON_PACKAGE, JACKSON2_PACKAGE);
|
||||
}
|
||||
|
||||
protected void applyJackson3Package() {
|
||||
writePropertyBack(JACKSON_PACKAGE, JACKSON3_PACKAGE);
|
||||
}
|
||||
|
||||
public void setSerializationLibrary(String serializationLibrary) {
|
||||
if (SERIALIZATION_LIBRARY_JACKSON.equalsIgnoreCase(serializationLibrary)) {
|
||||
this.serializationLibrary = SERIALIZATION_LIBRARY_JACKSON;
|
||||
@@ -1281,7 +1321,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
|
||||
@Override
|
||||
public void addImportsToOneOfInterface(List<Map<String, String>> imports) {
|
||||
if(additionalProperties.containsKey(SERIALIZATION_LIBRARY_JACKSON)) {
|
||||
if (additionalProperties.containsKey(SERIALIZATION_LIBRARY_JACKSON)) {
|
||||
for (String i : Arrays.asList("JsonSubTypes", "JsonTypeInfo", "JsonIgnoreProperties")) {
|
||||
Map<String, String> oneImport = new HashMap<>();
|
||||
oneImport.put("import", importMapping.get(i));
|
||||
|
||||
@@ -106,6 +106,8 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
|
||||
public static final String GENERATE_ONEOF_ANYOF_WRAPPERS = "generateOneOfAnyOfWrappers";
|
||||
|
||||
public static final String COMPANION_OBJECT = "companionObject";
|
||||
|
||||
protected static final String VENDOR_EXTENSION_BASE_NAME_LITERAL = "x-base-name-literal";
|
||||
|
||||
|
||||
@@ -123,6 +125,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
@Setter protected boolean mapFileBinaryToByteArray = false;
|
||||
@Setter protected boolean generateOneOfAnyOfWrappers = true;
|
||||
@Getter @Setter protected boolean failOnUnknownProperties = false;
|
||||
@Setter protected boolean companionObject = false;
|
||||
|
||||
protected String authFolder;
|
||||
|
||||
@@ -288,11 +291,16 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(GENERATE_ONEOF_ANYOF_WRAPPERS, "Generate oneOf, anyOf schemas as wrappers. Only `jvm-retrofit2`(library) with `gson` or `kotlinx_serialization`(serializationLibrary) support this option."));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(COMPANION_OBJECT, "Whether to generate companion objects in data classes, enabling companion extensions.", false));
|
||||
|
||||
CliOption serializationLibraryOpt = new CliOption(CodegenConstants.SERIALIZATION_LIBRARY, SERIALIZATION_LIBRARY_DESC);
|
||||
cliOptions.add(serializationLibraryOpt.defaultValue(serializationLibrary.name()));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_NON_ASCII_HEADERS, "Allow to use non-ascii headers with the okhttp library"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_RESPONSE_AS_RETURN_TYPE, "When using retrofit2 and coroutines, use `Response`<`T`> as return type instead of `T`.", true));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_JACKSON_3,
|
||||
"Use Jackson 3 dependencies (tools.jackson package). Not yet supported for kotlin-client; reserved for future use."));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -322,6 +330,10 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
return generateOneOfAnyOfWrappers;
|
||||
}
|
||||
|
||||
public boolean getCompanionObject() {
|
||||
return companionObject;
|
||||
}
|
||||
|
||||
public void setGenerateRoomModels(Boolean generateRoomModels) {
|
||||
this.generateRoomModels = generateRoomModels;
|
||||
}
|
||||
@@ -457,6 +469,11 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
convertPropertyToBooleanAndWriteBack(USE_SPRING_BOOT3);
|
||||
}
|
||||
|
||||
if (isUseJackson3()) {
|
||||
throw new IllegalArgumentException(
|
||||
"useJackson3 is not yet supported for kotlin-client. Jackson 3 support for kotlin-client will be added in a future release.");
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY)) {
|
||||
setSerializationLibrary((String) additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY));
|
||||
additionalProperties.put(this.serializationLibrary.name(), true);
|
||||
@@ -484,6 +501,12 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
setFailOnUnknownProperties(false);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(COMPANION_OBJECT)) {
|
||||
setCompanionObject(convertPropertyToBooleanAndWriteBack(COMPANION_OBJECT));
|
||||
} else {
|
||||
additionalProperties.put(COMPANION_OBJECT, companionObject);
|
||||
}
|
||||
|
||||
commonSupportingFiles();
|
||||
|
||||
switch (getLibrary()) {
|
||||
@@ -936,7 +959,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
|
||||
for (ModelMap mo : objects.getModels()) {
|
||||
CodegenModel cm = mo.getModel();
|
||||
if (getGenerateRoomModels() || getGenerateOneOfAnyOfWrappers()) {
|
||||
if (getGenerateRoomModels() || getGenerateOneOfAnyOfWrappers() || getCompanionObject()) {
|
||||
cm.vendorExtensions.put("x-has-data-class-body", true);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
public static final String DECLARATIVE_INTERFACE_REACTIVE_MODE = "declarativeInterfaceReactiveMode";
|
||||
|
||||
public static final String USE_SPRING_BOOT3 = "useSpringBoot3";
|
||||
public static final String USE_SPRING_BOOT4 = "useSpringBoot4";
|
||||
public static final String INCLUDE_HTTP_REQUEST_CONTEXT = "includeHttpRequestContext";
|
||||
public static final String USE_FLOW_FOR_ARRAY_RETURN_TYPE = "useFlowForArrayReturnType";
|
||||
public static final String REQUEST_MAPPING_OPTION = "requestMappingMode";
|
||||
@@ -98,6 +99,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
public static final String USE_REQUEST_MAPPING_ON_INTERFACE = "useRequestMappingOnInterface";
|
||||
public static final String AUTO_X_SPRING_PAGINATED = "autoXSpringPaginated";
|
||||
public static final String USE_SEALED_RESPONSE_INTERFACES = "useSealedResponseInterfaces";
|
||||
public static final String COMPANION_OBJECT = "companionObject";
|
||||
|
||||
@Getter
|
||||
public enum DeclarativeInterfaceReactiveMode {
|
||||
@@ -163,9 +165,12 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
@Setter private boolean useResponseEntity = true;
|
||||
@Setter private boolean autoXSpringPaginated = false;
|
||||
@Setter private boolean useSealedResponseInterfaces = false;
|
||||
@Setter private boolean companionObject = false;
|
||||
|
||||
@Getter @Setter
|
||||
protected boolean useSpringBoot3 = false;
|
||||
@Getter @Setter
|
||||
protected boolean useSpringBoot4 = false;
|
||||
protected RequestMappingMode requestMappingMode = RequestMappingMode.controller;
|
||||
private DocumentationProvider documentationProvider;
|
||||
private AnnotationLibrary annotationLibrary;
|
||||
@@ -252,6 +257,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
"@RestController annotations. May be used to prevent bean names clash if multiple generated libraries" +
|
||||
" (contexts) added to single project.", beanQualifiers);
|
||||
addSwitch(USE_SPRING_BOOT3, "Generate code and provide dependencies for use with Spring Boot ≥ 3 (use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.", useSpringBoot3);
|
||||
addSwitch(USE_SPRING_BOOT4, "Generate code and provide dependencies for use with Spring Boot 4.x. Enabling this option will also enable `useJakartaEe`.", useSpringBoot4);
|
||||
addSwitch(USE_JACKSON_3, "Use Jackson 3 dependencies (tools.jackson package). Only available with `useSpringBoot4`. Defaults to true when `useSpringBoot4` is enabled. Incompatible with `openApiNullable`.", useJackson3);
|
||||
addSwitch(USE_FLOW_FOR_ARRAY_RETURN_TYPE, "Whether to use Flow for array/collection return types when reactive is enabled. If false, will use List instead.", useFlowForArrayReturnType);
|
||||
addSwitch(INCLUDE_HTTP_REQUEST_CONTEXT, "Whether to include HttpServletRequest (blocking) or ServerWebExchange (reactive) as additional parameter in generated methods.", includeHttpRequestContext);
|
||||
addSwitch(USE_RESPONSE_ENTITY,
|
||||
@@ -265,6 +272,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
addOption(SCHEMA_IMPLEMENTS, "A map of single interface or a list of interfaces per schema name that should be implemented (serves similar purpose as `x-kotlin-implements`, but is fully decoupled from the api spec). Example: yaml `schemaImplements: {Pet: com.some.pack.WithId, Category: [com.some.pack.CategoryInterface], Dog: [com.some.pack.Canine, com.some.pack.OtherInterface]}` implements interfaces in schemas `Pet` (interface `com.some.pack.WithId`), `Category` (interface `com.some.pack.CategoryInterface`), `Dog`(interfaces `com.some.pack.Canine`, `com.some.pack.OtherInterface`)", "empty map");
|
||||
addOption(SCHEMA_IMPLEMENTS_FIELDS, "A map of single field or a list of fields per schema name that should be prepended with `override` (serves similar purpose as `x-kotlin-implements-fields`, but is fully decoupled from the api spec). Example: yaml `schemaImplementsFields: {Pet: id, Category: [name, id], Dog: [bark, breed]}` marks fields to be prepended with `override` in schemas `Pet` (field `id`), `Category` (fields `name`, `id`) and `Dog` (fields `bark`, `breed`)", "empty map");
|
||||
addSwitch(AUTO_X_SPRING_PAGINATED, "Automatically add x-spring-paginated to operations that have 'page', 'size', and 'sort' query parameters. When enabled, operations with all three parameters will have Pageable support automatically applied. Operations with x-spring-paginated explicitly set to false will not be auto-detected.", autoXSpringPaginated);
|
||||
addSwitch(COMPANION_OBJECT, "Whether to generate companion objects in data classes, enabling companion extensions.", companionObject);
|
||||
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
|
||||
supportedLibraries.put(SPRING_CLOUD_LIBRARY,
|
||||
"Spring-Cloud-Feign client with Spring-Boot auto-configured settings.");
|
||||
@@ -416,6 +424,13 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
boolean springBoot4Enabled = useSpringBoot4
|
||||
|| (additionalProperties.containsKey(USE_SPRING_BOOT4)
|
||||
&& convertPropertyToBoolean(USE_SPRING_BOOT4));
|
||||
if (springBoot4Enabled) {
|
||||
additionalProperties.put(USE_JACKSON_3, "true");
|
||||
}
|
||||
|
||||
super.processOpts();
|
||||
|
||||
if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) {
|
||||
@@ -464,6 +479,9 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
if (additionalProperties.containsKey(USE_SPRING_BOOT3)) {
|
||||
this.setUseSpringBoot3(convertPropertyToBoolean(USE_SPRING_BOOT3));
|
||||
}
|
||||
if (additionalProperties.containsKey(USE_SPRING_BOOT4)) {
|
||||
this.setUseSpringBoot4(convertPropertyToBoolean(USE_SPRING_BOOT4));
|
||||
}
|
||||
if (additionalProperties.containsKey(INCLUDE_HTTP_REQUEST_CONTEXT)) {
|
||||
this.setIncludeHttpRequestContext(convertPropertyToBoolean(INCLUDE_HTTP_REQUEST_CONTEXT));
|
||||
}
|
||||
@@ -490,6 +508,11 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
// used later in recursive import in postProcessingModels
|
||||
importMapping.put("com.fasterxml.jackson.annotation.JsonProperty", "com.fasterxml.jackson.annotation.JsonCreator");
|
||||
|
||||
if (isUseJackson3()) {
|
||||
// Override databind imports for Jackson 3
|
||||
importMapping.put("JsonDeserialize", "tools.jackson.databind.annotation.JsonDeserialize");
|
||||
}
|
||||
|
||||
// Spring-specific import mappings for x-spring-paginated support
|
||||
importMapping.put("ApiIgnore", "springfox.documentation.annotations.ApiIgnore");
|
||||
importMapping.put("ParameterObject", "org.springdoc.api.annotations.ParameterObject");
|
||||
@@ -512,6 +535,12 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
}
|
||||
writePropertyBack(USE_SEALED_RESPONSE_INTERFACES, useSealedResponseInterfaces);
|
||||
|
||||
if (additionalProperties.containsKey(COMPANION_OBJECT)) {
|
||||
this.setCompanionObject(convertPropertyToBooleanAndWriteBack(COMPANION_OBJECT));
|
||||
} else {
|
||||
additionalProperties.put(COMPANION_OBJECT, companionObject);
|
||||
}
|
||||
|
||||
additionalProperties.put("springHttpStatus", new SpringHttpStatusLambda());
|
||||
|
||||
// Set basePackage from invokerPackage
|
||||
@@ -625,7 +654,9 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
}
|
||||
}
|
||||
if (SPRING_DECLARATIVE_HTTP_INTERFACE_LIBRARY.equals(library)) {
|
||||
this.setUseSpringBoot3(true);
|
||||
if (!isUseSpringBoot4()) {
|
||||
this.setUseSpringBoot3(true);
|
||||
}
|
||||
this.setInterfaceOnly(true);
|
||||
this.setUseFeignClient(false);
|
||||
this.setSkipDefaultInterface(true);
|
||||
@@ -680,7 +711,20 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
this.setAutoXSpringPaginated(convertPropertyToBoolean(AUTO_X_SPRING_PAGINATED));
|
||||
}
|
||||
writePropertyBack(AUTO_X_SPRING_PAGINATED, autoXSpringPaginated);
|
||||
if (isUseSpringBoot3()) {
|
||||
if (isUseSpringBoot3() && isUseSpringBoot4()) {
|
||||
throw new IllegalArgumentException("Choose between Spring Boot 3 and Spring Boot 4");
|
||||
}
|
||||
|
||||
if (isUseJackson3() && !isUseSpringBoot4()) {
|
||||
throw new IllegalArgumentException("useJackson3 is only available with Spring Boot >= 4");
|
||||
}
|
||||
|
||||
if (isUseJackson3() && additionalProperties.containsKey("openApiNullable")
|
||||
&& Boolean.parseBoolean(additionalProperties.get("openApiNullable").toString())) {
|
||||
throw new IllegalArgumentException("openApiNullable cannot be set with useJackson3");
|
||||
}
|
||||
|
||||
if (isUseSpringBoot3() || isUseSpringBoot4()) {
|
||||
if (DocumentationProvider.SPRINGFOX.equals(getDocumentationProvider())) {
|
||||
throw new IllegalArgumentException(DocumentationProvider.SPRINGFOX.getPropertyName() + " is not supported with Spring Boot > 3.x");
|
||||
}
|
||||
@@ -692,6 +736,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
applyJakartaPackage();
|
||||
}
|
||||
writePropertyBack(USE_SPRING_BOOT3, isUseSpringBoot3());
|
||||
writePropertyBack(USE_SPRING_BOOT4, isUseSpringBoot4());
|
||||
|
||||
modelTemplateFiles.put("model.mustache", ".kt");
|
||||
|
||||
@@ -733,14 +778,18 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
supportingFiles.add(new SupportingFile("apiUtil.mustache",
|
||||
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiUtil.kt"));
|
||||
|
||||
if (isUseSpringBoot3()) {
|
||||
if (isUseSpringBoot4()) {
|
||||
supportingFiles.add(new SupportingFile("pom-sb4.mustache", "", "pom.xml"));
|
||||
} else if (isUseSpringBoot3()) {
|
||||
supportingFiles.add(new SupportingFile("pom-sb3.mustache", "", "pom.xml"));
|
||||
} else {
|
||||
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||
}
|
||||
|
||||
if (this.gradleBuildFile) {
|
||||
if (isUseSpringBoot3()) {
|
||||
if (isUseSpringBoot4()) {
|
||||
supportingFiles.add(new SupportingFile("buildGradle-sb4-Kts.mustache", "", "build.gradle.kts"));
|
||||
} else if (isUseSpringBoot3()) {
|
||||
supportingFiles.add(new SupportingFile("buildGradle-sb3-Kts.mustache", "", "build.gradle.kts"));
|
||||
} else {
|
||||
supportingFiles.add(new SupportingFile("buildGradleKts.mustache", "", "build.gradle.kts"));
|
||||
@@ -779,14 +828,18 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
if (library.equals(SPRING_CLOUD_LIBRARY)) {
|
||||
LOGGER.info("Setup code generator for Kotlin Spring Cloud Client");
|
||||
|
||||
if (isUseSpringBoot3()) {
|
||||
if (isUseSpringBoot4()) {
|
||||
supportingFiles.add(new SupportingFile("pom-sb4.mustache", "pom.xml"));
|
||||
} else if (isUseSpringBoot3()) {
|
||||
supportingFiles.add(new SupportingFile("pom-sb3.mustache", "pom.xml"));
|
||||
} else {
|
||||
supportingFiles.add(new SupportingFile("pom.mustache", "pom.xml"));
|
||||
}
|
||||
|
||||
if (this.gradleBuildFile) {
|
||||
if (isUseSpringBoot3()) {
|
||||
if (isUseSpringBoot4()) {
|
||||
supportingFiles.add(new SupportingFile("buildGradle-sb4-Kts.mustache", "build.gradle.kts"));
|
||||
} else if (isUseSpringBoot3()) {
|
||||
supportingFiles.add(new SupportingFile("buildGradle-sb3-Kts.mustache", "build.gradle.kts"));
|
||||
} else {
|
||||
supportingFiles.add(new SupportingFile("buildGradleKts.mustache", "build.gradle.kts"));
|
||||
@@ -818,10 +871,18 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
if (library.equals(SPRING_DECLARATIVE_HTTP_INTERFACE_LIBRARY)) {
|
||||
LOGGER.info("Setup code generator for Kotlin Spring Declarative Http interface");
|
||||
|
||||
supportingFiles.add(new SupportingFile("pom-sb3.mustache", "pom.xml"));
|
||||
if (isUseSpringBoot4()) {
|
||||
supportingFiles.add(new SupportingFile("pom-sb4.mustache", "pom.xml"));
|
||||
} else {
|
||||
supportingFiles.add(new SupportingFile("pom-sb3.mustache", "pom.xml"));
|
||||
}
|
||||
|
||||
if (this.gradleBuildFile) {
|
||||
supportingFiles.add(new SupportingFile("buildGradle-sb3-Kts.mustache", "build.gradle.kts"));
|
||||
if (isUseSpringBoot4()) {
|
||||
supportingFiles.add(new SupportingFile("buildGradle-sb4-Kts.mustache", "build.gradle.kts"));
|
||||
} else {
|
||||
supportingFiles.add(new SupportingFile("buildGradle-sb3-Kts.mustache", "build.gradle.kts"));
|
||||
}
|
||||
supportingFiles.add(new SupportingFile("settingsGradle.mustache", "settings.gradle"));
|
||||
|
||||
String gradleWrapperPackage = "gradle.wrapper";
|
||||
|
||||
@@ -295,7 +295,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
// for Faraday
|
||||
additionalProperties.put("isHttpx", Boolean.TRUE);
|
||||
} else {
|
||||
throw new RuntimeException("Invalid HTTP library " + getLibrary() + ". Only faraday, typhoeus and httpx are supported.");
|
||||
throw new IllegalArgumentException("Invalid HTTP library " + getLibrary() + ". Only faraday, typhoeus and httpx are supported.");
|
||||
}
|
||||
|
||||
// test files should not be overwritten
|
||||
@@ -469,11 +469,11 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
public String toApiFilename(final String name) {
|
||||
// replace - with _ e.g. created-at => created_at
|
||||
String filename = name;
|
||||
if (apiNameSuffix != null && apiNameSuffix.length() > 0) {
|
||||
if (apiNameSuffix != null && !apiNameSuffix.isEmpty()) {
|
||||
filename = filename + "_" + apiNameSuffix;
|
||||
}
|
||||
|
||||
filename = filename.replaceAll("-", "_");
|
||||
filename = filename.replace("-", "_");
|
||||
|
||||
// e.g. PhoneNumberApi.rb => phone_number_api.rb
|
||||
return underscore(filename);
|
||||
@@ -494,11 +494,6 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
return toModelFilename(name) + "_spec";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiName(String name) {
|
||||
return super.toApiName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("Integer".equals(datatype) || "Float".equals(datatype)) {
|
||||
@@ -514,16 +509,16 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
return enumNameMapping.get(name);
|
||||
}
|
||||
|
||||
if (name.length() == 0) {
|
||||
if (name.isEmpty()) {
|
||||
return "EMPTY";
|
||||
}
|
||||
|
||||
// number
|
||||
if ("Integer".equals(datatype) || "Float".equals(datatype)) {
|
||||
String varName = name;
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
varName = varName.replaceAll("\\+", "PLUS_");
|
||||
varName = varName.replaceAll("\\.", "_DOT_");
|
||||
varName = varName.replace("-", "MINUS_");
|
||||
varName = varName.replace("+", "PLUS_");
|
||||
varName = varName.replace(".", "_DOT_");
|
||||
return NUMERIC_ENUM_PREFIX + varName;
|
||||
}
|
||||
|
||||
@@ -594,7 +589,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
|
||||
@Override
|
||||
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
|
||||
final Schema additionalProperties = ModelUtils.getAdditionalProperties(schema);
|
||||
final Schema<?> additionalProperties = ModelUtils.getAdditionalProperties(schema);
|
||||
|
||||
if (additionalProperties != null) {
|
||||
codegenModel.additionalPropertiesType = getSchemaType(additionalProperties);
|
||||
@@ -692,7 +687,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
if (modelMaps.containsKey(codegenParameter.dataType)) {
|
||||
return constructExampleCode(modelMaps.get(codegenParameter.dataType), modelMaps, processedModelMap);
|
||||
} else {
|
||||
//LOGGER.error("Error in constructing examples. Failed to look up the model " + codegenParameter.dataType);
|
||||
LOGGER.debug("Error in constructing examples. Failed to look up the model " + codegenParameter.dataType);
|
||||
return "TODO";
|
||||
}
|
||||
}
|
||||
@@ -702,8 +697,8 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
if (codegenProperty.isArray) { // array
|
||||
if (!StringUtils.isEmpty(codegenProperty.example) && !"null".equals(codegenProperty.example)) {
|
||||
String value = codegenProperty.example;
|
||||
value = value.replaceAll(",", ", ");
|
||||
value = value.replaceAll(":", ": ");
|
||||
value = value.replace(",", ", ");
|
||||
value = value.replace(":", ": ");
|
||||
return value;
|
||||
}
|
||||
return "[" + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "]";
|
||||
@@ -764,7 +759,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
if (modelMaps.containsKey(codegenProperty.dataType)) {
|
||||
return constructExampleCode(modelMaps.get(codegenProperty.dataType), modelMaps, processedModelMap);
|
||||
} else {
|
||||
//LOGGER.error("Error in constructing examples. Failed to look up the model " + codegenParameter.dataType);
|
||||
LOGGER.debug("Error in constructing examples. Failed to look up the model " + codegenProperty.dataType);
|
||||
return "TODO";
|
||||
}
|
||||
}
|
||||
@@ -791,7 +786,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
// oneOf models
|
||||
return constructExampleCode(modelMaps.get(subModel), modelMaps, processedModelMap);
|
||||
} else {
|
||||
// TODO oneOf primitive type not supported at the moment
|
||||
// oneOf primitive type not supported at the moment
|
||||
LOGGER.warn("oneOf example value not supported at the moment.");
|
||||
return "nil";
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
public static final String JACKSON2_PACKAGE = "com.fasterxml.jackson";
|
||||
public static final String JACKSON3_PACKAGE = "tools.jackson";
|
||||
public static final String JACKSON_PACKAGE = "jacksonPackage";
|
||||
public static final String ADDITIONAL_NOT_NULL_ANNOTATIONS = "additionalNotNullAnnotations";
|
||||
|
||||
@Getter
|
||||
public enum RequestMappingMode {
|
||||
@@ -180,6 +181,8 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
protected boolean useDeductionForOneOfInterfaces = false;
|
||||
@Getter @Setter
|
||||
protected boolean useJackson3 = false;
|
||||
@Getter @Setter
|
||||
protected boolean additionalNotNullAnnotations = false;
|
||||
|
||||
public SpringCodegen() {
|
||||
super();
|
||||
@@ -269,7 +272,6 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
cliOptions.add(CliOption.newString(X_IMPLEMENTS_SKIP, "Ability to choose interfaces that should NOT be implemented in the models despite their presence in vendor extension `x-implements`. Takes a list of fully qualified interface names. Example: yaml `xImplementsSkip: [com.some.pack.WithPhotoUrls]` skips implementing the interface `com.some.pack.WithPhotoUrls` in any schema", "empty list"));
|
||||
cliOptions.add(CliOption.newString(SCHEMA_IMPLEMENTS, "Ability to supply interfaces per schema that should be implemented (serves similar purpose as vendor extension `x-implements`, but is fully decoupled from the api spec). Example: yaml `schemaImplements: {Pet: com.some.pack.WithId, Category: [com.some.pack.CategoryInterface], Dog: [com.some.pack.Canine, com.some.pack.OtherInterface]}` implements interfaces in schemas `Pet` (interface `com.some.pack.WithId`), `Category` (interface `com.some.pack.CategoryInterface`), `Dog`(interfaces `com.some.pack.Canine`, `com.some.pack.OtherInterface`)", "empty map"));
|
||||
|
||||
|
||||
CliOption requestMappingOpt = new CliOption(REQUEST_MAPPING_OPTION,
|
||||
"Where to generate the class level @RequestMapping annotation.")
|
||||
.defaultValue(requestMappingMode.name());
|
||||
@@ -325,6 +327,10 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
library.setEnum(supportedLibraries);
|
||||
cliOptions.add(library);
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(ADDITIONAL_NOT_NULL_ANNOTATIONS,
|
||||
"Add @NotNull to path variables (required by default) and requestBody.",
|
||||
additionalNotNullAnnotations));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -408,6 +414,12 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
super.processOpts();
|
||||
|
||||
if (SPRING_HTTP_INTERFACE.equals(library)) {
|
||||
if (documentationProvider != null) {
|
||||
additionalProperties.remove(documentationProvider.getPropertyName());
|
||||
}
|
||||
if (annotationLibrary != null) {
|
||||
additionalProperties.remove(annotationLibrary.getPropertyName());
|
||||
}
|
||||
documentationProvider = DocumentationProvider.NONE;
|
||||
annotationLibrary = AnnotationLibrary.NONE;
|
||||
useJakartaEe = true;
|
||||
@@ -485,7 +497,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
convertPropertyToBooleanAndWriteBack(RETURN_SUCCESS_CODE, this::setReturnSuccessCode);
|
||||
convertPropertyToBooleanAndWriteBack(USE_SWAGGER_UI, this::setUseSwaggerUI);
|
||||
convertPropertyToBooleanAndWriteBack(USE_SEALED, this::setUseSealed);
|
||||
if (getDocumentationProvider().equals(DocumentationProvider.NONE)) {
|
||||
if (DocumentationProvider.NONE.equals(getDocumentationProvider())) {
|
||||
this.setUseSwaggerUI(false);
|
||||
}
|
||||
|
||||
@@ -532,6 +544,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
}
|
||||
convertPropertyToStringAndWriteBack(RESOURCE_FOLDER, this::setResourceFolder);
|
||||
|
||||
convertPropertyToBooleanAndWriteBack(ADDITIONAL_NOT_NULL_ANNOTATIONS, this::setAdditionalNotNullAnnotations);
|
||||
|
||||
// override parent one
|
||||
importMapping.put("JsonDeserialize", (useJackson3 ? JACKSON3_PACKAGE : JACKSON2_PACKAGE) + ".databind.annotation.JsonDeserialize");
|
||||
@@ -1286,7 +1299,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
return extensions;
|
||||
}
|
||||
|
||||
private boolean isSpringCodegen() {
|
||||
protected boolean isSpringCodegen() {
|
||||
return getName().contains("spring");
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
public static final String PASCAL_CASE = "PascalCase";
|
||||
public static final String USE_SQUARE_BRACKETS_IN_ARRAY_NAMES = "useSquareBracketsInArrayNames";
|
||||
public static final String VALIDATION_ATTRIBUTES = "validationAttributes";
|
||||
public static final String WITH_REQUEST_OPTS_IN_INTERFACE = "withRequestOptsInInterface";
|
||||
|
||||
@Getter @Setter
|
||||
protected String npmRepository = null;
|
||||
@@ -68,6 +69,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
protected String importFileExtension = "";
|
||||
private boolean useSingleRequestParameter = true;
|
||||
private boolean prefixParameterInterfaces = false;
|
||||
private boolean withRequestOptsInInterface = true;
|
||||
protected boolean addedApiIndex = false;
|
||||
protected boolean addedModelIndex = false;
|
||||
protected boolean withoutRuntimeChecks = false;
|
||||
@@ -130,6 +132,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
this.cliOptions.add(new CliOption(FILE_NAMING, "Naming convention for the output files: 'PascalCase', 'camelCase', 'kebab-case'.").defaultValue(this.fileNaming));
|
||||
this.cliOptions.add(new CliOption(USE_SQUARE_BRACKETS_IN_ARRAY_NAMES, "Setting this property to true will add brackets to array attribute names, e.g. my_values[].", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(VALIDATION_ATTRIBUTES, "Setting this property to true will generate the validation attributes of model properties.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(WITH_REQUEST_OPTS_IN_INTERFACE, "Setting this property to true will include *RequestOpts methods in the API interface declarations. Set to false to keep them only on the class.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.TRUE.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -273,6 +276,11 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
}
|
||||
writePropertyBack(PREFIX_PARAMETER_INTERFACES, getPrefixParameterInterfaces());
|
||||
|
||||
if (additionalProperties.containsKey(WITH_REQUEST_OPTS_IN_INTERFACE)) {
|
||||
this.setWithRequestOptsInInterface(convertPropertyToBoolean(WITH_REQUEST_OPTS_IN_INTERFACE));
|
||||
}
|
||||
writePropertyBack(WITH_REQUEST_OPTS_IN_INTERFACE, getWithRequestOptsInInterface());
|
||||
|
||||
if (additionalProperties.containsKey(NPM_NAME)) {
|
||||
addNpmPackageGeneration();
|
||||
}
|
||||
@@ -1084,6 +1092,14 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
this.prefixParameterInterfaces = prefixParameterInterfaces;
|
||||
}
|
||||
|
||||
private boolean getWithRequestOptsInInterface() {
|
||||
return withRequestOptsInInterface;
|
||||
}
|
||||
|
||||
private void setWithRequestOptsInInterface(boolean withRequestOptsInInterface) {
|
||||
this.withRequestOptsInInterface = withRequestOptsInInterface;
|
||||
}
|
||||
|
||||
private static boolean itemsAreUniqueId(CodegenProperty items) {
|
||||
if (items != null && items.items != null) {
|
||||
return itemsAreUniqueId(items.items);
|
||||
|
||||
@@ -120,8 +120,8 @@ public class TypeScriptNestjsServerCodegen extends AbstractTypeScriptClientCodeg
|
||||
this.cliOptions.add(new CliOption(FILE_NAMING, "Naming convention for the output files: 'camelCase', 'kebab-case'.").defaultValue(this.fileNaming));
|
||||
this.cliOptions.add(new CliOption(STRING_ENUMS, STRING_ENUMS_DESC).defaultValue(String.valueOf(this.stringEnums)));
|
||||
this.cliOptions.add(new CliOption(USE_SINGLE_REQUEST_PARAMETER, "Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.").defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(TS_VERSION, "The version of typescript compatible with Angular (see ngVersion option)."));
|
||||
this.cliOptions.add(new CliOption(RXJS_VERSION, "The version of RxJS compatible with Angular (see ngVersion option)."));
|
||||
this.cliOptions.add(new CliOption(TS_VERSION, "The version of typescript."));
|
||||
this.cliOptions.add(new CliOption(RXJS_VERSION, "The version of RxJS."));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,6 +156,9 @@ public class TypeScriptNestjsServerCodegen extends AbstractTypeScriptClientCodeg
|
||||
supportingFiles.add(new SupportingFile("api-implementations.mustache", "", "api-implementations.ts"));
|
||||
supportingFiles.add(new SupportingFile("api.module.mustache", "", "api.module.ts"));
|
||||
supportingFiles.add(new SupportingFile("controllers.mustache", "controllers", "index.ts"));
|
||||
supportingFiles.add(new SupportingFile("cookies-decorator.mustache", "decorators", "cookies-decorator.ts"));
|
||||
supportingFiles.add(new SupportingFile("headers-decorator.mustache", "decorators", "headers-decorator.ts"));
|
||||
supportingFiles.add(new SupportingFile("decorators.mustache", "decorators", "index.ts"));
|
||||
supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore"));
|
||||
supportingFiles.add(new SupportingFile("README.md", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json"));
|
||||
@@ -173,7 +176,7 @@ public class TypeScriptNestjsServerCodegen extends AbstractTypeScriptClientCodeg
|
||||
additionalProperties.put(NEST_VERSION, nestVersion);
|
||||
|
||||
if (additionalProperties.containsKey(NPM_NAME)) {
|
||||
if(!additionalProperties.containsKey(NPM_VERSION)) {
|
||||
if (!additionalProperties.containsKey(NPM_VERSION)) {
|
||||
additionalProperties.put(NPM_VERSION, "0.0.0");
|
||||
}
|
||||
|
||||
@@ -274,7 +277,21 @@ public class TypeScriptNestjsServerCodegen extends AbstractTypeScriptClientCodeg
|
||||
}
|
||||
|
||||
private boolean isLanguagePrimitive(String type) {
|
||||
return languageSpecificPrimitives.contains(type);
|
||||
return languageSpecificPrimitives.contains(type) || isInlineUnion(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Determines if the given type is an inline union of strings, described as an enum without being an explicit component in OpenAPI spec.
|
||||
* </p>
|
||||
* Example input that matches: {@code "'A' | 'B'" }
|
||||
*
|
||||
* @param type The Typescript type to evaluate.
|
||||
*/
|
||||
private boolean isInlineUnion(String type) {
|
||||
return Arrays.stream(type.split("\\|"))
|
||||
.map(String::trim)
|
||||
.allMatch(value -> value.matches("([\"'].*[\"'])"));
|
||||
}
|
||||
|
||||
private boolean isLanguageGenericType(String type) {
|
||||
@@ -294,6 +311,9 @@ public class TypeScriptNestjsServerCodegen extends AbstractTypeScriptClientCodeg
|
||||
public void postProcessParameter(CodegenParameter parameter) {
|
||||
super.postProcessParameter(parameter);
|
||||
parameter.dataType = applyLocalTypeMapping(parameter.dataType);
|
||||
if ("undefined".equals(parameter.defaultValue)) {
|
||||
parameter.defaultValue = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -343,8 +363,8 @@ public class TypeScriptNestjsServerCodegen extends AbstractTypeScriptClientCodeg
|
||||
// Collect imports from parameters
|
||||
if (operation.allParams != null) {
|
||||
for (CodegenParameter param : operation.allParams) {
|
||||
if(param.dataType != null) {
|
||||
if(isLanguageGenericType(param.dataType)) {
|
||||
if (param.dataType != null) {
|
||||
if (isLanguageGenericType(param.dataType)) {
|
||||
// Extract generic type and add to imports if its not a primitive
|
||||
String genericType = extractGenericType(param.dataType);
|
||||
if (genericType != null && !isLanguagePrimitive(genericType) && !isRecordType(genericType)) {
|
||||
@@ -366,10 +386,10 @@ public class TypeScriptNestjsServerCodegen extends AbstractTypeScriptClientCodeg
|
||||
if (isLanguageGenericType(operation.returnType)) {
|
||||
// Extract generic type and add to imports if it's not a primitive
|
||||
String genericType = extractGenericType(operation.returnType);
|
||||
if (genericType != null && !isLanguagePrimitive(genericType) && !isRecordType(genericType)) {
|
||||
if (needToImport(operation.returnType) && genericType != null && !isLanguagePrimitive(genericType) && !isRecordType(genericType)) {
|
||||
allImports.add(genericType);
|
||||
}
|
||||
} else {
|
||||
} else if (needToImport(operation.returnType)) {
|
||||
allImports.add(operation.returnType);
|
||||
}
|
||||
}
|
||||
@@ -397,10 +417,10 @@ public class TypeScriptNestjsServerCodegen extends AbstractTypeScriptClientCodeg
|
||||
return null;
|
||||
}
|
||||
String genericType = type.substring(startAngleBracketIndex + 1, endAngleBracketIndex);
|
||||
if(isLanguageGenericType(genericType)) {
|
||||
if (isLanguageGenericType(genericType)) {
|
||||
return extractGenericType(type);
|
||||
}
|
||||
if(genericType.contains("|")) {
|
||||
if (genericType.contains("|")) {
|
||||
return null;
|
||||
}
|
||||
return genericType;
|
||||
@@ -429,7 +449,11 @@ public class TypeScriptNestjsServerCodegen extends AbstractTypeScriptClientCodeg
|
||||
for (String name : cm.imports) {
|
||||
if (name.indexOf(" | ") >= 0) {
|
||||
String[] parts = name.split(" \\| ");
|
||||
Collections.addAll(newImports, parts);
|
||||
for (String part : parts) {
|
||||
if (needToImport(part)) {
|
||||
newImports.add(part);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
newImports.add(name);
|
||||
}
|
||||
|
||||
1124
modules/openapi-generator/src/main/resources/C-libcurl/model-body-v7_20_0.mustache
vendored
Normal file
1124
modules/openapi-generator/src/main/resources/C-libcurl/model-body-v7_20_0.mustache
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -153,10 +153,10 @@ static {{classname}}_t *{{classname}}_create_internal(
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
{{datatype}} {{name}}{{^-last}},{{/-last}}
|
||||
{{datatype}} *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
{{datatype}} {{name}}{{^-last}},{{/-last}}
|
||||
{{datatype}} *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isBoolean}}
|
||||
{{#isEnum}}
|
||||
{{#isString}}
|
||||
@@ -201,11 +201,11 @@ static {{classname}}_t *{{classname}}_create_internal(
|
||||
if (!{{classname}}_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
memset({{classname}}_local_var, 0, sizeof({{classname}}_t));
|
||||
{{classname}}_local_var->_library_owned = 1;
|
||||
{{#vars}}
|
||||
{{classname}}_local_var->{{{name}}} = {{{name}}};
|
||||
{{/vars}}
|
||||
|
||||
{{classname}}_local_var->_library_owned = 1;
|
||||
return {{classname}}_local_var;
|
||||
}
|
||||
|
||||
@@ -243,10 +243,10 @@ __attribute__((deprecated)) {{classname}}_t *{{classname}}_create(
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
{{datatype}} {{name}}{{^-last}},{{/-last}}
|
||||
{{datatype}} *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
{{datatype}} {{name}}{{^-last}},{{/-last}}
|
||||
{{datatype}} *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isBoolean}}
|
||||
{{#isEnum}}
|
||||
{{#isString}}
|
||||
@@ -287,11 +287,57 @@ __attribute__((deprecated)) {{classname}}_t *{{classname}}_create(
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
) {
|
||||
return {{classname}}_create_internal (
|
||||
{{#vars}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
{{datatype}} *{{name}}_copy = NULL;
|
||||
if ({{{name}}}) {
|
||||
{{name}}_copy = malloc(sizeof({{datatype}}));
|
||||
if ({{name}}_copy) *{{name}}_copy = *{{{name}}};
|
||||
}
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
{{datatype}} *{{name}}_copy = NULL;
|
||||
if ({{{name}}}) {
|
||||
{{name}}_copy = malloc(sizeof({{datatype}}));
|
||||
if ({{name}}_copy) *{{name}}_copy = *{{{name}}};
|
||||
}
|
||||
{{/isBoolean}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/vars}}
|
||||
{{classname}}_t *result = {{classname}}_create_internal (
|
||||
{{#vars}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
{{name}}_copy{{^-last}},{{/-last}}
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
{{name}}_copy{{^-last}},{{/-last}}
|
||||
{{/isBoolean}}
|
||||
{{^isNumeric}}
|
||||
{{^isBoolean}}
|
||||
{{name}}{{^-last}},{{/-last}}
|
||||
{{/isBoolean}}
|
||||
{{/isNumeric}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{name}}{{^-last}},{{/-last}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/vars}}
|
||||
);
|
||||
if (!result) {
|
||||
{{#vars}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
free({{name}}_copy);
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
free({{name}}_copy);
|
||||
{{/isBoolean}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/vars}}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void {{classname}}_free({{classname}}_t *{{classname}}) {
|
||||
@@ -344,6 +390,18 @@ void {{classname}}_free({{classname}}_t *{{classname}}) {
|
||||
{{/isFreeFormObject}}
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
if ({{{classname}}}->{{{name}}}) {
|
||||
free({{{classname}}}->{{{name}}});
|
||||
{{classname}}->{{name}} = NULL;
|
||||
}
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
if ({{{classname}}}->{{{name}}}) {
|
||||
free({{{classname}}}->{{{name}}});
|
||||
{{classname}}->{{name}} = NULL;
|
||||
}
|
||||
{{/isBoolean}}
|
||||
{{^isEnum}}
|
||||
{{#isString}}
|
||||
if ({{{classname}}}->{{{name}}}) {
|
||||
@@ -454,12 +512,12 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) {
|
||||
{{^isContainer}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
if(cJSON_AddNumberToObject(item, "{{{baseName}}}", {{{classname}}}->{{{name}}}) == NULL) {
|
||||
if(cJSON_AddNumberToObject(item, "{{{baseName}}}", *{{{classname}}}->{{{name}}}) == NULL) {
|
||||
goto fail; //Numeric
|
||||
}
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
if(cJSON_AddBoolToObject(item, "{{{baseName}}}", {{{classname}}}->{{{name}}}) == NULL) {
|
||||
if(cJSON_AddBoolToObject(item, "{{{baseName}}}", *{{{classname}}}->{{{name}}}) == NULL) {
|
||||
goto fail; //Bool
|
||||
}
|
||||
{{/isBoolean}}
|
||||
@@ -699,6 +757,44 @@ fail:
|
||||
|
||||
{{/isFreeFormObject}}
|
||||
{{/isModel}}
|
||||
{{#isUuid}}
|
||||
char *{{name}}_local_str = NULL;
|
||||
|
||||
{{/isUuid}}
|
||||
{{#isEmail}}
|
||||
char *{{name}}_local_str = NULL;
|
||||
|
||||
{{/isEmail}}
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
// define the local variable for {{{classname}}}->{{{name}}}
|
||||
{{datatype}} *{{name}}_local_var = NULL;
|
||||
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
// define the local variable for {{{classname}}}->{{{name}}}
|
||||
{{datatype}} *{{name}}_local_var = NULL;
|
||||
|
||||
{{/isBoolean}}
|
||||
{{^isEnum}}
|
||||
{{#isString}}
|
||||
char *{{name}}_local_str = NULL;
|
||||
|
||||
{{/isString}}
|
||||
{{/isEnum}}
|
||||
{{#isByteArray}}
|
||||
char *{{name}}_local_str = NULL;
|
||||
|
||||
{{/isByteArray}}
|
||||
{{#isDate}}
|
||||
char *{{name}}_local_str = NULL;
|
||||
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
char *{{name}}_local_str = NULL;
|
||||
|
||||
{{/isDateTime}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
@@ -722,6 +818,12 @@ fail:
|
||||
{
|
||||
goto end; //Numeric
|
||||
}
|
||||
{{name}}_local_var = malloc(sizeof({{datatype}}));
|
||||
if(!{{name}}_local_var)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
*{{name}}_local_var = {{{name}}}->valuedouble;
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
{{^required}}if ({{{name}}}) { {{/required}}
|
||||
@@ -729,6 +831,12 @@ fail:
|
||||
{
|
||||
goto end; //Bool
|
||||
}
|
||||
{{name}}_local_var = malloc(sizeof({{datatype}}));
|
||||
if(!{{name}}_local_var)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
*{{name}}_local_var = {{{name}}}->valueint;
|
||||
{{/isBoolean}}
|
||||
{{#isEnum}}
|
||||
{{#isString}}
|
||||
@@ -948,6 +1056,35 @@ fail:
|
||||
|
||||
{{/vars}}
|
||||
|
||||
{{#vars}}
|
||||
{{^isContainer}}
|
||||
{{^isPrimitiveType}}
|
||||
{{#isUuid}}
|
||||
if ({{{name}}}) {{name}}_local_str = strdup({{{name}}}->valuestring);
|
||||
{{/isUuid}}
|
||||
{{#isEmail}}
|
||||
if ({{{name}}}) {{name}}_local_str = strdup({{{name}}}->valuestring);
|
||||
{{/isEmail}}
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
{{^isEnum}}
|
||||
{{#isString}}
|
||||
if ({{{name}}} && !cJSON_IsNull({{{name}}})) {{name}}_local_str = strdup({{{name}}}->valuestring);
|
||||
{{/isString}}
|
||||
{{/isEnum}}
|
||||
{{#isByteArray}}
|
||||
if ({{{name}}}) {{name}}_local_str = strdup({{{name}}}->valuestring);
|
||||
{{/isByteArray}}
|
||||
{{#isDate}}
|
||||
if ({{{name}}}) {{name}}_local_str = strdup({{{name}}}->valuestring);
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
if ({{{name}}} && !cJSON_IsNull({{{name}}})) {{name}}_local_str = strdup({{{name}}}->valuestring);
|
||||
{{/isDateTime}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
|
||||
{{classname}}_local_var = {{classname}}_create_internal (
|
||||
{{#vars}}
|
||||
{{^isContainer}}
|
||||
@@ -966,10 +1103,10 @@ fail:
|
||||
{{/isFreeFormObject}}
|
||||
{{/isModel}}
|
||||
{{#isUuid}}
|
||||
{{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
|
||||
{{name}}_local_str{{^-last}},{{/-last}}
|
||||
{{/isUuid}}
|
||||
{{#isEmail}}
|
||||
{{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
|
||||
{{name}}_local_str{{^-last}},{{/-last}}
|
||||
{{/isEmail}}
|
||||
{{#isFreeFormObject}}
|
||||
{{^required}}{{{name}}} ? {{/required}}{{{name}}}_local_object{{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
|
||||
@@ -977,10 +1114,10 @@ fail:
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
{{^required}}{{{name}}} ? {{/required}}{{{name}}}->valuedouble{{^required}} : 0{{/required}}{{^-last}},{{/-last}}
|
||||
{{name}}_local_var{{^-last}},{{/-last}}
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
{{^required}}{{{name}}} ? {{/required}}{{{name}}}->valueint{{^required}} : 0{{/required}}{{^-last}},{{/-last}}
|
||||
{{name}}_local_var{{^-last}},{{/-last}}
|
||||
{{/isBoolean}}
|
||||
{{#isEnum}}
|
||||
{{#isString}}
|
||||
@@ -989,20 +1126,20 @@ fail:
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{#isString}}
|
||||
{{^required}}{{{name}}} && !cJSON_IsNull({{{name}}}) ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
|
||||
{{name}}_local_str{{^-last}},{{/-last}}
|
||||
{{/isString}}
|
||||
{{/isEnum}}
|
||||
{{#isByteArray}}
|
||||
{{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
|
||||
{{name}}_local_str{{^-last}},{{/-last}}
|
||||
{{/isByteArray}}
|
||||
{{#isBinary}}
|
||||
{{^required}}{{{name}}} ? {{/required}}decoded_str_{{{name}}}{{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
|
||||
{{/isBinary}}
|
||||
{{#isDate}}
|
||||
{{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
|
||||
{{name}}_local_str{{^-last}},{{/-last}}
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
{{^required}}{{{name}}} && !cJSON_IsNull({{{name}}}) ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
|
||||
{{name}}_local_str{{^-last}},{{/-last}}
|
||||
{{/isDateTime}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
@@ -1022,6 +1159,10 @@ fail:
|
||||
{{/vars}}
|
||||
);
|
||||
|
||||
if (!{{classname}}_local_var) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
return {{classname}}_local_var;
|
||||
end:
|
||||
{{#vars}}
|
||||
@@ -1045,6 +1186,58 @@ end:
|
||||
}
|
||||
{{/isFreeFormObject}}
|
||||
{{/isModel}}
|
||||
{{#isUuid}}
|
||||
if ({{{name}}}_local_str) {
|
||||
free({{{name}}}_local_str);
|
||||
{{{name}}}_local_str = NULL;
|
||||
}
|
||||
{{/isUuid}}
|
||||
{{#isEmail}}
|
||||
if ({{{name}}}_local_str) {
|
||||
free({{{name}}}_local_str);
|
||||
{{{name}}}_local_str = NULL;
|
||||
}
|
||||
{{/isEmail}}
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
if ({{{name}}}_local_var) {
|
||||
free({{{name}}}_local_var);
|
||||
{{{name}}}_local_var = NULL;
|
||||
}
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
if ({{{name}}}_local_var) {
|
||||
free({{{name}}}_local_var);
|
||||
{{{name}}}_local_var = NULL;
|
||||
}
|
||||
{{/isBoolean}}
|
||||
{{^isEnum}}
|
||||
{{#isString}}
|
||||
if ({{{name}}}_local_str) {
|
||||
free({{{name}}}_local_str);
|
||||
{{{name}}}_local_str = NULL;
|
||||
}
|
||||
{{/isString}}
|
||||
{{/isEnum}}
|
||||
{{#isByteArray}}
|
||||
if ({{{name}}}_local_str) {
|
||||
free({{{name}}}_local_str);
|
||||
{{{name}}}_local_str = NULL;
|
||||
}
|
||||
{{/isByteArray}}
|
||||
{{#isDate}}
|
||||
if ({{{name}}}_local_str) {
|
||||
free({{{name}}}_local_str);
|
||||
{{{name}}}_local_str = NULL;
|
||||
}
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
if ({{{name}}}_local_str) {
|
||||
free({{{name}}}_local_str);
|
||||
{{{name}}}_local_str = NULL;
|
||||
}
|
||||
{{/isDateTime}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
|
||||
247
modules/openapi-generator/src/main/resources/C-libcurl/model-header-v7_20_0.mustache
vendored
Normal file
247
modules/openapi-generator/src/main/resources/C-libcurl/model-header-v7_20_0.mustache
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
{{#models}}{{#model}}/*
|
||||
* {{classFilename}}.h
|
||||
*
|
||||
* {{description}}
|
||||
*/
|
||||
|
||||
#ifndef _{{classname}}_H_
|
||||
#define _{{classname}}_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
typedef struct {{classname}}_t {{classname}}_t;
|
||||
|
||||
{{#imports}}
|
||||
#include "{{{.}}}.h"
|
||||
{{/imports}}
|
||||
|
||||
{{#isEnum}}
|
||||
{{#allowableValues}}
|
||||
// Enum {{enumName}} for {{classVarName}}
|
||||
|
||||
typedef enum { {{projectName}}_{{classVarName}}_{{enumName}}_NULL = 0{{#enumVars}}, {{projectName}}_{{classVarName}}_{{enumName}}_{{{value}}}{{/enumVars}} } {{projectName}}_{{classVarName}}_{{enumName}}_e;
|
||||
{{/allowableValues}}
|
||||
|
||||
char* {{classFilename}}_{{classname}}_ToString({{projectName}}_{{classVarName}}_{{enumName}}_e {{classname}});
|
||||
|
||||
{{projectName}}_{{classVarName}}_{{enumName}}_e {{classFilename}}_{{classname}}_FromString(char* {{classname}});
|
||||
|
||||
cJSON *{{classname}}_convertToJSON({{projectName}}_{{classVarName}}_{{enumName}}_e {{classname}});
|
||||
|
||||
{{projectName}}_{{classVarName}}_{{enumName}}_e {{classname}}_parseFromJSON(cJSON *{{classname}}JSON);
|
||||
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{#vars}}
|
||||
{{^isContainer}}
|
||||
{{#isPrimitiveType}}
|
||||
{{^isModel}}
|
||||
{{#isEnum}}
|
||||
// Enum {{enumName}} for {{classVarName}}
|
||||
|
||||
{{#allowableValues}}
|
||||
typedef enum { {{projectName}}_{{classVarName}}_{{enumName}}_NULL = 0{{#enumVars}}, {{projectName}}_{{classVarName}}_{{enumName}}_{{{value}}}{{/enumVars}} } {{projectName}}_{{classVarName}}_{{enumName}}_e;
|
||||
{{/allowableValues}}
|
||||
|
||||
char* {{classFilename}}_{{name}}_ToString({{projectName}}_{{classVarName}}_{{enumName}}_e {{name}});
|
||||
|
||||
{{projectName}}_{{classVarName}}_{{enumName}}_e {{classFilename}}_{{name}}_FromString(char* {{name}});
|
||||
|
||||
{{/isEnum}}
|
||||
{{/isModel}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#items}}
|
||||
{{^isModel}}
|
||||
{{#isEnum}}
|
||||
// Enum {{enumName}} for {{classVarName}}
|
||||
|
||||
{{#allowableValues}}
|
||||
typedef enum { {{projectName}}_{{classVarName}}_{{enumName}}_NULL = 0{{#enumVars}}, {{projectName}}_{{classVarName}}_{{enumName}}_{{{value}}}{{/enumVars}} } {{projectName}}_{{classVarName}}_{{enumName}}_e;
|
||||
{{/allowableValues}}
|
||||
|
||||
char* {{classFilename}}_{{name}}_ToString({{projectName}}_{{classVarName}}_{{enumName}}_e {{name}});
|
||||
|
||||
{{projectName}}_{{classVarName}}_{{enumName}}_e {{classFilename}}_{{name}}_FromString(char* {{name}});
|
||||
|
||||
{{/isEnum}}
|
||||
{{/isModel}}
|
||||
{{/items}}
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
|
||||
|
||||
typedef struct {{classname}}_t {
|
||||
{{#vars}}
|
||||
{{^isContainer}}
|
||||
{{^isPrimitiveType}}
|
||||
{{#isModel}}
|
||||
{{#isEnum}}
|
||||
{{projectName}}_{{classVarName}}_{{enumName}}_e {{name}}; //enum model
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
struct {{datatype}}_t *{{name}}; //model
|
||||
{{/isEnum}}
|
||||
{{/isModel}}
|
||||
{{^isModel}}
|
||||
{{^isFreeFormObject}}
|
||||
{{^isEnum}}
|
||||
{{datatype}}_t *{{name}}; // custom
|
||||
{{/isEnum}}
|
||||
{{#isEnum}}
|
||||
{{projectName}}_{{dataType}}_{{enumName}}_e {{name}}; //referenced enum
|
||||
{{/isEnum}}
|
||||
{{/isFreeFormObject}}
|
||||
{{/isModel}}
|
||||
{{#isUuid}}
|
||||
{{datatype}} *{{name}}; // uuid
|
||||
{{/isUuid}}
|
||||
{{#isEmail}}
|
||||
{{datatype}} *{{name}}; // email
|
||||
{{/isEmail}}
|
||||
{{#isFreeFormObject}}
|
||||
{{datatype}}_t *{{name}}; //object
|
||||
{{/isFreeFormObject}}
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
{{datatype}} {{name}}; //numeric
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
{{datatype}} {{name}}; //boolean
|
||||
{{/isBoolean}}
|
||||
{{#isEnum}}
|
||||
{{#isString}}
|
||||
{{projectName}}_{{classVarName}}_{{enumName}}_e {{name}}; //enum
|
||||
{{/isString}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{#isString}}
|
||||
{{datatype}} *{{name}}; // string
|
||||
{{/isString}}
|
||||
{{/isEnum}}
|
||||
{{#isByteArray}}
|
||||
{{datatype}} *{{name}}; //ByteArray
|
||||
{{/isByteArray}}
|
||||
{{#isBinary}}
|
||||
{{datatype}} {{name}}; //binary
|
||||
{{/isBinary}}
|
||||
{{#isDate}}
|
||||
{{datatype}} *{{name}}; //date
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
{{datatype}} *{{name}}; //date time
|
||||
{{/isDateTime}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#isArray}}
|
||||
{{#isPrimitiveType}}
|
||||
{{datatype}}_t *{{name}}; //primitive container
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{datatype}}_t *{{name}}; //nonprimitive container
|
||||
{{/isPrimitiveType}}
|
||||
{{/isArray}}
|
||||
{{#isMap}}
|
||||
{{datatype}} {{name}}; //map
|
||||
{{/isMap}}
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
|
||||
int _library_owned; // Is the library responsible for freeing this object?
|
||||
} {{classname}}_t;
|
||||
|
||||
__attribute__((deprecated)) {{classname}}_t *{{classname}}_create(
|
||||
{{#vars}}
|
||||
{{^isContainer}}
|
||||
{{^isPrimitiveType}}
|
||||
{{#isModel}}
|
||||
{{#isEnum}}
|
||||
{{projectName}}_{{classVarName}}_{{enumName}}_e {{name}}{{^-last}},{{/-last}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{datatype}}_t *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isEnum}}
|
||||
{{/isModel}}
|
||||
{{^isModel}}
|
||||
{{^isFreeFormObject}}
|
||||
{{^isEnum}}
|
||||
{{datatype}}_t *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isEnum}}
|
||||
{{#isEnum}}
|
||||
{{projectName}}_{{dataType}}_{{enumName}}_e {{name}}{{^-last}},{{/-last}}
|
||||
{{/isEnum}}
|
||||
{{/isFreeFormObject}}
|
||||
{{/isModel}}
|
||||
{{#isUuid}}
|
||||
{{datatype}} *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isUuid}}
|
||||
{{#isEmail}}
|
||||
{{datatype}} *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isEmail}}
|
||||
{{#isFreeFormObject}}
|
||||
{{datatype}}_t *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isFreeFormObject}}
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
{{datatype}} {{name}}{{^-last}},{{/-last}}
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
{{datatype}} {{name}}{{^-last}},{{/-last}}
|
||||
{{/isBoolean}}
|
||||
{{#isEnum}}
|
||||
{{#isString}}
|
||||
{{projectName}}_{{classVarName}}_{{enumName}}_e {{name}}{{^-last}},{{/-last}}
|
||||
{{/isString}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{#isString}}
|
||||
{{datatype}} *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isString}}
|
||||
{{/isEnum}}
|
||||
{{#isByteArray}}
|
||||
{{datatype}} *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isByteArray}}
|
||||
{{#isBinary}}
|
||||
{{datatype}} {{name}}{{^-last}},{{/-last}}
|
||||
{{/isBinary}}
|
||||
{{#isDate}}
|
||||
{{datatype}} *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isDate}}
|
||||
{{#isDateTime}}
|
||||
{{datatype}} *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isDateTime}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#isArray}}
|
||||
{{#isPrimitiveType}}
|
||||
{{datatype}}_t *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{datatype}}_t *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isArray}}
|
||||
{{#isMap}}
|
||||
{{datatype}} {{name}}{{^-last}},{{/-last}}
|
||||
{{/isMap}}
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
);
|
||||
|
||||
void {{classname}}_free({{classname}}_t *{{classname}});
|
||||
|
||||
{{classname}}_t *{{classname}}_parseFromJSON(cJSON *{{classname}}JSON);
|
||||
|
||||
cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}});
|
||||
|
||||
{{/isEnum}}
|
||||
#endif /* _{{classname}}_H_ */
|
||||
{{/model}}{{/models}}
|
||||
@@ -110,10 +110,10 @@ typedef struct {{classname}}_t {
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
{{datatype}} {{name}}; //numeric
|
||||
{{datatype}} *{{name}}; //numeric
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
{{datatype}} {{name}}; //boolean
|
||||
{{datatype}} *{{name}}; //boolean
|
||||
{{/isBoolean}}
|
||||
{{#isEnum}}
|
||||
{{#isString}}
|
||||
@@ -191,10 +191,10 @@ __attribute__((deprecated)) {{classname}}_t *{{classname}}_create(
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}
|
||||
{{datatype}} {{name}}{{^-last}},{{/-last}}
|
||||
{{datatype}} *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
{{datatype}} {{name}}{{^-last}},{{/-last}}
|
||||
{{datatype}} *{{name}}{{^-last}},{{/-last}}
|
||||
{{/isBoolean}}
|
||||
{{#isEnum}}
|
||||
{{#isString}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{>licenseInfo}}
|
||||
package {{invokerPackage}};
|
||||
|
||||
import com.fasterxml.jackson.databind.util.StdDateFormat;
|
||||
import {{jacksonPackage}}.databind.util.StdDateFormat;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.FieldPosition;
|
||||
|
||||
@@ -114,8 +114,9 @@ if(hasProperty('target') && target == 'android') {
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.6.3"
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
jackson_version = "2.21.1"
|
||||
jackson_annotations_version = "2.21"
|
||||
jackson_databind_version = "2.21.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.9"
|
||||
{{/openApiNullable}}
|
||||
@@ -137,7 +138,7 @@ dependencies {
|
||||
implementation "com.sun.jersey:jersey-client:$jersey_version"
|
||||
implementation "com.sun.jersey.contribs:jersey-multipart:$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-annotations:$jackson_annotations_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||
{{#openApiNullable}}
|
||||
|
||||
@@ -114,8 +114,9 @@ if(hasProperty('target') && target == 'android') {
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.6.6"
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
jackson_version = "2.21.1"
|
||||
jackson_annotations_version = "2.21"
|
||||
jackson_databind_version = "2.21.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.9"
|
||||
{{/openApiNullable}}
|
||||
@@ -130,7 +131,7 @@ dependencies {
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation "org.apache.httpcomponents.client5:httpclient5:$httpclient_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-annotations:$jackson_annotations_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||
{{#openApiNullable}}
|
||||
|
||||
@@ -252,7 +252,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<version>${jackson-annotations-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
@@ -351,8 +351,9 @@
|
||||
<swagger-annotations-version>2.2.15</swagger-annotations-version>
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
<httpclient-version>5.2.1</httpclient-version>
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
<jackson-version>2.21.1</jackson-version>
|
||||
<jackson-annotations-version>2.21</jackson-annotations-version>
|
||||
<jackson-databind-version>2.21.1</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
|
||||
@@ -103,8 +103,9 @@ test {
|
||||
ext {
|
||||
swagger_annotations_version = "1.6.11"
|
||||
{{#jackson}}
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
jackson_version = "2.21.1"
|
||||
jackson_annotations_version = "2.21"
|
||||
jackson_databind_version = "2.21.1"
|
||||
{{/jackson}}
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.9"
|
||||
@@ -139,7 +140,7 @@ dependencies {
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
||||
{{/joda}}
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_annotations_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||
{{/jackson}}
|
||||
|
||||
@@ -24,10 +24,10 @@ lazy val root = (project in file(".")).
|
||||
"io.github.openfeign" % "feign-hc5" % "13.5" % "compile",
|
||||
{{/feign-hc5}}
|
||||
{{#jackson}}
|
||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.17.1" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.17.1" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.17.1" % "compile",
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.17.1" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.21.1" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.21" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.21.1" % "compile",
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.21.1" % "compile",
|
||||
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.15.2" % "compile",
|
||||
{{/jackson}}
|
||||
"com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile",
|
||||
|
||||
@@ -290,7 +290,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<version>${jackson-annotations-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
@@ -409,8 +409,9 @@
|
||||
<feign-version>13.2.1</feign-version>
|
||||
<feign-form-version>3.8.0</feign-form-version>
|
||||
{{#jackson}}
|
||||
<jackson-version>2.17.1</jackson-version>
|
||||
<jackson-databind-version>2.17.1</jackson-databind-version>
|
||||
<jackson-version>2.21.1</jackson-version>
|
||||
<jackson-annotations-version>2.21</jackson-annotations-version>
|
||||
<jackson-databind-version>2.21.1</jackson-databind-version>
|
||||
{{/jackson}}
|
||||
{{#gson}}
|
||||
<gson-version>2.10.1</gson-version>
|
||||
|
||||
@@ -53,7 +53,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
|
||||
@Override
|
||||
public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
||||
JsonNode tree = jp.readValueAsTree();
|
||||
JsonNode tree = ctxt.readTree(jp);
|
||||
|
||||
Object deserialized = null;
|
||||
{{#discriminator}}
|
||||
|
||||
@@ -104,8 +104,9 @@ ext {
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
swagger_annotations_version = "2.2.15"
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
jackson_version = "2.21.1"
|
||||
jackson_annotations_version = "2.21"
|
||||
jackson_databind_version = "2.21.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.9"
|
||||
{{/openApiNullable}}
|
||||
@@ -140,7 +141,7 @@ dependencies {
|
||||
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-annotations:$jackson_annotations_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||
{{#openApiNullable}}
|
||||
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||
|
||||
@@ -16,13 +16,13 @@ lazy val root = (project in file(".")).
|
||||
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.35",
|
||||
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.35",
|
||||
"org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35",
|
||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.19.2" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.19.2" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.19.2" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.21.1" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.21" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.21.1" % "compile",
|
||||
{{#joda}}
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.19.2" % "compile",
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.21.1" % "compile",
|
||||
{{/joda}}
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.19.2" % "compile",
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.21.1" % "compile",
|
||||
{{#openApiNullable}}
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.9" % "compile",
|
||||
{{/openApiNullable}}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
|
||||
@Override
|
||||
public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
||||
JsonNode tree = jp.readValueAsTree();
|
||||
JsonNode tree = ctxt.readTree(jp);
|
||||
Object deserialized = null;
|
||||
{{#useOneOfDiscriminatorLookup}}
|
||||
{{#discriminator}}
|
||||
|
||||
@@ -311,7 +311,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<version>${jackson-annotations-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
@@ -405,8 +405,9 @@
|
||||
<swagger-annotations-version>2.2.15</swagger-annotations-version>
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
<jersey-version>2.37</jersey-version>
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
<jackson-version>2.21.1</jackson-version>
|
||||
<jackson-annotations-version>2.21</jackson-annotations-version>
|
||||
<jackson-databind-version>2.21.1</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
|
||||
@@ -53,7 +53,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
|
||||
@Override
|
||||
public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
||||
JsonNode tree = jp.readValueAsTree();
|
||||
JsonNode tree = ctxt.readTree(jp);
|
||||
|
||||
Object deserialized = null;
|
||||
{{#discriminator}}
|
||||
|
||||
@@ -99,8 +99,9 @@ if(hasProperty('target') && target == 'android') {
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.6.5"
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
jackson_version = "2.21.1"
|
||||
jackson_annotations_version = "2.21"
|
||||
jackson_databind_version = "2.21.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.9"
|
||||
{{/openApiNullable}}
|
||||
@@ -130,7 +131,7 @@ dependencies {
|
||||
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-annotations:$jackson_annotations_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||
{{#openApiNullable}}
|
||||
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||
|
||||
@@ -16,13 +16,13 @@ lazy val root = (project in file(".")).
|
||||
"org.glassfish.jersey.media" % "jersey-media-multipart" % "3.0.4",
|
||||
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "3.0.4",
|
||||
"org.glassfish.jersey.connectors" % "jersey-apache-connector" % "3.0.4",
|
||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.19.2" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.19.2" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.19.2" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.21.1" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.21" % "compile",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.21.1" % "compile",
|
||||
{{#joda}}
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.19.2" % "compile",
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.21.1" % "compile",
|
||||
{{/joda}}
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.19.2" % "compile",
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.21.1" % "compile",
|
||||
{{#openApiNullable}}
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.9" % "compile",
|
||||
{{/openApiNullable}}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
|
||||
@Override
|
||||
public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
||||
JsonNode tree = jp.readValueAsTree();
|
||||
JsonNode tree = ctxt.readTree(jp);
|
||||
Object deserialized = null;
|
||||
{{#useOneOfDiscriminatorLookup}}
|
||||
{{#discriminator}}
|
||||
|
||||
@@ -311,7 +311,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<version>${jackson-annotations-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
@@ -405,8 +405,9 @@
|
||||
<swagger-annotations-version>2.2.15</swagger-annotations-version>
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
<jersey-version>3.1.11</jersey-version>
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
<jackson-version>2.21.1</jackson-version>
|
||||
<jackson-annotations-version>2.21</jackson-annotations-version>
|
||||
<jackson-databind-version>2.21.1</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
|
||||
@@ -52,10 +52,10 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{#isContainer}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};
|
||||
protected {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};
|
||||
{{/isContainer}}
|
||||
{{^isContainer}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
protected {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
{{>additional_properties}}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
|
||||
@Override
|
||||
public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
||||
JsonNode tree = jp.readValueAsTree();
|
||||
JsonNode tree = ctxt.readTree(jp);
|
||||
|
||||
Object deserialized = null;
|
||||
{{#discriminator}}
|
||||
|
||||
@@ -72,7 +72,8 @@ ext {
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
swagger_annotations_version = "2.2.9"
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
jackson_version = "2.19.2"
|
||||
jackson_version = "2.21.1"
|
||||
jackson_annotations_version = "2.21"
|
||||
{{#useJakartaEe}}
|
||||
jakarta_annotation_version = "2.1.1"
|
||||
beanvalidation_version = "3.0.2"
|
||||
@@ -99,7 +100,7 @@ dependencies {
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_annotations_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||
implementation "org.openapitools:jackson-databind-nullable:0.2.9"
|
||||
|
||||
@@ -62,7 +62,7 @@ import java.net.URI;
|
||||
{{/jackson}}
|
||||
public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) {
|
||||
for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||
if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) {
|
||||
if (b.value.equals{{#isString}}{{#useEnumCaseInsensitive}}IgnoreCase{{/useEnumCaseInsensitive}}{{/isString}}(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
||||
|
||||
@Override
|
||||
public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
||||
JsonNode tree = jp.readValueAsTree();
|
||||
JsonNode tree = ctxt.readTree(jp);
|
||||
Object deserialized = null;
|
||||
{{#useOneOfDiscriminatorLookup}}
|
||||
{{#discriminator}}
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<version>${jackson-annotations-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
@@ -299,7 +299,8 @@
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-version>2.21.1</jackson-version>
|
||||
<jackson-annotations-version>2.21</jackson-annotations-version>
|
||||
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
|
||||
@@ -45,7 +45,7 @@ import com.google.gson.stream.JsonWriter;
|
||||
|
||||
public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) {
|
||||
for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||
if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) {
|
||||
if (b.value.equals{{#isString}}{{#useEnumCaseInsensitive}}IgnoreCase{{/useEnumCaseInsensitive}}{{/isString}}(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) {
|
||||
for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||
if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) {
|
||||
if (b.value.equals{{#isString}}{{#useEnumCaseInsensitive}}IgnoreCase{{/useEnumCaseInsensitive}}{{/isString}}(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,31 @@
|
||||
package {{invokerPackage}};
|
||||
|
||||
{{#withXml}}
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
|
||||
import {{jacksonPackage}}.dataformat.xml.XmlMapper;
|
||||
import {{jacksonPackage}}.dataformat.xml.ser.ToXmlGenerator;
|
||||
{{/withXml}}
|
||||
|
||||
import {{jacksonPackage}}.databind.DeserializationFeature;
|
||||
|
||||
{{#useJackson3}}
|
||||
import {{jacksonPackage}}.core.JacksonException;
|
||||
import {{jacksonPackage}}.databind.json.JsonMapper;
|
||||
import org.springframework.http.converter.HttpMessageConverters;
|
||||
import org.springframework.http.converter.json.JacksonJsonHttpMessageConverter;
|
||||
{{#withXml}}
|
||||
import org.springframework.http.converter.xml.JacksonXmlHttpMessageConverter;
|
||||
{{/withXml}}
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
{{#withXml}}
|
||||
import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter;
|
||||
{{/withXml}}
|
||||
{{/useJackson3}}
|
||||
|
||||
import java.util.function.Consumer;
|
||||
{{#openApiNullable}}
|
||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||
@@ -23,10 +41,6 @@ import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.InvalidMediaTypeException;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
{{#withXml}}
|
||||
import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter;
|
||||
{{/withXml}}
|
||||
{{#generateClientAsBean}}
|
||||
import org.springframework.stereotype.Component;
|
||||
{{/generateClientAsBean}}
|
||||
@@ -122,8 +136,12 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
|
||||
protected final RestClient restClient;
|
||||
protected final DateFormat dateFormat;
|
||||
protected final ObjectMapper objectMapper;
|
||||
|
||||
{{^useJackson3}}
|
||||
protected final ObjectMapper mapper;
|
||||
{{/useJackson3}}
|
||||
{{#useJackson3}}
|
||||
protected final JsonMapper mapper;
|
||||
{{/useJackson3}}
|
||||
protected Map<String, Authentication> authentications;
|
||||
|
||||
|
||||
@@ -138,19 +156,24 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
this(restClient, createDefaultDateFormat());
|
||||
}
|
||||
|
||||
public ApiClient(ObjectMapper mapper, DateFormat format) {
|
||||
public ApiClient({{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} mapper, DateFormat format) {
|
||||
this(null, mapper, format);
|
||||
}
|
||||
|
||||
public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
|
||||
this.objectMapper = mapper.copy();
|
||||
this.restClient = Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(this.objectMapper));
|
||||
public ApiClient(RestClient restClient, {{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} mapper, DateFormat format) {
|
||||
{{#useJackson3}}
|
||||
this.mapper = mapper;
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
this.mapper = mapper.copy();
|
||||
{{/useJackson3}}
|
||||
this.restClient = Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(this.mapper));
|
||||
this.dateFormat = format;
|
||||
this.init();
|
||||
}
|
||||
|
||||
protected ApiClient(RestClient restClient, DateFormat format) {
|
||||
this(restClient, createDefaultObjectMapper(format), format);
|
||||
this(restClient, createDefaultMapper(format), format);
|
||||
}
|
||||
|
||||
public static DateFormat createDefaultDateFormat() {
|
||||
@@ -159,7 +182,21 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
public static ObjectMapper createDefaultObjectMapper(@Nullable DateFormat dateFormat) {
|
||||
{{#useJackson3}}
|
||||
public static JsonMapper createDefaultMapper(@Nullable DateFormat dateFormat) {
|
||||
return JsonMapper.builder()
|
||||
.defaultDateFormat(dateFormat)
|
||||
{{#failOnUnknownProperties}}
|
||||
.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
||||
{{/failOnUnknownProperties}}
|
||||
{{^failOnUnknownProperties}}
|
||||
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
||||
{{/failOnUnknownProperties}}
|
||||
.build();
|
||||
}
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
public static ObjectMapper createDefaultMapper(@Nullable DateFormat dateFormat) {
|
||||
if (null == dateFormat) {
|
||||
dateFormat = createDefaultDateFormat();
|
||||
}
|
||||
@@ -173,6 +210,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
{{/openApiNullable}}
|
||||
return mapper;
|
||||
}
|
||||
{{/useJackson3}}
|
||||
|
||||
protected void init() {
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
@@ -187,18 +225,29 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
|
||||
/**
|
||||
* Build the RestClientBuilder used to make RestClient.
|
||||
* @param mapper ObjectMapper used for serialize/deserialize
|
||||
* @param mapper {{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} used for serialize/deserialize
|
||||
* @return RestClient
|
||||
*/
|
||||
public static RestClient.Builder buildRestClientBuilder(ObjectMapper mapper) {
|
||||
public static RestClient.Builder buildRestClientBuilder({{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} mapper) {
|
||||
{{#withXml}}
|
||||
XmlMapper xmlMapper = new XmlMapper();
|
||||
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
|
||||
{{#openApiNullable}}
|
||||
xmlMapper.registerModule(new JsonNullableModule());
|
||||
xmlMapper.registerModule(new JsonNullableModule());
|
||||
{{/openApiNullable}}
|
||||
|
||||
{{/withXml}}
|
||||
|
||||
{{#useJackson3}}
|
||||
Consumer<HttpMessageConverters.ClientBuilder> messageConverters = builder -> {
|
||||
builder.withJsonConverter(new JacksonJsonHttpMessageConverter(mapper));
|
||||
{{#withXml}}
|
||||
builder.withXmlConverter(new JacksonXmlHttpMessageConverter(xmlMapper));
|
||||
{{/withXml}}
|
||||
};
|
||||
|
||||
return RestClient.builder().configureMessageConverters(messageConverters);
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
Consumer<List<HttpMessageConverter<?>>> messageConverters = converters -> {
|
||||
converters.add(0, new MappingJackson2HttpMessageConverter(mapper));
|
||||
{{#withXml}}
|
||||
@@ -207,6 +256,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
};
|
||||
|
||||
return RestClient.builder().messageConverters(messageConverters);
|
||||
{{/useJackson3}}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,15 +264,15 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
* @return RestClient
|
||||
*/
|
||||
public static RestClient.Builder buildRestClientBuilder() {
|
||||
return buildRestClientBuilder(createDefaultObjectMapper(null));
|
||||
return buildRestClientBuilder(createDefaultMapper(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the RestClient used to make HTTP requests.
|
||||
* @param mapper ObjectMapper used for serialize/deserialize
|
||||
* @param mapper {{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} used for serialize/deserialize
|
||||
* @return RestClient
|
||||
*/
|
||||
public static RestClient buildRestClient(ObjectMapper mapper) {
|
||||
public static RestClient buildRestClient({{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} mapper) {
|
||||
return buildRestClientBuilder(mapper).build();
|
||||
}
|
||||
|
||||
@@ -231,7 +281,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
* @return RestClient
|
||||
*/
|
||||
public static RestClient buildRestClient() {
|
||||
return buildRestClientBuilder(createDefaultObjectMapper(null)).build();
|
||||
return buildRestClientBuilder(createDefaultMapper(null)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -473,11 +523,11 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ObjectMapper used to make HTTP requests.
|
||||
* @return ObjectMapper objectMapper
|
||||
* Get the {{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} used to make HTTP requests.
|
||||
* @return {{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} mapper
|
||||
*/
|
||||
public ObjectMapper getObjectMapper() {
|
||||
return objectMapper;
|
||||
public {{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} get{{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}}() {
|
||||
return mapper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -527,8 +577,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
valueCollection = (Collection<?>) value;
|
||||
} else {
|
||||
try {
|
||||
return parameterToMultiValueMap(collectionFormat, name, objectMapper.writeValueAsString(value));
|
||||
} catch (JsonProcessingException e) {
|
||||
return parameterToMultiValueMap(collectionFormat, name, mapper.writeValueAsString(value));
|
||||
} catch ({{#useJackson3}}JacksonException{{/useJackson3}}{{^useJackson3}}JsonProcessingException{{/useJackson3}} e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
@@ -536,8 +586,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
List<String> values = new ArrayList<>();
|
||||
for(Object o : valueCollection) {
|
||||
try {
|
||||
values.add(objectMapper.writeValueAsString(o));
|
||||
} catch (JsonProcessingException e) {
|
||||
values.add(mapper.writeValueAsString(o));
|
||||
} catch ({{#useJackson3}}JacksonException{{/useJackson3}}{{^useJackson3}}JsonProcessingException{{/useJackson3}} e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,19 +98,30 @@ if(hasProperty('target') && target == 'android') {
|
||||
|
||||
ext {
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
swagger_annotations_version = "1.6.9"
|
||||
swagger_annotations_version = "1.6.16"
|
||||
{{/swagger1AnnotationLibrary}}
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
swagger_annotations_version = "2.2.9"
|
||||
swagger_annotations_version = "2.2.43"
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#useJackson3}}
|
||||
jackson_version = "3.1.0"
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
jackson_version = "2.21.1"
|
||||
{{/useJackson3}}
|
||||
jackson_annotations_version = "2.21"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.9"
|
||||
{{/openApiNullable}}
|
||||
spring_web_version = "6.1.21"
|
||||
{{^useSpringBoot4}}
|
||||
spring_web_version = "6.2.16"
|
||||
jakarta_annotation_version = "2.1.1"
|
||||
jodatime_version = "2.9.9"
|
||||
{{/useSpringBoot4}}
|
||||
{{#useSpringBoot4}}
|
||||
spring_web_version = "7.0.5"
|
||||
jakarta_annotation_version = "3.0.0"
|
||||
{{/useSpringBoot4}}
|
||||
jodatime_version = "2.14.0"
|
||||
junit_version = "5.10.2"
|
||||
}
|
||||
|
||||
@@ -121,23 +132,23 @@ dependencies {
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version"
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation "org.springframework:spring-web:$spring_web_version"
|
||||
implementation "org.springframework:spring-context:$spring_web_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 "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||
implementation "{{jacksonPackage}}.core:jackson-core:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_annotations_version"
|
||||
implementation "{{jacksonPackage}}.core:jackson-databind:$jackson_version"
|
||||
{{#openApiNullable}}
|
||||
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||
{{/openApiNullable}}
|
||||
{{^useJackson3}}
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||
{{/useJackson3}}
|
||||
{{#joda}}
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
||||
implementation "{{jacksonPackage}}.datatype:jackson-datatype-joda:$jackson_version"
|
||||
implementation "joda-time:joda-time:$jodatime_version"
|
||||
{{/joda}}
|
||||
{{#withXml}}
|
||||
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
|
||||
implementation "{{jacksonPackage}}.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"
|
||||
@@ -155,5 +166,4 @@ test {
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,9 @@ import java.io.Serializable;
|
||||
{{#jackson}}
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
{{#withXml}}
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.*;
|
||||
import {{jacksonPackage}}.dataformat.xml.annotation.*;
|
||||
{{/withXml}}
|
||||
{{#vendorExtensions.x-has-readonly-properties}}
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
<developerConnection>{{scmDeveloperConnection}}</developerConnection>
|
||||
<url>{{scmUrl}}</url>
|
||||
</scm>
|
||||
{{#parentOverridden}}
|
||||
{{#parentOverridden}}
|
||||
<parent>
|
||||
<groupId>{{{parentGroupId}}}</groupId>
|
||||
<artifactId>{{{parentArtifactId}}}</artifactId>
|
||||
<version>{{{parentVersion}}}</version>
|
||||
</parent>
|
||||
{{/parentOverridden}}
|
||||
{{/parentOverridden}}
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
@@ -43,7 +43,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<version>3.6.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-maven</id>
|
||||
@@ -63,7 +63,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<version>3.5.4</version>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<property>
|
||||
@@ -76,14 +76,6 @@
|
||||
<reuseForks>false</reuseForks>
|
||||
<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>
|
||||
@@ -104,7 +96,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.5.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
@@ -119,7 +111,7 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<version>3.6.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add_sources</id>
|
||||
@@ -150,7 +142,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<version>3.15.0</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
@@ -159,7 +151,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<version>3.12.0</version>
|
||||
<configuration>
|
||||
<doclint>none</doclint>
|
||||
</configuration>
|
||||
@@ -175,7 +167,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
@@ -196,7 +188,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>3.2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
@@ -228,13 +220,6 @@
|
||||
</dependency>
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
|
||||
<!-- @Nullable annotation -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HTTP client: Spring RestClient -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
@@ -249,22 +234,22 @@
|
||||
|
||||
<!-- JSON processing: jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<groupId>{{jacksonPackage}}.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-annotations-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>{{jacksonPackage}}.core</groupId>
|
||||
<artifactId>jackson-databind</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>com.fasterxml.jackson.jakarta.rs</groupId>
|
||||
<groupId>{{jacksonPackage}}.jakarta.rs</groupId>
|
||||
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
@@ -279,7 +264,7 @@
|
||||
|
||||
<!-- XML processing: Jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<groupId>{{jacksonPackage}}.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
@@ -289,14 +274,18 @@
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
{{/withXml}}
|
||||
|
||||
{{^useJackson3}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/useJackson3}}
|
||||
|
||||
{{#joda}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<groupId>{{jacksonPackage}}.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
@@ -306,23 +295,24 @@
|
||||
<version>${jodatime-version}</version>
|
||||
</dependency>
|
||||
{{/joda}}
|
||||
{{#useBeanValidation}}
|
||||
|
||||
{{#useBeanValidation}}
|
||||
<!-- Bean Validation API support -->
|
||||
<dependency>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
<version>${beanvalidation-version}</version>
|
||||
<scope>provided</scope>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
<version>${beanvalidation-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
{{/useBeanValidation}}
|
||||
{{#performBeanValidation}}
|
||||
{{/useBeanValidation}}
|
||||
{{#performBeanValidation}}
|
||||
<!-- Bean Validation Impl. used to perform BeanValidation -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate.validator</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>${hibernate-validator-version}</version>
|
||||
<groupId>org.hibernate.validator</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>${hibernate-validator-version}</version>
|
||||
</dependency>
|
||||
{{/performBeanValidation}}
|
||||
{{/performBeanValidation}}
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
@@ -341,25 +331,42 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
<swagger-annotations-version>1.6.9</swagger-annotations-version>
|
||||
<swagger-annotations-version>1.6.16</swagger-annotations-version>
|
||||
{{/swagger1AnnotationLibrary}}
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
<swagger-annotations-version>2.2.15</swagger-annotations-version>
|
||||
<swagger-annotations-version>2.2.43</swagger-annotations-version>
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
<spring-web-version>6.1.21</spring-web-version>
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
|
||||
{{^useSpringBoot4}}
|
||||
<spring-web-version>6.2.16</spring-web-version>
|
||||
<jackson-version>2.21.1</jackson-version>
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
{{#joda}}
|
||||
<jodatime-version>2.9.9</jodatime-version>
|
||||
{{/joda}}
|
||||
<beanvalidation-version>3.0.2</beanvalidation-version>
|
||||
{{#performBeanValidation}}
|
||||
<hibernate-validator-version>8.0.3.Final</hibernate-validator-version>
|
||||
{{/performBeanValidation}}
|
||||
{{/useSpringBoot4}}
|
||||
{{#useSpringBoot4}}
|
||||
<spring-web-version>7.0.5</spring-web-version>
|
||||
{{#useJackson3}}
|
||||
<jackson-version>3.1.0</jackson-version>
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
<jackson-version>2.21.1</jackson-version>
|
||||
{{/useJackson3}}
|
||||
<jakarta-annotation-version>3.0.0</jakarta-annotation-version>
|
||||
{{#performBeanValidation}}
|
||||
<hibernate-validator-version>9.1.0.Final</hibernate-validator-version>
|
||||
{{/performBeanValidation}}
|
||||
{{/useSpringBoot4}}
|
||||
|
||||
<jackson-annotations-version>2.21</jackson-annotations-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#joda}}
|
||||
<jodatime-version>2.14.0</jodatime-version>
|
||||
{{/joda}}
|
||||
<beanvalidation-version>3.1.1</beanvalidation-version>
|
||||
<junit-version>5.10.2</junit-version>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package {{invokerPackage}};
|
||||
|
||||
{{#withXml}}
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
|
||||
import {{jacksonPackage}}.dataformat.xml.XmlMapper;
|
||||
import {{jacksonPackage}}.dataformat.xml.ser.ToXmlGenerator;
|
||||
{{/withXml}}
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -115,11 +115,22 @@ ext {
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
swagger_annotations_version = "2.2.9"
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#useJackson3}}
|
||||
jackson_version = "3.1.0"
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
jackson_version = "2.21.1"
|
||||
{{/useJackson3}}
|
||||
jackson_annotations_version = "2.21"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.9"
|
||||
{{/openApiNullable}}
|
||||
{{#useSpringBoot4}}
|
||||
spring_web_version = "7.0.5"
|
||||
jakarta_annotation_version = "3.0.0"
|
||||
bean_validation_version = "3.1.1"
|
||||
{{/useSpringBoot4}}
|
||||
{{^useSpringBoot4}}
|
||||
{{#useJakartaEe}}
|
||||
spring_web_version = "6.2.8"
|
||||
jakarta_annotation_version = "2.1.1"
|
||||
@@ -130,6 +141,7 @@ ext {
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
bean_validation_version = "2.0.2"
|
||||
{{/useJakartaEe}}
|
||||
{{/useSpringBoot4}}
|
||||
jodatime_version = "2.9.9"
|
||||
junit_version = "5.10.2"
|
||||
}
|
||||
@@ -144,25 +156,27 @@ dependencies {
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation "org.springframework:spring-web:$spring_web_version"
|
||||
implementation "org.springframework:spring-context:$spring_web_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 "{{jacksonPackage}}.core:jackson-core:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_annotations_version"
|
||||
implementation "{{jacksonPackage}}.core:jackson-databind:$jackson_version"
|
||||
{{^useJakartaEe}}
|
||||
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||
{{/useJakartaEe}}
|
||||
{{#useJakartaEe}}
|
||||
implementation "com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-json-provider:$jackson_version"
|
||||
implementation "{{jacksonPackage}}.jakarta.rs:jackson-jakarta-rs-json-provider:$jackson_version"
|
||||
{{/useJakartaEe}}
|
||||
{{#openApiNullable}}
|
||||
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||
{{/openApiNullable}}
|
||||
{{^useJackson3}}
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||
{{/useJackson3}}
|
||||
{{#joda}}
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
||||
implementation "{{jacksonPackage}}.datatype:jackson-datatype-joda:$jackson_version"
|
||||
implementation "joda-time:joda-time:$jodatime_version"
|
||||
{{/joda}}
|
||||
{{#withXml}}
|
||||
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
|
||||
implementation "{{jacksonPackage}}.dataformat:jackson-dataformat-xml:$jackson_version"
|
||||
implementation "io.github.threeten-jaxb:threeten-jaxb-core:1.2"
|
||||
{{/withXml}}
|
||||
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
|
||||
@@ -27,8 +27,9 @@ import java.io.Serializable;
|
||||
{{#jackson}}
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
{{#withXml}}
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.*;
|
||||
import {{jacksonPackage}}.dataformat.xml.annotation.*;
|
||||
{{/withXml}}
|
||||
{{#vendorExtensions.x-has-readonly-properties}}
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
|
||||
@@ -156,10 +156,14 @@
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
{{/useJakartaEe}}
|
||||
{{^useJakartaEe}}
|
||||
{{#useSpringBoot4}}
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
{{/useSpringBoot4}}
|
||||
{{^useJakartaEe}}{{^useSpringBoot4}}
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
{{/useJakartaEe}}
|
||||
{{/useSpringBoot4}}{{/useJakartaEe}}
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@@ -255,19 +259,19 @@
|
||||
|
||||
<!-- JSON processing: jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<groupId>{{jacksonPackage}}.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>
|
||||
<version>${jackson-annotations-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<groupId>{{jacksonPackage}}.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-databind-version}</version>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{^useJakartaEe}}
|
||||
<dependency>
|
||||
@@ -278,7 +282,7 @@
|
||||
{{/useJakartaEe}}
|
||||
{{#useJakartaEe}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
|
||||
<groupId>{{jacksonPackage}}.jakarta.rs</groupId>
|
||||
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
@@ -294,7 +298,7 @@
|
||||
|
||||
<!-- XML processing: Jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<groupId>{{jacksonPackage}}.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
@@ -304,14 +308,17 @@
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
{{/withXml}}
|
||||
|
||||
{{^useJackson3}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/useJackson3}}
|
||||
{{#joda}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<groupId>{{jacksonPackage}}.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
@@ -361,11 +368,21 @@
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
<swagger-annotations-version>2.2.15</swagger-annotations-version>
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
|
||||
{{#useSpringBoot4}}
|
||||
<spring-web-version>7.0.5</spring-web-version>
|
||||
{{#useJackson3}}
|
||||
<jackson-version>3.1.0</jackson-version>
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
<jackson-version>2.21.1</jackson-version>
|
||||
{{/useJackson3}}
|
||||
<jakarta-annotation-version>3.0.0</jakarta-annotation-version>
|
||||
{{#performBeanValidation}}
|
||||
<hibernate-validator-version>9.1.0.Final</hibernate-validator-version>
|
||||
{{/performBeanValidation}}
|
||||
{{/useSpringBoot4}}
|
||||
{{^useSpringBoot4}}
|
||||
{{#useJakartaEe}}
|
||||
<spring-web-version>6.2.8</spring-web-version>
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
@@ -376,12 +393,19 @@
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<beanvalidation-version>2.0.2</beanvalidation-version>
|
||||
{{/useJakartaEe}}
|
||||
{{#joda}}
|
||||
<jodatime-version>2.9.9</jodatime-version>
|
||||
{{/joda}}
|
||||
<jackson-version>2.21.1</jackson-version>
|
||||
{{#performBeanValidation}}
|
||||
<hibernate-validator-version>8.0.3.Final</hibernate-validator-version>
|
||||
{{/performBeanValidation}}
|
||||
{{/useSpringBoot4}}
|
||||
|
||||
<jackson-annotations-version>2.21</jackson-annotations-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#joda}}
|
||||
<jodatime-version>2.9.9</jodatime-version>
|
||||
{{/joda}}
|
||||
<junit-version>5.10.2</junit-version>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@@ -2,10 +2,21 @@
|
||||
|
||||
package {{invokerPackage}};
|
||||
|
||||
import {{jacksonPackage}}.databind.DeserializationFeature;
|
||||
|
||||
{{#useJackson3}}
|
||||
import {{jacksonPackage}}.core.JacksonException;
|
||||
import {{jacksonPackage}}.databind.json.JsonMapper;
|
||||
import org.springframework.http.codec.json.JacksonJsonDecoder;
|
||||
import org.springframework.http.codec.json.JacksonJsonEncoder;
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import org.springframework.http.codec.json.Jackson2JsonDecoder;
|
||||
import org.springframework.http.codec.json.Jackson2JsonEncoder;
|
||||
{{/useJackson3}}
|
||||
{{#openApiNullable}}
|
||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||
{{/openApiNullable}}
|
||||
@@ -27,8 +38,6 @@ import org.springframework.http.client.ClientHttpRequestExecution;
|
||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.http.client.reactive.ClientHttpRequest;
|
||||
import org.springframework.http.codec.json.Jackson2JsonDecoder;
|
||||
import org.springframework.http.codec.json.Jackson2JsonEncoder;
|
||||
{{#generateClientAsBean}}
|
||||
import org.springframework.stereotype.Component;
|
||||
{{/generateClientAsBean}}
|
||||
@@ -110,15 +119,20 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
|
||||
protected final WebClient webClient;
|
||||
protected final DateFormat dateFormat;
|
||||
protected final ObjectMapper objectMapper;
|
||||
{{^useJackson3}}
|
||||
protected final ObjectMapper mapper;
|
||||
{{/useJackson3}}
|
||||
{{#useJackson3}}
|
||||
protected final JsonMapper mapper;
|
||||
{{/useJackson3}}
|
||||
|
||||
protected Map<String, Authentication> authentications;
|
||||
|
||||
|
||||
public ApiClient() {
|
||||
this.dateFormat = createDefaultDateFormat();
|
||||
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
|
||||
this.webClient = buildWebClient(this.objectMapper);
|
||||
this.mapper = createDefaultMapper(this.dateFormat);
|
||||
this.webClient = buildWebClient(this.mapper);
|
||||
this.init();
|
||||
}
|
||||
|
||||
@@ -129,18 +143,18 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient()), createDefaultDateFormat());
|
||||
}
|
||||
|
||||
public ApiClient(ObjectMapper mapper, DateFormat format) {
|
||||
this(buildWebClient(mapper.copy()), format);
|
||||
public ApiClient({{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} mapper, DateFormat format) {
|
||||
this(buildWebClient(mapper), format);
|
||||
}
|
||||
|
||||
public ApiClient(WebClient webClient, ObjectMapper mapper, DateFormat format) {
|
||||
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
|
||||
public ApiClient(WebClient webClient, {{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} mapper, DateFormat format) {
|
||||
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper)), format);
|
||||
}
|
||||
|
||||
protected ApiClient(WebClient webClient, DateFormat format) {
|
||||
this.webClient = webClient;
|
||||
this.dateFormat = format;
|
||||
this.objectMapper = createDefaultObjectMapper(format);
|
||||
this.mapper = createDefaultMapper(format);
|
||||
this.init();
|
||||
}
|
||||
|
||||
@@ -150,7 +164,21 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
public static ObjectMapper createDefaultObjectMapper(@Nullable DateFormat dateFormat) {
|
||||
{{#useJackson3}}
|
||||
public static JsonMapper createDefaultMapper(@Nullable DateFormat dateFormat) {
|
||||
return JsonMapper.builder()
|
||||
.defaultDateFormat(dateFormat)
|
||||
{{#failOnUnknownProperties}}
|
||||
.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
||||
{{/failOnUnknownProperties}}
|
||||
{{^failOnUnknownProperties}}
|
||||
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
||||
{{/failOnUnknownProperties}}
|
||||
.build();
|
||||
}
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
public static ObjectMapper createDefaultMapper(@Nullable DateFormat dateFormat) {
|
||||
if (null == dateFormat) {
|
||||
dateFormat = createDefaultDateFormat();
|
||||
}
|
||||
@@ -164,6 +192,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
{{/openApiNullable}}
|
||||
return mapper;
|
||||
}
|
||||
{{/useJackson3}}
|
||||
|
||||
|
||||
protected void init() {
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
@@ -181,12 +211,18 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
* @param mapper ObjectMapper used for serialize/deserialize
|
||||
* @return WebClient
|
||||
*/
|
||||
public static WebClient.Builder buildWebClientBuilder(ObjectMapper mapper) {
|
||||
public static WebClient.Builder buildWebClientBuilder({{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} mapper) {
|
||||
ExchangeStrategies strategies = ExchangeStrategies
|
||||
.builder()
|
||||
.codecs(clientDefaultCodecsConfigurer -> {
|
||||
{{#useJackson3}}
|
||||
clientDefaultCodecsConfigurer.defaultCodecs().jacksonJsonEncoder(new JacksonJsonEncoder(mapper, MediaType.APPLICATION_JSON));
|
||||
clientDefaultCodecsConfigurer.defaultCodecs().jacksonJsonDecoder(new JacksonJsonDecoder(mapper, MediaType.APPLICATION_JSON));
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
clientDefaultCodecsConfigurer.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(mapper, MediaType.APPLICATION_JSON));
|
||||
clientDefaultCodecsConfigurer.defaultCodecs().jackson2JsonDecoder(new Jackson2JsonDecoder(mapper, MediaType.APPLICATION_JSON));
|
||||
{{/useJackson3}}
|
||||
}).build();
|
||||
WebClient.Builder webClientBuilder = WebClient.builder().exchangeStrategies(strategies);
|
||||
return webClientBuilder;
|
||||
@@ -197,7 +233,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
* @return WebClient
|
||||
*/
|
||||
public static WebClient.Builder buildWebClientBuilder() {
|
||||
return buildWebClientBuilder(createDefaultObjectMapper(null));
|
||||
return buildWebClientBuilder(createDefaultMapper(null));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,7 +241,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
* @param mapper ObjectMapper used for serialize/deserialize
|
||||
* @return WebClient
|
||||
*/
|
||||
public static WebClient buildWebClient(ObjectMapper mapper) {
|
||||
public static WebClient buildWebClient({{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} mapper) {
|
||||
return buildWebClientBuilder(mapper).build();
|
||||
}
|
||||
|
||||
@@ -214,7 +250,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
* @return WebClient
|
||||
*/
|
||||
public static WebClient buildWebClient() {
|
||||
return buildWebClientBuilder(createDefaultObjectMapper(null)).build();
|
||||
return buildWebClientBuilder(createDefaultMapper(null)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -403,11 +439,11 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ObjectMapper used to make HTTP requests.
|
||||
* @return ObjectMapper objectMapper
|
||||
* Get the {{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} used to make HTTP requests.
|
||||
* @return {{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} mapper
|
||||
*/
|
||||
public ObjectMapper getObjectMapper() {
|
||||
return objectMapper;
|
||||
public {{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}} get{{#useJackson3}}JsonMapper{{/useJackson3}}{{^useJackson3}}ObjectMapper{{/useJackson3}}() {
|
||||
return mapper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -457,8 +493,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
valueCollection = (Collection<?>) value;
|
||||
} else {
|
||||
try {
|
||||
return parameterToMultiValueMap(collectionFormat, name, objectMapper.writeValueAsString(value));
|
||||
} catch (JsonProcessingException e) {
|
||||
return parameterToMultiValueMap(collectionFormat, name, mapper.writeValueAsString(value));
|
||||
} catch ({{#useJackson3}}JacksonException{{/useJackson3}}{{^useJackson3}}JsonProcessingException{{/useJackson3}} e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
@@ -466,8 +502,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
List<String> values = new ArrayList<>();
|
||||
for(Object o : valueCollection) {
|
||||
try {
|
||||
values.add(objectMapper.writeValueAsString(o));
|
||||
} catch (JsonProcessingException e) {
|
||||
values.add(mapper.writeValueAsString(o));
|
||||
} catch ({{#useJackson3}}JacksonException{{/useJackson3}}{{^useJackson3}}JsonProcessingException{{/useJackson3}} e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,14 +125,19 @@ if(hasProperty('target') && target == 'android') {
|
||||
|
||||
ext {
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
swagger_annotations_version = "1.6.3"
|
||||
swagger_annotations_version = "1.6.16"
|
||||
{{/swagger1AnnotationLibrary}}
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
swagger_annotations_version = "2.2.9"
|
||||
swagger_annotations_version = "2.2.43"
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
{{#useJakartaEe}}
|
||||
spring_boot_version = "3.2.12"
|
||||
jakarta_annotation_version = "2.1.1"
|
||||
{{^useSpringBoot4}}
|
||||
spring_boot_version = "3.5.11"
|
||||
{{/useSpringBoot4}}
|
||||
{{#useSpringBoot4}}
|
||||
spring_boot_version = "4.0.3"
|
||||
{{/useSpringBoot4}}
|
||||
jakarta_annotation_version = "3.0.0"
|
||||
beanvalidation_version = "3.0.2"
|
||||
reactor_version = "3.5.12"
|
||||
reactor_netty_version = "1.2.8"
|
||||
@@ -144,13 +149,18 @@ ext {
|
||||
reactor_version = "3.4.34"
|
||||
reactor_netty_version = "1.2.8"
|
||||
{{/useJakartaEe}}
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#useJackson3}}
|
||||
jackson_version = "3.1.0"
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
jackson_version = "2.21.1"
|
||||
{{/useJackson3}}
|
||||
jackson_annotations_version = "2.21"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.9"
|
||||
{{/openApiNullable}}
|
||||
{{#joda}}
|
||||
jodatime_version = "2.9.9"
|
||||
jodatime_version = "2.14.0"
|
||||
{{/joda}}
|
||||
junit_version = "5.10.2"
|
||||
}
|
||||
@@ -166,17 +176,18 @@ dependencies {
|
||||
implementation "io.projectreactor:reactor-core:$reactor_version"
|
||||
implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
|
||||
implementation "io.projectreactor.netty:reactor-netty-http:$reactor_netty_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 "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||
implementation "{{jacksonPackage}}.core:jackson-core:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_annotations_version"
|
||||
implementation "{{jacksonPackage}}.core:jackson-databind:$jackson_version"
|
||||
{{#openApiNullable}}
|
||||
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||
{{/openApiNullable}}
|
||||
{{#joda}}
|
||||
implementation "joda-time:joda-time:$jodatime_version"
|
||||
{{/joda}}
|
||||
{{^useJackson3}}
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||
{{/useJackson3}}
|
||||
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.io.Serializable;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
{{#withXml}}
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.*;
|
||||
import {{jacksonPackage}}.dataformat.xml.annotation.*;
|
||||
{{/withXml}}
|
||||
{{#vendorExtensions.x-has-readonly-properties}}
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
|
||||
@@ -114,10 +114,20 @@
|
||||
</dependency>
|
||||
|
||||
<!-- JSON processing: jackson -->
|
||||
<dependency>
|
||||
<groupId>{{jacksonPackage}}.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-annotations-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>{{jacksonPackage}}.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-databind-version}</version>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{#openApiNullable}}
|
||||
<dependency>
|
||||
@@ -127,14 +137,16 @@
|
||||
</dependency>
|
||||
{{/openApiNullable}}
|
||||
|
||||
{{^useJackson3}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/useJackson3}}
|
||||
{{#joda}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<groupId>{{jacksonPackage}}.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
@@ -162,18 +174,27 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
<swagger-annotations-version>1.6.6</swagger-annotations-version>
|
||||
<swagger-annotations-version>1.6.16</swagger-annotations-version>
|
||||
{{/swagger1AnnotationLibrary}}
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
<swagger-annotations-version>2.2.15</swagger-annotations-version>
|
||||
<swagger-annotations-version>2.2.43</swagger-annotations-version>
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
{{#useJackson3}}
|
||||
<jackson-version>3.1.0</jackson-version>
|
||||
{{/useJackson3}}
|
||||
{{^useJackson3}}
|
||||
<jackson-version>2.21.1</jackson-version>
|
||||
{{/useJackson3}}
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#useJakartaEe}}
|
||||
<spring-boot-version>3.2.12</spring-boot-version>
|
||||
{{^useSpringBoot4}}
|
||||
<spring-boot-version>3.5.11</spring-boot-version>
|
||||
{{/useSpringBoot4}}
|
||||
{{#useSpringBoot4}}
|
||||
<spring-boot-version>4.0.3</spring-boot-version>
|
||||
{{/useSpringBoot4}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
<reactor-version>3.5.12</reactor-version>
|
||||
<reactor-netty-version>1.2.8</reactor-netty-version>
|
||||
@@ -184,9 +205,10 @@
|
||||
<reactor-version>3.4.34</reactor-version>
|
||||
<reactor-netty-version>1.2.8</reactor-netty-version>
|
||||
{{/useJakartaEe}}
|
||||
<junit-version>5.10.2</junit-version>
|
||||
<jackson-annotations-version>2.21</jackson-annotations-version>
|
||||
<junit-version>5.14.3</junit-version>
|
||||
{{#joda}}
|
||||
<jodatime-version>2.9.9</jodatime-version>
|
||||
<jodatime-version>2.14.0</jodatime-version>
|
||||
{{/joda}}
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@@ -62,7 +62,7 @@ import java.net.URI;
|
||||
{{/jackson}}
|
||||
public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) {
|
||||
for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||
if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) {
|
||||
if (b.value.equals{{#isString}}{{#useEnumCaseInsensitive}}IgnoreCase{{/useEnumCaseInsensitive}}{{/isString}}(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
{{/jackson}}
|
||||
public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) {
|
||||
for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||
if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) {
|
||||
if (b.value.equals{{#isString}}{{#useEnumCaseInsensitive}}IgnoreCase{{/useEnumCaseInsensitive}}{{/isString}}(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user