Compare commits

..

6 Commits

Author SHA1 Message Date
William Cheng
bcd0609159 update samples 2022-12-18 22:10:31 +08:00
William Cheng
5050cbfa94 add samples for java resttemplate echo api 2022-12-18 21:00:33 +08:00
William Cheng
e208fe8632 Merge branch 'issue-13393' of https://github.com/aharonha/openapi-generator into aharonha-issue-13393 2022-12-18 20:45:28 +08:00
Aharon Hacmon
d6deaf8c7b 13393: Make queryParams known to UriComponents builder so it can
properly encode them
2022-12-18 10:09:33 +02:00
Aharon Hacmon
d34ac8d13b 13393: Make queryParams known to UriComponents builder so it can
properly encode them
2022-12-18 09:47:26 +02:00
Aharon Hacmon
5a265cc419 13393: Make queryParams known to UriComponents builder so it can
properly encode them
2022-11-27 16:16:28 +02:00
1522 changed files with 3973 additions and 73917 deletions

View File

@@ -91,7 +91,5 @@ jobs:
git config --global core.safecrlf false
git config --global core.autocrlf true
mvn clean package -Dmaven.test.skip=true -Dmaven.javadoc.skip=true
# test with java (jersey2) client generation only as ensure-up-to-date script is run in another job instead
# test with java (jersey2) client generation only as ensure-uptodate script is run in another job instead
./bin/generate-samples.sh ./bin/configs/java-jersey2-8.yaml
# test debugSupportingFiles
./bin/generate-samples.sh ./bin/configs/python.yaml -- --global-property debugSupportingFiles

View File

@@ -1,30 +0,0 @@
name: Samples C# .Net Standard
on:
push:
paths:
- 'samples/client/petstore/csharp-netcore/**netstandard**/'
pull_request:
paths:
- 'samples/client/petstore/csharp-netcore/**netstandard**/'
jobs:
build:
name: Build .Net projects
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# clients
- samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: 2.1.*
- name: Build
working-directory: ${{ matrix.sample }}
run: dotnet build Org.OpenAPITools.sln
- name: Test
working-directory: ${{ matrix.sample }}
run: dotnet test Org.OpenAPITools.sln

View File

@@ -4,13 +4,11 @@ on:
push:
paths:
- 'samples/client/petstore/csharp-netcore/**net6.0**/'
- 'samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore**/'
- 'samples/server/petstore/aspnetcore-6.0/**'
- 'samples/server/petstore/aspnetcore-6.0-pocoModels/**'
pull_request:
paths:
- 'samples/client/petstore/csharp-netcore/**net6.0**/'
- 'samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore**/'
- 'samples/server/petstore/aspnetcore-6.0/**'
- 'samples/server/petstore/aspnetcore-6.0-pocoModels/**'
jobs:
@@ -24,9 +22,6 @@ jobs:
# clients
- samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0
- samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt
- samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-allOf
- samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-oneOf
- samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-anyOf
- samples/server/petstore/aspnetcore-6.0
- samples/server/petstore/aspnetcore-6.0-pocoModels
- samples/server/petstore/aspnetcore-6.0-project4Models

View File

@@ -19,6 +19,7 @@ jobs:
- samples/client/echo_api/java/apache-httpclient
- samples/client/echo_api/java/native
- samples/client/echo_api/java/feign-gson
- samples/client/echo_api/java/resttemplate
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3

View File

@@ -8,7 +8,7 @@ on:
- samples/client/petstore/java-micronaut-client/**
- samples/openapi3/client/petstore/java/jersey2-java8-special-characters/**
- samples/openapi3/client/petstore/java/jersey2-java8-swagger1/**
- samples/openapi3/client/petstore/java/native**
- samples/openapi3/client/petstore/java/native/**
pull_request:
paths:
- 'samples/client/petstore/java/**'
@@ -16,7 +16,7 @@ on:
- samples/client/petstore/java-micronaut-client/**
- samples/openapi3/client/petstore/java/jersey2-java8-special-characters/**
- samples/openapi3/client/petstore/java/jersey2-java8-swagger1/**
- samples/openapi3/client/petstore/java/native**
- samples/openapi3/client/petstore/java/native/**
jobs:
build:
name: Build Java Client JDK11
@@ -29,7 +29,6 @@ jobs:
- samples/client/petstore/jaxrs-cxf-client
- samples/client/petstore/java/native
- samples/client/petstore/java/native-async
- samples/client/petstore/java/native-jakarta
- samples/client/petstore/java/retrofit2
- samples/client/petstore/java/retrofit2rx2
- samples/client/petstore/java/retrofit2rx3

View File

@@ -1,39 +0,0 @@
name: Samples Java Client JDK17
on:
push:
paths:
- samples/client/petstore/java/resttemplate-jakarta/**
- samples/client/petstore/java/webclient-jakarta/**
pull_request:
paths:
- samples/client/petstore/java/resttemplate-jakarta/**
- samples/client/petstore/java/webclient-jakarta/**
jobs:
build:
name: Build Java Client JDK17
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# clients
- samples/client/petstore/java/resttemplate-jakarta
- samples/client/petstore/java/webclient-jakarta
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Cache maven dependencies
uses: actions/cache@v3
env:
cache-name: maven-repository
with:
path: |
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Build
working-directory: ${{ matrix.sample }}
run: mvn clean package

View File

@@ -1,49 +0,0 @@
name: Samples Java Server
on:
push:
paths:
# java-camel is tested locally for the time being
#- 'samples/server/petstore/java-camel/**'
- 'samples/server/petstore/java-vertx-web/**'
- 'samples/server/petstore/java-inflector/**'
- 'samples/server/petstore/java-pkmst/**'
- 'samples/server/petstore/java-undertow/**'
pull_request:
paths:
#- 'samples/server/petstore/java-camel/**'
- 'samples/server/petstore/java-vertx-web/**'
- 'samples/server/petstore/java-inflector/**'
- 'samples/server/petstore/java-pkmst/**'
- 'samples/server/petstore/java-undertow/**'
jobs:
build:
name: Build Java Server
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# servers
#- samples/server/petstore/java-camel/
- samples/server/petstore/java-vertx-web/
- samples/server/petstore/java-inflector/
- samples/server/petstore/java-pkmst/
- samples/server/petstore/java-undertow/
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v3
env:
cache-name: maven-repository
with:
path: |
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Build
working-directory: ${{ matrix.sample }}
run: mvn clean package

View File

@@ -71,7 +71,7 @@ before_install:
# install rust
- curl https://sh.rustup.rs -sSf | sh -s -- -y -v
# required when sudo: required for the Ruby petstore tests
- gem install bundler -v 2.3.26
- gem install bundler
# set python 3.6.3 as default
- source ~/virtualenv/python3.6/bin/activate
# -- skip bash test to shorten build time

View File

@@ -877,8 +877,6 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2022-10-01 - [OpenAPI Generatorをカスタマイズしたコードを生成するSwagger Codegenとほぼ同じ](https://nainaistar.hatenablog.com/entry/2022/10/03/120000) by [きり丸](https://twitter.com/nainaistar)
- 2022-10-21 - [KotlinSpring Bootの API を OpenAPI Generator で自動生成](https://zenn.dev/msksgm/articles/20221021-kotlin-spring-openapi-generator) by [msksgm](https://zenn.dev/msksgm)
- 2022-10-26 - [Quarkus Insights #106: Quarkiverse Extension Spotlight: OpenApi Generator](https://www.youtube.com/watch?v=_s_if69t2iQ) by [Quarkusio](https://www.youtube.com/c/Quarkusio)
- 2022-11-28 - [The REST API implementation flow](https://tmsvr.com/openapi-code-generation-for-rest-apis/) by [Imre Tömösvári](https://tmsvr.com/author/imre/)
- 2022-12-13 - [API-First with Spring WebFlux and OpenAPI Generator](https://boottechnologies-ci.medium.com/api-first-with-spring-webflux-and-openapi-generator-38b7804c4ed4) by [Eric Anicet](https://boottechnologies-ci.medium.com/)
## [6 - About Us](#table-of-contents)

View File

@@ -1,12 +0,0 @@
# for csharp-netcore generichost
generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-allOf
inputSpec: modules/openapi-generator/src/test/resources/3_0/allOf.yaml
library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
useCompareNetObjects: true
disallowAdditionalPropertiesIfNotPresent: false
targetFramework: net7.0
nullableReferenceTypes: true

View File

@@ -1,12 +0,0 @@
# for csharp-netcore generichost
generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-anyOf
inputSpec: modules/openapi-generator/src/test/resources/3_0/anyOf.yaml
library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
useCompareNetObjects: true
disallowAdditionalPropertiesIfNotPresent: false
targetFramework: net7.0
nullableReferenceTypes: true

View File

@@ -1,12 +0,0 @@
# for csharp-netcore generichost
generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-oneOf
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf.yaml
library: generichost
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
useCompareNetObjects: true
disallowAdditionalPropertiesIfNotPresent: false
targetFramework: net7.0
nullableReferenceTypes: true

View File

@@ -1,9 +0,0 @@
generatorName: java
outputDir: samples/client/petstore/java/native-jakarta
library: native
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-native-jakarta
hideGenerationTimestamp: "true"
useJakartaEe: "true"

View File

@@ -0,0 +1,8 @@
generatorName: java
outputDir: samples/client/echo_api/java/resttemplate
library: resttemplate
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: echo-api-resttemplate
hideGenerationTimestamp: "true"

View File

@@ -1,10 +0,0 @@
generatorName: java
outputDir: samples/client/petstore/java/resttemplate-jakarta
library: resttemplate
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-resttemplate
hideGenerationTimestamp: "true"
java8: true
useJakartaEe: true

View File

@@ -1,9 +0,0 @@
generatorName: java
outputDir: samples/client/petstore/java/webclient-jakarta
library: webclient
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-webclient
hideGenerationTimestamp: "true"
useJakartaEe: true

View File

@@ -8,4 +8,3 @@ additionalProperties:
snapshotVersion: "true"
hideGenerationTimestamp: "true"
camelCaseDollarSign: "true"
modelNameSuffix: 'Dto'

View File

@@ -1,10 +0,0 @@
generatorName: swift5
outputDir: samples/client/petstore/swift5/validation
inputSpec: modules/openapi-generator/src/test/resources/3_0/validation.yaml
templateDir: modules/openapi-generator/src/main/resources/swift5
generateAliasAsModel: true
additionalProperties:
podAuthors: ""
podSummary: PetstoreClient
projectName: PetstoreClient
podHomepage: https://github.com/openapitools/openapi-generator

View File

@@ -1,4 +0,0 @@
generatorName: typescript-fetch
outputDir: samples/client/petstore/typescript-fetch/builds/allOf-nullable
inputSpec: modules/openapi-generator/src/test/resources/3_0/allOf-nullable.yaml
templateDir: modules/openapi-generator/src/main/resources/typescript-fetch

View File

@@ -451,16 +451,3 @@ Another useful option is `inlineSchemaNameDefaults`, which allows you to customi
```
Note: Only arrayItemSuffix, mapItemSuffix are supported at the moment. `SKIP_SCHEMA_REUSE=true` is a special value to skip reusing inline schemas.
## OpenAPI Normalizer
OpenAPI Normalizer (off by default) transforms the input OpenAPI doc/spec (which may not perfectly conform to the specification) to make it workable with OpenAPI Generator. Here is a list of rules supported:
- `REF_AS_PARENT_IN_ALLOF`: when set to `true`, child schemas in `allOf` is considered a parent if it's a `$ref` (instead of inline schema)
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/allOf_extension_parent.yaml -o /tmp/java-okhttp/ --additional-properties hideGenerationTimestamp="true" --openapi-normalizer REF_AS_PARENT_IN_ALLOF=true
```

View File

@@ -63,7 +63,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/main/groovy|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
## SUPPORTED VENDOR EXTENSIONS

View File

@@ -93,9 +93,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useOptional|Use Optional container for optional parameters| |false|
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports).| |false|
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports).| |true|
|useSpringController|Annotate the generated API as a Spring Controller| |false|
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|useTags|use tags for creating interface and controller classnames| |false|

View File

@@ -60,7 +60,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/main/java|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
## SUPPORTED VENDOR EXTENSIONS

View File

@@ -63,7 +63,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|useAbstractClass|Whether to generate abstract classes for REST API instead of interfaces.| |false|
|useBeanValidation|Use Bean Validation| |false|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
## SUPPORTED VENDOR EXTENSIONS

View File

@@ -65,7 +65,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/gen/java|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
## SUPPORTED VENDOR EXTENSIONS

View File

@@ -80,7 +80,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|title|Client service name| |null|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useOptional|Use Optional container for optional parameters| |false|
|visitable|Generate visitor for subtypes with a discriminator| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -82,7 +82,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|title|Client service name| |null|
|useAuth|Whether to import authorization and to annotate controller methods accordingly| |true|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useOptional|Use Optional container for optional parameters| |false|
|visitable|Generate visitor for subtypes with a discriminator| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -70,7 +70,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|title|a title describing the application| |OpenAPI Server|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useTags|use tags for creating interface and controller classnames| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -71,7 +71,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|springBootAdminUri|Spring-Boot URI| |null|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|title|server title name or client service name| |null|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|zipkinUri|Zipkin URI| |null|

View File

@@ -73,7 +73,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|title|server title name or client service name| |openapi-java-playframework|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useInterfaces|Makes the controllerImp implements an interface to facilitate automatic completion when updating from version x to y of your spec| |true|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useSwaggerUI|Add a route to /api which show your documentation in swagger-ui. Will also import needed dependencies| |true|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|wrapCalls|Add a wrapper to each controller function to handle things like metrics, response modification, etc..| |true|

View File

@@ -65,7 +65,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/main/java|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
## SUPPORTED VENDOR EXTENSIONS

View File

@@ -65,7 +65,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/main/java|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
## SUPPORTED VENDOR EXTENSIONS

View File

@@ -67,7 +67,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/main/java|
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|vertxSwaggerRouterVersion|Specify the version of the swagger router library| |null|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -83,7 +83,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries| |false|
|useBeanValidation|Use BeanValidation API annotations| |false|
|useGzipFeature|Send gzip-encoded requests| |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|
|usePlayWS|Use Play! Async HTTP client (Play WS API)| |false|
|useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false|

View File

@@ -76,7 +76,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|title|a title describing the application| |OpenAPI Server|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useSwaggerAnnotations|Whether to generate Swagger annotations.| |true|
|useTags|use tags for creating interface and controller classnames| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -68,7 +68,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|useBeanValidation|Use BeanValidation API annotations| |false|
|useGenericResponse|Use generic response| |false|
|useGzipFeatureForTests|Use Gzip Feature for tests| |false|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useLoggingFeatureForTests|Use Logging Feature for tests| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -84,7 +84,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|useGenericResponse|Use generic response| |false|
|useGzipFeature|Use Gzip Feature| |false|
|useGzipFeatureForTests|Use Gzip Feature for tests| |false|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useLoggingFeature|Use Logging Feature| |false|
|useLoggingFeatureForTests|Use Logging Feature for tests| |false|
|useMultipartFeature|Use Multipart Feature| |false|

View File

@@ -79,7 +79,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|useGenericResponse|Use generic response| |false|
|useGzipFeature|Use Gzip Feature| |false|
|useGzipFeatureForTests|Use Gzip Feature for tests| |false|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useLoggingFeature|Use Logging Feature| |false|
|useLoggingFeatureForTests|Use Logging Feature for tests| |false|
|useMultipartFeature|Use Multipart Feature| |false|

View File

@@ -71,7 +71,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|title|a title describing the application| |OpenAPI Server|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useTags|use tags for creating interface and controller classnames| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -70,7 +70,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|title|a title describing the application| |OpenAPI Server|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useSwaggerFeature|Use dynamic Swagger generator| |false|
|useTags|use tags for creating interface and controller classnames| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -70,7 +70,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|title|a title describing the application| |OpenAPI Server|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useTags|use tags for creating interface and controller classnames| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -76,7 +76,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|title|a title describing the application| |OpenAPI Server|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useSwaggerAnnotations|Whether to generate Swagger annotations.| |true|
|useTags|use tags for creating interface and controller classnames| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -86,9 +86,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
|useOptional|Use Optional container for optional parameters| |false|
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports).| |false|
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports).| |true|
|useSpringController|Annotate the generated API as a Spring Controller| |false|
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|useTags|use tags for creating interface and controller classnames| |false|

View File

@@ -56,7 +56,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|useCustomDateWithoutTime|Uses a custom type to decode and encode dates without time information to support OpenAPIs date format (default: false)| |false|
|useJsonEncodable|Make models conform to JSONEncodable protocol (default: true)| |true|
|useSPMFileStructure|Use SPM file structure and set the source path to Sources/{{projectName}} (default: false).| |null|
|validatable|Make validation rules and validator for model properies (default: true)| |true|
## IMPORT MAPPING

View File

@@ -24,7 +24,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|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|
|fileContentDataType|Specifies the type to use for the content of a file - i.e. Blob (Browser, Deno) / Buffer (node)| |Buffer|
|framework|Specify the framework which should be used in the client code.|<dl><dt>**fetch-api**</dt><dd>fetch-api</dd><dt>**jquery**</dt><dd>jquery</dd></dl>|fetch-api|
|importFileExtension|File extension to use with relative imports. Set it to '.js' or '.mjs' when using [ESM](https://nodejs.org/api/esm.html). Defaults to '.ts' when 'platform' is set to 'deno'.| |null|
|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|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|

View File

@@ -125,7 +125,7 @@
<dependency>
<groupId>io.airlift</groupId>
<artifactId>airline</artifactId>
<version>0.9</version>
<version>0.8</version>
</dependency>
<dependency>
<groupId>com.googlecode.lambdaj</groupId>
@@ -135,12 +135,12 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.11</version>
<version>1.2.10</version>
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>3.1.9</version>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>

View File

@@ -80,9 +80,6 @@ public class ConfigHelp extends OpenApiGeneratorCommand {
@Option(name = {"--inline-schema-name-defaults"}, title = "inline schema name defaults", description = "default values used when naming inline schema name")
private Boolean inlineSchemaNameDefaults;
@Option(name = {"--openapi-normalizer"}, title = "openapi normalizer rules", description = "displays the OpenAPI normalizer rules (none)")
private Boolean openapiNormalizer;
@Option(name = {"--metadata"}, title = "metadata", description = "displays the generator metadata like the help txt for the generator and generator type etc")
private Boolean metadata;
@@ -497,18 +494,6 @@ public class ConfigHelp extends OpenApiGeneratorCommand {
sb.append(newline);
}
if (Boolean.TRUE.equals(openapiNormalizer)) {
sb.append(newline).append("OPENAPI NORMALIZER RULES").append(newline).append(newline);
Map<String, String> map = config.openapiNormalizer()
.entrySet()
.stream()
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> {
throw new IllegalStateException(String.format(Locale.ROOT, "Duplicated options! %s and %s", a, b));
}, TreeMap::new));
writePlainTextFromMap(sb, map, optIndent, optNestedIndent, "OpenAPI normalizer rule", "Set to");
sb.append(newline);
}
if (Boolean.TRUE.equals(instantiationTypes)) {
sb.append(newline).append("INSTANTIATION TYPES").append(newline).append(newline);
Map<String, String> map = config.instantiationTypes()

View File

@@ -180,13 +180,6 @@ public class Generate extends OpenApiGeneratorCommand {
+ " ONLY arrayItemSuffix, mapItemSuffix are supported at the moment. `SKIP_SCHEMA_REUSE=true` is a special value to skip reusing inline schemas.")
private List<String> inlineSchemaNameDefaults = new ArrayList<>();
@Option(
name = {"--openapi-normalizer"},
title = "OpenAPI normalizer rules",
description = "specifies the rules to be enabled in OpenAPI normalizer in the form of RULE_1=true,RULE_2=original."
+ " You can also have multiple occurrences of this option.")
private List<String> openapiNormalizer = new ArrayList<>();
@Option(
name = {"--server-variables"},
title = "server variables",
@@ -454,7 +447,6 @@ public class Generate extends OpenApiGeneratorCommand {
applySchemaMappingsKvpList(schemaMappings, configurator);
applyInlineSchemaNameMappingsKvpList(inlineSchemaNameMappings, configurator);
applyInlineSchemaNameDefaultsKvpList(inlineSchemaNameDefaults, configurator);
applyOpenAPINormalizerKvpList(openapiNormalizer, configurator);
applyTypeMappingsKvpList(typeMappings, configurator);
applyAdditionalPropertiesKvpList(additionalProperties, configurator);
applyLanguageSpecificPrimitivesCsvList(languageSpecificPrimitives, configurator);

View File

@@ -53,7 +53,6 @@ public final class GeneratorSettings implements Serializable {
private final Map<String, String> schemaMappings;
private final Map<String, String> inlineSchemaNameMappings;
private final Map<String, String> inlineSchemaNameDefaults;
private final Map<String, String> openapiNormalizer;
private final Set<String> languageSpecificPrimitives;
private final Map<String, String> reservedWordsMappings;
private final Map<String, String> serverVariables;
@@ -265,15 +264,6 @@ public final class GeneratorSettings implements Serializable {
return inlineSchemaNameDefaults;
}
/**
* Gets OpenAPI normalizer rules
*
* @return a map of rules
*/
public Map<String, String> getOpenAPINormalizer() {
return openapiNormalizer;
}
/**
* Gets language specific primitives. These are in addition to the "base" primitives defined in a generator.
* <p>
@@ -392,7 +382,6 @@ public final class GeneratorSettings implements Serializable {
schemaMappings = Collections.unmodifiableMap(builder.schemaMappings);
inlineSchemaNameMappings = Collections.unmodifiableMap(builder.inlineSchemaNameMappings);
inlineSchemaNameDefaults = Collections.unmodifiableMap(builder.inlineSchemaNameDefaults);
openapiNormalizer = Collections.unmodifiableMap(builder.openapiNormalizer);
languageSpecificPrimitives = Collections.unmodifiableSet(builder.languageSpecificPrimitives);
reservedWordsMappings = Collections.unmodifiableMap(builder.reservedWordsMappings);
serverVariables = Collections.unmodifiableMap(builder.serverVariables);
@@ -466,7 +455,6 @@ public final class GeneratorSettings implements Serializable {
schemaMappings = Collections.unmodifiableMap(new HashMap<>(0));
inlineSchemaNameMappings = Collections.unmodifiableMap(new HashMap<>(0));
inlineSchemaNameDefaults = Collections.unmodifiableMap(new HashMap<>(0));
openapiNormalizer = Collections.unmodifiableMap(new HashMap<>(0));
languageSpecificPrimitives = Collections.unmodifiableSet(new HashSet<>(0));
reservedWordsMappings = Collections.unmodifiableMap(new HashMap<>(0));
serverVariables = Collections.unmodifiableMap(new HashMap<>(0));
@@ -527,9 +515,6 @@ public final class GeneratorSettings implements Serializable {
if (copy.getInlineSchemaNameDefaults() != null) {
builder.inlineSchemaNameDefaults.putAll(copy.getInlineSchemaNameDefaults());
}
if (copy.getOpenAPINormalizer() != null) {
builder.openapiNormalizer.putAll(copy.getOpenAPINormalizer());
}
if (copy.getLanguageSpecificPrimitives() != null) {
builder.languageSpecificPrimitives.addAll(copy.getLanguageSpecificPrimitives());
}
@@ -572,7 +557,6 @@ public final class GeneratorSettings implements Serializable {
private Map<String, String> schemaMappings;
private Map<String, String> inlineSchemaNameMappings;
private Map<String, String> inlineSchemaNameDefaults;
private Map<String, String> openapiNormalizer;
private Set<String> languageSpecificPrimitives;
private Map<String, String> reservedWordsMappings;
private Map<String, String> serverVariables;
@@ -593,7 +577,6 @@ public final class GeneratorSettings implements Serializable {
schemaMappings = new HashMap<>();
inlineSchemaNameMappings = new HashMap<>();
inlineSchemaNameDefaults = new HashMap<>();
openapiNormalizer = new HashMap<>();
languageSpecificPrimitives = new HashSet<>();
reservedWordsMappings = new HashMap<>();
serverVariables = new HashMap<>();
@@ -914,32 +897,6 @@ public final class GeneratorSettings implements Serializable {
return this;
}
/**
* Sets the {@code openapiNormalizer} and returns a reference to this Builder so that the methods can be chained together.
*
* @param openapiNormalizer the {@code openapiNormalizer} to set
* @return a reference to this Builder
*/
public Builder withOpenAPINormalizer(Map<String, String> openapiNormalizer) {
this.openapiNormalizer = openapiNormalizer;
return this;
}
/**
* Sets a single {@code openapiNormalizer} and returns a reference to this Builder so that the methods can be chained together.
*
* @param key A key for the OpenAPI normalizer rule
* @param value The value of the OpenAPI normalizer rule
* @return a reference to this Builder
*/
public Builder withOpenAPINormalizer(String key, String value) {
if (this.openapiNormalizer == null) {
this.openapiNormalizer = new HashMap<>();
}
this.openapiNormalizer.put(key, value);
return this;
}
/**
* Sets the {@code languageSpecificPrimitives} and returns a reference to this Builder so that the methods can be chained together.
*
@@ -1128,7 +1085,6 @@ public final class GeneratorSettings implements Serializable {
Objects.equals(getSchemaMappings(), that.getSchemaMappings()) &&
Objects.equals(getInlineSchemaNameMappings(), that.getInlineSchemaNameMappings()) &&
Objects.equals(getInlineSchemaNameDefaults(), that.getInlineSchemaNameDefaults()) &&
Objects.equals(getOpenAPINormalizer(), that.getOpenAPINormalizer()) &&
Objects.equals(getLanguageSpecificPrimitives(), that.getLanguageSpecificPrimitives()) &&
Objects.equals(getReservedWordsMappings(), that.getReservedWordsMappings()) &&
Objects.equals(getGitHost(), that.getGitHost()) &&
@@ -1160,7 +1116,6 @@ public final class GeneratorSettings implements Serializable {
getSchemaMappings(),
getInlineSchemaNameMappings(),
getInlineSchemaNameDefaults(),
getOpenAPINormalizer(),
getLanguageSpecificPrimitives(),
getReservedWordsMappings(),
getGitHost(),

View File

@@ -118,7 +118,6 @@ class OpenApiGeneratorPlugin : Plugin<Project> {
schemaMappings.set(generate.schemaMappings)
inlineSchemaNameMappings.set(generate.inlineSchemaNameMappings)
inlineSchemaNameDefaults.set(generate.inlineSchemaNameDefaults)
openapiNormalizer.set(generate.openapiNormalizer)
invokerPackage.set(generate.invokerPackage)
groupId.set(generate.groupId)
id.set(generate.id)

View File

@@ -162,11 +162,6 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
*/
val inlineSchemaNameDefaults = project.objects.mapProperty<String, String>()
/**
* Specifies mappings (rules) in OpenAPI normalizer
*/
val openapiNormalizer = project.objects.mapProperty<String, String>()
/**
* Root package for generated code.
*/

View File

@@ -250,13 +250,6 @@ open class GenerateTask : DefaultTask() {
@Input
val inlineSchemaNameDefaults = project.objects.mapProperty<String, String>()
/**
* Specifies mappings (rules) in OpenAPI normalizer
*/
@Optional
@Input
val openapiNormalizer = project.objects.mapProperty<String, String>()
/**
* Root package for generated code.
*/
@@ -765,12 +758,6 @@ open class GenerateTask : DefaultTask() {
}
}
if (openapiNormalizer.isPresent) {
openapiNormalizer.get().forEach { entry ->
configurator.addOpenAPINormalizer(entry.key, entry.value)
}
}
if (typeMappings.isPresent) {
typeMappings.get().forEach { entry ->
configurator.addTypeMapping(entry.key, entry.value)

View File

@@ -315,12 +315,6 @@ public class CodeGenMojo extends AbstractMojo {
@Parameter(name = "inlineSchemaNameDefaults", property = "openapi.generator.maven.plugin.inlineSchemaNameDefaults")
private List<String> inlineSchemaNameDefaults;
/**
* A set of rules for OpenAPI normalizer
*/
@Parameter(name = "openapiNormalizer", property = "openapi.generator.maven.plugin.openapiNormalizer")
private List<String> openapiNormalizer;
/**
* A map of swagger spec types and the generated code types to use for them
*/
@@ -706,12 +700,6 @@ public class CodeGenMojo extends AbstractMojo {
configurator);
}
// Retained for backwards-compatibility with configOptions -> openapi-normalizer
if (openapiNormalizer == null && configOptions.containsKey("openapi-normalizer")) {
applyOpenAPINormalizerKvp(configOptions.get("openapi-normalizer").toString(),
configurator);
}
// Retained for backwards-compatibility with configOptions -> type-mappings
if (typeMappings == null && configOptions.containsKey("type-mappings")) {
applyTypeMappingsKvp(configOptions.get("type-mappings").toString(), configurator);
@@ -765,11 +753,6 @@ public class CodeGenMojo extends AbstractMojo {
applyInlineSchemaNameDefaultsKvpList(inlineSchemaNameDefaults, configurator);
}
// Apply OpenAPI normalizer rules
if (openapiNormalizer != null && (configOptions == null || !configOptions.containsKey("openapi-normalizer"))) {
applyOpenAPINormalizerKvpList(openapiNormalizer, configurator);
}
// Apply Type Mappings
if (typeMappings != null && (configOptions == null || !configOptions.containsKey("type-mappings"))) {
applyTypeMappingsKvpList(typeMappings, configurator);

View File

@@ -333,7 +333,7 @@
<dependency>
<groupId>com.github.javaparser</groupId>
<artifactId>javaparser-core</artifactId>
<version>3.24.9</version>
<version>3.24.0</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -356,7 +356,7 @@
<dependency>
<groupId>org.commonmark</groupId>
<artifactId>commonmark</artifactId>
<version>0.21.0</version>
<version>0.20.0</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>

View File

@@ -147,8 +147,6 @@ public interface CodegenConfig {
Map<String, String> inlineSchemaNameDefault();
Map<String, String> openapiNormalizer();
Map<String, String> apiTemplateFiles();
Map<String, String> modelTemplateFiles();
@@ -332,7 +330,4 @@ public interface CodegenConfig {
boolean getUseInlineModelResolver();
boolean getAddSuffixToDuplicateOperationNicknames();
boolean getUseOpenAPINormalizer();
}

View File

@@ -207,7 +207,7 @@ public class CodegenOperation {
* returns a map where the key is the request body content type and the value is the current CodegenOperation
* this is needed by templates when a different signature is needed for each request body content type
*/
public Map<String, CodegenOperation> contentTypeToOperation() {
public Map<String, CodegenOperation> getContentTypeToOperation() {
LinkedHashMap<String, CodegenOperation> contentTypeToOperation = new LinkedHashMap<>();
if (bodyParam == null) {
return null;

View File

@@ -167,8 +167,6 @@ public class DefaultCodegen implements CodegenConfig {
protected Map<String, String> inlineSchemaNameMapping = new HashMap<>();
// a map to store the inline schema naming conventions
protected Map<String, String> inlineSchemaNameDefault = new HashMap<>();
// a map to store the rules in OpenAPI Normalizer
protected Map<String, String> openapiNormalizer = new HashMap<>();
protected String modelPackage = "", apiPackage = "", fileSuffix;
protected String modelNamePrefix = "", modelNameSuffix = "";
protected String apiNamePrefix = "", apiNameSuffix = "Api";
@@ -1139,11 +1137,6 @@ public class DefaultCodegen implements CodegenConfig {
return inlineSchemaNameDefault;
}
@Override
public Map<String, String> openapiNormalizer() {
return openapiNormalizer;
}
@Override
public String testPackage() {
return testPackage;
@@ -6462,7 +6455,7 @@ public class DefaultCodegen implements CodegenConfig {
return result;
}
public void writePropertyBack(String propertyKey, Object value) {
public void writePropertyBack(String propertyKey, boolean value) {
additionalProperties.put(propertyKey, value);
}
@@ -7946,9 +7939,6 @@ public class DefaultCodegen implements CodegenConfig {
@Override
public boolean getUseInlineModelResolver() { return true; }
@Override
public boolean getUseOpenAPINormalizer() { return true; }
/*
A function to convert yaml or json ingested strings like property names
And convert special characters like newline, tab, carriage return

View File

@@ -255,12 +255,6 @@ public class DefaultGenerator implements Generator {
config.processOpts();
// normalize the spec
if (config.getUseOpenAPINormalizer()) {
OpenAPINormalizer openapiNormalizer = new OpenAPINormalizer(openAPI, config.openapiNormalizer());
openapiNormalizer.normalize();
}
// resolve inline models
if (config.getUseInlineModelResolver()) {
InlineModelResolver inlineModelResolver = new InlineModelResolver();

View File

@@ -196,16 +196,11 @@ public class InlineModelResolver {
// allOf, anyOf, oneOf
ComposedSchema m = (ComposedSchema) schema;
boolean isSingleAllOf = m.getAllOf() != null && m.getAllOf().size() == 1;
boolean isReadOnly = m.getReadOnly() != null && m.getReadOnly();
boolean isNullable = m.getNullable() != null && m.getNullable();
if (isSingleAllOf && (isReadOnly || isNullable)) {
// Check if this composed schema only contains an allOf and a readOnly or nullable.
if (m.getAllOf() != null && m.getAllOf().size() == 1 && m.getReadOnly() != null && m.getReadOnly()) {
// Check if this composed schema only contains an allOf and a readOnly.
ComposedSchema c = new ComposedSchema();
c.setAllOf(m.getAllOf());
c.setReadOnly(m.getReadOnly());
c.setNullable(m.getNullable());
c.setReadOnly(true);
if (m.equals(c)) {
return isModelNeeded(m.getAllOf().get(0), visitedSchemas);
}

View File

@@ -1,384 +0,0 @@
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen;
import io.swagger.v3.oas.models.*;
import io.swagger.v3.oas.models.callbacks.Callback;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.responses.ApiResponses;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.stream.Collectors;
public class OpenAPINormalizer {
private OpenAPI openAPI;
private Map<String, String> rules = new HashMap<>();
final Logger LOGGER = LoggerFactory.getLogger(OpenAPINormalizer.class);
// ============= a list of rules =============
// when set to true, all rules are enabled
final String ALL = "ALL";
boolean enableAll;
// when set to true, $ref in allOf is treated as parent so that x-parent: true will be added
// to the schema in $ref (if x-parent is not present)
final String REF_AS_PARENT_IN_ALLOF = "REF_AS_PARENT_IN_ALLOF";
boolean enableRefAsParentInAllOf;
// ============= end of rules =============
/**
* Initializes OpenAPI Normalizer with a set of rules
*
* @param openAPI OpenAPI
* @param rules a map of rules
*/
public OpenAPINormalizer(OpenAPI openAPI, Map<String, String> rules) {
this.openAPI = openAPI;
this.rules = rules;
parseRules(rules);
}
/**
* Parses the rules.
*
* @param rules a map of rules
*/
public void parseRules(Map<String, String> rules) {
if (rules == null) {
return;
}
if ("true".equalsIgnoreCase(rules.get(ALL))) {
enableAll = true;
}
if (enableAll || "true".equalsIgnoreCase(rules.get(REF_AS_PARENT_IN_ALLOF))) {
enableRefAsParentInAllOf = true;
}
}
/**
* Normalizes the OpenAPI input, which may not perfectly conform to
* the specification.
*/
void normalize() {
if (rules == null || rules.isEmpty()) {
return;
}
if (this.openAPI.getComponents() == null) {
this.openAPI.setComponents(new Components());
}
if (this.openAPI.getComponents().getSchemas() == null) {
this.openAPI.getComponents().setSchemas(new HashMap<String, Schema>());
}
normalizePaths();
normalizeComponents();
}
/**
* Normalizes inline models in Paths
*/
private void normalizePaths() {
Paths paths = openAPI.getPaths();
if (paths == null) {
return;
}
for (Map.Entry<String, PathItem> pathsEntry : paths.entrySet()) {
PathItem path = pathsEntry.getValue();
List<Operation> operations = new ArrayList<>(path.readOperations());
// Include callback operation as well
for (Operation operation : path.readOperations()) {
Map<String, Callback> callbacks = operation.getCallbacks();
if (callbacks != null) {
operations.addAll(callbacks.values().stream()
.flatMap(callback -> callback.values().stream())
.flatMap(pathItem -> pathItem.readOperations().stream())
.collect(Collectors.toList()));
}
}
for (Operation operation : operations) {
normalizeRequestBody(operation);
normalizeParameters(operation);
normalizeResponses(operation);
}
}
}
/**
* Normalizes schemas in content
*
* @param content target content
*/
private void normalizeContent(Content content) {
if (content == null || content.isEmpty()) {
return;
}
for (String contentType : content.keySet()) {
MediaType mediaType = content.get(contentType);
if (mediaType == null) {
continue;
} else if (mediaType.getSchema() == null) {
continue;
} else {
normalizeSchema(mediaType.getSchema(), new HashSet<>());
}
}
}
/**
* Normalizes schemas in RequestBody
*
* @param operation target operation
*/
private void normalizeRequestBody(Operation operation) {
RequestBody requestBody = operation.getRequestBody();
if (requestBody == null) {
return;
}
// unalias $ref
if (requestBody.get$ref() != null) {
String ref = ModelUtils.getSimpleRef(requestBody.get$ref());
requestBody = openAPI.getComponents().getRequestBodies().get(ref);
if (requestBody == null) {
return;
}
}
normalizeContent(requestBody.getContent());
}
/**
* Normalizes schemas in parameters
*
* @param operation target operation
*/
private void normalizeParameters(Operation operation) {
List<Parameter> parameters = operation.getParameters();
if (parameters == null) {
return;
}
for (Parameter parameter : parameters) {
if (parameter.getSchema() == null) {
continue;
} else {
normalizeSchema(parameter.getSchema(), new HashSet<>());
}
}
}
/**
* Normalizes schemas in ApiResponses
*
* @param operation target operation
*/
private void normalizeResponses(Operation operation) {
ApiResponses responses = operation.getResponses();
if (responses == null) {
return;
}
for (Map.Entry<String, ApiResponse> responsesEntry : responses.entrySet()) {
if (responsesEntry.getValue() == null) {
continue;
} else {
normalizeContent(responsesEntry.getValue().getContent());
}
}
}
/**
* Normalizes schemas in components
*/
private void normalizeComponents() {
Map<String, Schema> schemas = openAPI.getComponents().getSchemas();
if (schemas == null) {
return;
}
List<String> schemaNames = new ArrayList<String>(schemas.keySet());
for (String schemaName : schemaNames) {
Schema schema = schemas.get(schemaName);
if (schema == null) {
LOGGER.warn("{} not fount found in openapi/components/schemas.", schemaName);
} else {
normalizeSchema(schema, new HashSet<>());
}
}
}
/**
* Normalizes a schema
*
* @param schema Schema
* @param visitedSchemas a set of visited schemas
*/
public void normalizeSchema(Schema schema, Set<Schema> visitedSchemas) {
if (schema == null) {
return;
}
if (StringUtils.isNotEmpty(schema.get$ref())) {
// not need to process $ref
return;
}
if ((visitedSchemas.contains(schema))) {
return; // skip due to circular reference
} else {
visitedSchemas.add(schema);
}
if (schema instanceof ArraySchema) {
normalizeSchema(schema.getItems(), visitedSchemas);
} else if (schema.getAdditionalProperties() instanceof Schema) { // map
normalizeSchema((Schema) schema.getAdditionalProperties(), visitedSchemas);
} else if (ModelUtils.isComposedSchema(schema)) {
ComposedSchema m = (ComposedSchema) schema;
if (m.getAllOf() != null && !m.getAllOf().isEmpty()) {
normalizeAllOf(m, visitedSchemas);
}
if (m.getOneOf() != null && !m.getOneOf().isEmpty()) {
normalizeOneOf(m, visitedSchemas);
}
if (m.getAnyOf() != null && !m.getAnyOf().isEmpty()) {
normalizeAnyOf(m, visitedSchemas);
}
if (m.getProperties() != null && !m.getProperties().isEmpty()) {
normalizeProperties(m.getProperties(), visitedSchemas);
}
if (m.getAdditionalProperties() != null) {
// normalizeAdditionalProperties(m);
}
} else if (schema.getNot() != null) {// not schema
normalizeSchema(schema.getNot(), visitedSchemas);
} else if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
normalizeProperties(schema.getProperties(), visitedSchemas);
} else if (schema instanceof Schema) {
normalizeNonComposedSchema(schema, visitedSchemas);
} else {
throw new RuntimeException("Unknown schema type found in normalizer: " + schema);
}
}
private void normalizeNonComposedSchema(Schema schema, Set<Schema> visitedSchemas) {
// normalize non-composed schema (e.g. schema with only properties)
}
private void normalizeProperties(Map<String, Schema> properties, Set<Schema> visitedSchemas) {
if (properties == null) {
return;
}
for (Map.Entry<String, Schema> propertiesEntry : properties.entrySet()) {
Schema property = propertiesEntry.getValue();
normalizeSchema(property, visitedSchemas);
}
}
private void normalizeAllOf(Schema schema, Set<Schema> visitedSchemas) {
for (Object item : schema.getAllOf()) {
if (!(item instanceof Schema)) {
throw new RuntimeException("Error! allOf schema is not of the type Schema: " + item);
}
// normalize allOf sub schemas one by one
normalizeSchema((Schema) item, visitedSchemas);
}
// process rules here
processUseAllOfRefAsParent(schema);
}
private void normalizeOneOf(Schema schema, Set<Schema> visitedSchemas) {
for (Object item : schema.getAllOf()) {
if (!(item instanceof Schema)) {
throw new RuntimeException("Error! allOf schema is not of the type Schema: " + item);
}
// normalize oenOf sub schemas one by one
normalizeSchema((Schema) item, visitedSchemas);
}
// process rules here
}
private void normalizeAnyOf(Schema schema, Set<Schema> visitedSchemas) {
for (Object item : schema.getAllOf()) {
if (!(item instanceof Schema)) {
throw new RuntimeException("Error! allOf schema is not of the type Schema: " + item);
}
// normalize anyOf sub schemas one by one
normalizeSchema((Schema) item, visitedSchemas);
}
// process rules here
}
// ===================== a list of rules =====================
// all rules (fuctions) start with the word "process"
private void processUseAllOfRefAsParent(Schema schema) {
if (!enableRefAsParentInAllOf) {
return;
}
for (Object item : schema.getAllOf()) {
if (!(item instanceof Schema)) {
throw new RuntimeException("Error! allOf schema is not of the type Schema: " + item);
}
Schema s = (Schema) item;
if (StringUtils.isNotEmpty(s.get$ref())) {
String ref = ModelUtils.getSimpleRef(s.get$ref());
// TODO need to check for requestBodies?
Schema refSchema = openAPI.getComponents().getSchemas().get(ref);
if (refSchema == null) {
throw new RuntimeException("schema cannot be null with ref " + ref);
}
if (refSchema.getExtensions() == null) {
refSchema.setExtensions(new HashMap<>());
}
if (refSchema.getExtensions().containsKey("x-parent")) {
// doing nothing as x-parent already exists
} else {
refSchema.getExtensions().put("x-parent", true);
}
LOGGER.debug("processUseAllOfRefAsParent added `x-parent: true` to {}", refSchema);
}
}
}
// ===================== end of rules =====================
}

View File

@@ -71,7 +71,6 @@ public class CodegenConfigurator {
private Map<String, String> schemaMappings = new HashMap<>();
private Map<String, String> inlineSchemaNameMappings = new HashMap<>();
private Map<String, String> inlineSchemaNameDefaults = new HashMap<>();
private Map<String, String> openapiNormalizer = new HashMap<>();
private Set<String> languageSpecificPrimitives = new HashSet<>();
private Map<String, String> reservedWordsMappings = new HashMap<>();
private Map<String, String> serverVariables = new HashMap<>();
@@ -124,9 +123,6 @@ public class CodegenConfigurator {
if(generatorSettings.getInlineSchemaNameDefaults() != null) {
configurator.inlineSchemaNameDefaults.putAll(generatorSettings.getInlineSchemaNameDefaults());
}
if(generatorSettings.getOpenAPINormalizer() != null) {
configurator.openapiNormalizer.putAll(generatorSettings.getOpenAPINormalizer());
}
if(generatorSettings.getLanguageSpecificPrimitives() != null) {
configurator.languageSpecificPrimitives.addAll(generatorSettings.getLanguageSpecificPrimitives());
}
@@ -214,12 +210,6 @@ public class CodegenConfigurator {
return this;
}
public CodegenConfigurator addOpenAPINormalizer(String key, String value) {
this.openapiNormalizer.put(key, value);
generatorSettingsBuilder.withOpenAPINormalizer(key, value);
return this;
}
public CodegenConfigurator addInstantiationType(String key, String value) {
this.instantiationTypes.put(key, value);
generatorSettingsBuilder.withInstantiationType(key, value);
@@ -392,12 +382,6 @@ public class CodegenConfigurator {
return this;
}
public CodegenConfigurator setOpenAPINormalizer(Map<String, String> openapiNormalizer) {
this.openapiNormalizer = openapiNormalizer;
generatorSettingsBuilder.withOpenAPINormalizer(openapiNormalizer);
return this;
}
public CodegenConfigurator setInputSpec(String inputSpec) {
this.inputSpec = inputSpec;
workflowSettingsBuilder.withInputSpec(inputSpec);
@@ -677,7 +661,6 @@ public class CodegenConfigurator {
config.schemaMapping().putAll(generatorSettings.getSchemaMappings());
config.inlineSchemaNameMapping().putAll(generatorSettings.getInlineSchemaNameMappings());
config.inlineSchemaNameDefault().putAll(generatorSettings.getInlineSchemaNameDefaults());
config.openapiNormalizer().putAll(generatorSettings.getOpenAPINormalizer());
config.languageSpecificPrimitives().addAll(generatorSettings.getLanguageSpecificPrimitives());
config.reservedWordsMappings().putAll(generatorSettings.getReservedWordsMappings());
config.additionalProperties().putAll(generatorSettings.getAdditionalProperties());

View File

@@ -120,19 +120,6 @@ public final class CodegenConfiguratorUtils {
}
}
public static void applyOpenAPINormalizerKvpList(List<String> openapiNormalizer, CodegenConfigurator configurator) {
for (String propString : openapiNormalizer) {
applyOpenAPINormalizerKvp(propString, configurator);
}
}
public static void applyOpenAPINormalizerKvp(String openapiNormalizer, CodegenConfigurator configurator) {
final Map<String, String> map = createMapFromKeyValuePairs(openapiNormalizer);
for (Map.Entry<String, String> entry : map.entrySet()) {
configurator.addOpenAPINormalizer(entry.getKey().trim(), entry.getValue().trim());
}
}
public static void applyTypeMappingsKvpList(List<String> typeMappings, CodegenConfigurator configurator) {
for (String propString : typeMappings) {
applyTypeMappingsKvp(propString, configurator);

View File

@@ -80,9 +80,12 @@ public class ExampleGenerator {
if (ModelUtils.isArraySchema(responseSchema)) { // array of schema
ArraySchema as = (ArraySchema) responseSchema;
if (as.getItems() != null) { // array of primitive types
if (as.getItems() != null && StringUtils.isEmpty(as.getItems().get$ref())) { // array of primitive types
return generate((Map<String, Object>) responseSchema.getExample(),
new ArrayList<>(producesInfo), as);
new ArrayList<String>(producesInfo), as.getItems());
} else if (as.getItems() != null && !StringUtils.isEmpty(as.getItems().get$ref())) { // array of model
return generate((Map<String, Object>) responseSchema.getExample(),
new ArrayList<String>(producesInfo), ModelUtils.getSimpleRef(as.getItems().get$ref()));
} else {
// TODO log warning message as such case is not handled at the moment
return null;

View File

@@ -155,9 +155,6 @@ public class XmlExampleGenerator {
}
} else if (StringUtils.isNotEmpty(schema.get$ref())) {
Schema actualSchema = examples.get(schema.get$ref());
if (actualSchema == null) {
actualSchema = examples.get(ModelUtils.getSimpleRef(schema.get$ref()));
}
sb.append(toXml(actualSchema, indent, path));
} else {
if (name != null) {

View File

@@ -83,8 +83,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
public static final String TEST_OUTPUT = "testOutput";
public static final String IMPLICIT_HEADERS = "implicitHeaders";
public static final String IMPLICIT_HEADERS_REGEX = "implicitHeadersRegex";
public static final String JAVAX_PACKAGE = "javaxPackage";
public static final String USE_JAKARTA_EE = "useJakartaEe";
public static final String CAMEL_CASE_DOLLAR_SIGN = "camelCaseDollarSign";
@@ -139,7 +137,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
protected String implicitHeadersRegex = null;
protected boolean camelCaseDollarSign = false;
protected boolean useJakartaEe = false;
private Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
@@ -275,7 +272,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
cliOptions.add(CliOption.newBoolean(IMPLICIT_HEADERS, "Skip header parameters in the generated API methods using @ApiImplicitParams annotation.", implicitHeaders));
cliOptions.add(CliOption.newString(IMPLICIT_HEADERS_REGEX, "Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true"));
cliOptions.add(CliOption.newBoolean(CAMEL_CASE_DOLLAR_SIGN, "Fix camelCase when starting with $ sign. when true : $Value when false : $value"));
cliOptions.add(CliOption.newBoolean(USE_JAKARTA_EE, "whether to use Jakarta EE namespace instead of javax"));
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC));
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC));
@@ -660,7 +656,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
additionalProperties.put("jsr310", "true");
typeMapping.put("date", "LocalDate");
importMapping.put("LocalDate", "java.time.LocalDate");
importMapping.put("LocalTime", "java.time.LocalTime");
if ("java8-localdatetime".equals(dateLibrary)) {
typeMapping.put("DateTime", "LocalDateTime");
importMapping.put("LocalDateTime", "java.time.LocalDateTime");
@@ -675,17 +670,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
if (additionalProperties.containsKey(TEST_OUTPUT)) {
setOutputTestFolder(additionalProperties.get(TEST_OUTPUT).toString());
}
if (additionalProperties.containsKey(USE_JAKARTA_EE)) {
this.setUseJakartaEe(Boolean.parseBoolean(additionalProperties.get(USE_JAKARTA_EE).toString()));
}
additionalProperties.put(USE_JAKARTA_EE, useJakartaEe);
if (useJakartaEe) {
applyJakartaPackage();
} else {
applyJavaxPackage();
}
}
@Override
@@ -737,14 +721,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
}
}
protected void applyJavaxPackage() {
writePropertyBack(JAVAX_PACKAGE, "javax");
}
protected void applyJakartaPackage() {
writePropertyBack(JAVAX_PACKAGE, "jakarta");
}
@Override
public String escapeReservedWord(String name) {
if (this.reservedWordsMappings().containsKey(name)) {
@@ -1375,7 +1351,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
}
if (serializeBigDecimalAsString) {
if ("decimal".equals(property.baseType) || "bigdecimal".equalsIgnoreCase(property.baseType)) {
if ("decimal".equals(property.baseType)) {
// we serialize BigDecimal as `string` to avoid precision loss
property.vendorExtensions.put("x-extra-annotation", "@JsonSerialize(using = ToStringSerializer.class)");
@@ -1960,10 +1936,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
this.camelCaseDollarSign = camelCaseDollarSign;
}
public void setUseJakartaEe(boolean useJakartaEe) {
this.useJakartaEe = useJakartaEe;
}
@Override
public String escapeQuotationMark(String input) {
// remove " to avoid code injection

View File

@@ -19,13 +19,10 @@ package org.openapitools.codegen.languages;
import com.google.common.collect.Sets;
import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Template;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.Discriminator;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.CodegenDiscriminator.MappedModel;
import org.openapitools.codegen.api.TemplatePathLocator;
import org.openapitools.codegen.config.GlobalSettings;
import org.openapitools.codegen.meta.GeneratorMetadata;
@@ -47,7 +44,6 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -279,7 +275,7 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
imports.put("Uint8List", "dart:typed_data");
imports.put("MultipartFile", DIO_IMPORT);
}
private void configureDateLibrary(String srcFolder) {
switch (dateLibrary) {
case DATE_LIBRARY_TIME_MACHINE:
@@ -404,7 +400,6 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
private final String kHasAncestorOnlyProps = "x-has-ancestor-only-props";
private final String kSelfAndAncestorOnlyProps = "x-self-and-ancestor-only-props";
private final String kHasSelfAndAncestorOnlyProps = "x-has-self-and-ancestor-only-props";
private final String kParentDiscriminator = "x-parent-discriminator";
// adapts codegen models and property to dart rules of inheritance
private void adaptToDartInheritance(Map<String, ModelsMap> objs) {
@@ -454,14 +449,6 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
cm.vendorExtensions.put(kIsChild, isChild);
cm.vendorExtensions.put(kIsParent, isParent);
cm.vendorExtensions.put(kIsPure, isPure);
if (!isParent && (cm.oneOf == null || cm.oneOf.isEmpty())) {
//discriminator has no meaning here
if (cm.discriminator!=null) {
cm.vendorExtensions.put(kParentDiscriminator, cm.discriminator);
cm.discriminator=null;
}
}
// when pure:
// vars = allVars = selfOnlyProperties = kSelfAndAncestorOnlyProps
// ancestorOnlyProps = empty
@@ -554,30 +541,6 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
}
}
/// override the default behavior of createDiscriminator
/// to remove extra mappings added as a side effect of setLegacyDiscriminatorBehavior(false)
/// this ensures 1-1 schema mapping instead of 1-many
@Override
protected CodegenDiscriminator createDiscriminator(String schemaName, Schema schema, OpenAPI openAPI) {
CodegenDiscriminator sub = super.createDiscriminator(schemaName, schema, openAPI);
Discriminator originalDiscriminator = schema.getDiscriminator();
if (originalDiscriminator!=null) {
Map<String,String> originalMapping = originalDiscriminator.getMapping();
if (originalMapping != null && !originalMapping.isEmpty()) {
//we already have a discriminator mapping, remove everything else
for (MappedModel currentMappings : new HashSet<>(sub.getMappedModels())) {
if (originalMapping.containsKey(currentMappings.getMappingName())) {
//all good
} else {
sub.getMapping().remove(currentMappings.getMappingName());
sub.getMappedModels().remove(currentMappings);
}
}
}
}
return sub;
}
@Override
public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs) {
objs = super.postProcessAllModels(objs);

View File

@@ -511,6 +511,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
supportingFiles.add(new SupportingFile("ParamExpander.mustache", invokerFolder, "ParamExpander.java"));
}
supportingFiles.add(new SupportingFile("EncodingUtils.mustache", invokerFolder, "EncodingUtils.java"));
supportingFiles.add(new SupportingFile("auth/DefaultApi20Impl.mustache", authFolder, "DefaultApi20Impl.java"));
} else if (OKHTTP_GSON.equals(getLibrary()) || StringUtils.isEmpty(getLibrary())) {
// the "okhttp-gson" library template requires "ApiCallback.mustache" for async call
supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java"));
@@ -575,7 +576,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
// The flag below should be set for all Java libraries, but the templates need to be ported
// one by one for each library.
supportsAdditionalPropertiesWithComposedSchema = true;
applyJakartaPackage();
} else if (NATIVE.equals(getLibrary())) {
supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java"));
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
@@ -713,7 +714,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
// Add OauthPasswordGrant.java and OauthClientCredentialsGrant.java for feign library
if (FEIGN.equals(getLibrary())) {
supportingFiles.add(new SupportingFile("auth/DefaultApi20Impl.mustache", authFolder, "DefaultApi20Impl.java"));
supportingFiles.add(new SupportingFile("auth/OauthPasswordGrant.mustache", authFolder, "OauthPasswordGrant.java"));
supportingFiles.add(new SupportingFile("auth/OauthClientCredentialsGrant.mustache", authFolder, "OauthClientCredentialsGrant.java"));
supportingFiles.add(new SupportingFile("auth/ApiErrorDecoder.mustache", authFolder, "ApiErrorDecoder.java"));

View File

@@ -457,16 +457,16 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
fieldCustomization.add("strict=True");
if (cp.getMaximum() != null) {
if (cp.getExclusiveMaximum()) {
fieldCustomization.add("lt=" + cp.getMaximum());
fieldCustomization.add("gt=" + cp.getMaximum());
} else {
fieldCustomization.add("le=" + cp.getMaximum());
fieldCustomization.add("ge=" + cp.getMaximum());
}
}
if (cp.getMinimum() != null) {
if (cp.getExclusiveMinimum()) {
fieldCustomization.add("gt=" + cp.getMinimum());
fieldCustomization.add("lt=" + cp.getMinimum());
} else {
fieldCustomization.add("ge=" + cp.getMinimum());
fieldCustomization.add("le=" + cp.getMinimum());
}
}
if (cp.getMultipleOf() != null) {

View File

@@ -424,9 +424,8 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
@Override
public String getTypeDeclaration(Schema p) {
Schema unaliasSchema = unaliasSchema(p);
if (ModelUtils.isArraySchema(unaliasSchema)) {
ArraySchema ap = (ArraySchema) unaliasSchema;
if (ModelUtils.isArraySchema(p)) {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
if (inner == null) {
LOGGER.warn("{}(array property) does not have a proper inner type defined.Default to string",
@@ -434,10 +433,10 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
inner = new StringSchema().description("TODO default missing array inner type to string");
}
return "Vec<" + getTypeDeclaration(inner) + ">";
} else if (ModelUtils.isMapSchema(unaliasSchema)) {
Schema inner = getAdditionalProperties(unaliasSchema);
} else if (ModelUtils.isMapSchema(p)) {
Schema inner = getAdditionalProperties(p);
if (inner == null) {
LOGGER.warn("{}(map property) does not have a proper inner type defined. Default to string", unaliasSchema.getName());
LOGGER.warn("{}(map property) does not have a proper inner type defined. Default to string", p.getName());
inner = new StringSchema().description("TODO default missing map inner type to string");
}
return "::std::collections::HashMap<String, " + getTypeDeclaration(inner) + ">";
@@ -445,7 +444,7 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
// Not using the supertype invocation, because we want to UpperCamelize
// the type.
String schemaType = getSchemaType(unaliasSchema);
String schemaType = getSchemaType(p);
if (typeMapping.containsKey(schemaType)) {
return typeMapping.get(schemaType);
}

View File

@@ -105,6 +105,7 @@ public class SpringCodegen extends AbstractJavaCodegen
public static final String RETURN_SUCCESS_CODE = "returnSuccessCode";
public static final String UNHANDLED_EXCEPTION_HANDLING = "unhandledException";
public static final String USE_SPRING_BOOT3 = "useSpringBoot3";
public static final String USE_JAKARTA_EE = "useJakartaEe";
public static final String REQUEST_MAPPING_OPTION = "requestMappingMode";
public static final String USE_REQUEST_MAPPING_ON_CONTROLLER = "useRequestMappingOnController";
public static final String USE_REQUEST_MAPPING_ON_INTERFACE = "useRequestMappingOnInterface";
@@ -242,7 +243,7 @@ public class SpringCodegen extends AbstractJavaCodegen
useSwaggerUI));
cliOptions.add(CliOption.newBoolean(USE_SPRING_BOOT3,
"Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports).",
useSpringBoot3));
useSwaggerUI));
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
supportedLibraries.put(SPRING_CLOUD_LIBRARY,
@@ -473,7 +474,9 @@ public class SpringCodegen extends AbstractJavaCodegen
if (AnnotationLibrary.SWAGGER1.equals(getAnnotationLibrary())) {
throw new IllegalArgumentException(AnnotationLibrary.SWAGGER1.getPropertyName() + " is not supported with Spring Boot > 3.x");
}
applyJakartaPackage();
writePropertyBack(USE_JAKARTA_EE, true);
} else {
writePropertyBack(USE_JAKARTA_EE, false);
}
writePropertyBack(USE_SPRING_BOOT3, isUseSpringBoot3());

View File

@@ -74,7 +74,6 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
public static final String USE_JSON_ENCODABLE = "useJsonEncodable";
public static final String MAP_FILE_BINARY_TO_DATA = "mapFileBinaryToData";
public static final String USE_CUSTOM_DATE_WITHOUT_TIME = "useCustomDateWithoutTime";
public static final String VALIDATABLE = "validatable";
protected static final String LIBRARY_ALAMOFIRE = "alamofire";
protected static final String LIBRARY_URLSESSION = "urlsession";
protected static final String LIBRARY_VAPOR = "vapor";
@@ -100,7 +99,6 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
protected boolean useJsonEncodable = true;
protected boolean mapFileBinaryToData = false;
protected boolean useCustomDateWithoutTime = false;
protected boolean validatable = true;
protected String[] responseAs = new String[0];
protected String sourceFolder = swiftPackagePath;
protected HashSet objcReservedWords;
@@ -318,10 +316,6 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
"Uses a custom type to decode and encode dates without time information to support OpenAPIs date format (default: false)")
.defaultValue(Boolean.FALSE.toString()));
cliOptions.add(new CliOption(VALIDATABLE,
"Make validation rules and validator for model properies (default: true)")
.defaultValue(Boolean.TRUE.toString()));
supportedLibraries.put(LIBRARY_URLSESSION, "[DEFAULT] HTTP client: URLSession");
supportedLibraries.put(LIBRARY_ALAMOFIRE, "HTTP client: Alamofire");
supportedLibraries.put(LIBRARY_VAPOR, "HTTP client: Vapor");
@@ -545,11 +539,6 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
}
additionalProperties.put(USE_CLASSES, useClasses);
if (additionalProperties.containsKey(VALIDATABLE)) {
setValidatable(convertPropertyToBooleanAndWriteBack(VALIDATABLE));
}
additionalProperties.put(VALIDATABLE, validatable);
setLenientTypeCast(convertPropertyToBooleanAndWriteBack(LENIENT_TYPE_CAST));
// make api and model doc path available in mustache template
@@ -608,11 +597,6 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
supportingFiles.add(new SupportingFile("APIs.mustache",
sourceFolder,
"APIs.swift"));
if (validatable) {
supportingFiles.add(new SupportingFile("Validation.mustache",
sourceFolder,
"Validation.swift"));
}
supportingFiles.add(new SupportingFile("gitignore.mustache",
"",
".gitignore"));
@@ -1013,10 +997,6 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
this.useJsonEncodable = useJsonEncodable;
}
public void setValidatable(boolean validatable) {
this.validatable = validatable;
}
@Override
public String toEnumValue(String value, String datatype) {
// for string, array of string

View File

@@ -73,8 +73,6 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
private static final String PLATFORM_SWITCH = "platform";
private static final String PLATFORM_SWITCH_DESC = "Specifies the platform the code should run on. The default is 'node' for the 'request' framework and 'browser' otherwise.";
private static final String[] PLATFORMS = { "browser", "node", "deno" };
private static final String IMPORT_FILE_EXTENSION_SWITCH = "importFileExtension";
private static final String IMPORT_FILE_EXTENSION_SWITCH_DESC = "File extension to use with relative imports. Set it to '.js' or '.mjs' when using [ESM](https://nodejs.org/api/esm.html). Defaults to '.ts' when 'platform' is set to 'deno'.";
private static final String FILE_CONTENT_DATA_TYPE= "fileContentDataType";
private static final String FILE_CONTENT_DATA_TYPE_DESC = "Specifies the type to use for the content of a file - i.e. Blob (Browser, Deno) / Buffer (node)";
private static final String USE_RXJS_SWITCH = "useRxJS";
@@ -200,7 +198,6 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
cliOptions.add(new CliOption(TypeScriptClientCodegen.USE_RXJS_SWITCH, TypeScriptClientCodegen.USE_RXJS_SWITCH_DESC).defaultValue("false"));
cliOptions.add(new CliOption(TypeScriptClientCodegen.USE_OBJECT_PARAMS_SWITCH, TypeScriptClientCodegen.USE_OBJECT_PARAMS_DESC).defaultValue("false"));
cliOptions.add(new CliOption(TypeScriptClientCodegen.USE_INVERSIFY_SWITCH, TypeScriptClientCodegen.USE_INVERSIFY_SWITCH_DESC).defaultValue("false"));
cliOptions.add(new CliOption(TypeScriptClientCodegen.IMPORT_FILE_EXTENSION_SWITCH, TypeScriptClientCodegen.IMPORT_FILE_EXTENSION_SWITCH_DESC));
CliOption frameworkOption = new CliOption(TypeScriptClientCodegen.FRAMEWORK_SWITCH, TypeScriptClientCodegen.FRAMEWORK_SWITCH_DESC);
for (String option: TypeScriptClientCodegen.FRAMEWORKS) {
@@ -838,9 +835,8 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json"));
}
Object fileExtension = additionalProperties.get(IMPORT_FILE_EXTENSION_SWITCH);
if (fileExtension == null && "deno".equals(propPlatform)) {
additionalProperties.put(IMPORT_FILE_EXTENSION_SWITCH, ".ts");
if ("deno".equals(propPlatform)) {
additionalProperties.put("extensionForDeno", ".ts");
}
final boolean useRxJS = convertPropertyToBooleanAndWriteBack(USE_RXJS_SWITCH);

View File

@@ -308,15 +308,15 @@ public class ModelUtils {
/**
* Invoke the specified visitor function for every schema that matches mimeType in the OpenAPI document.
* <p>
*
* To avoid infinite recursion, referenced schemas are visited only once. When a referenced schema is visited,
* it is added to visitedSchemas.
*
* @param openAPI the OpenAPI document that contains schema objects.
* @param schema the root schema object to be visited.
* @param mimeType the mime type. TODO: does not seem to be used in a meaningful way.
* @param openAPI the OpenAPI document that contains schema objects.
* @param schema the root schema object to be visited.
* @param mimeType the mime type. TODO: does not seem to be used in a meaningful way.
* @param visitedSchemas the list of referenced schemas that have been visited.
* @param visitor the visitor function which is invoked for every visited schema.
* @param visitor the visitor function which is invoked for every visited schema.
*/
private static void visitSchema(OpenAPI openAPI, Schema schema, String mimeType, List<String> visitedSchemas, OpenAPISchemaVisitor visitor) {
visitor.visit(schema, mimeType);
@@ -425,14 +425,13 @@ public class ModelUtils {
/**
* Return true if the specified schema is an object with a fixed number of properties.
* <p>
*
* A ObjectSchema differs from a MapSchema in the following way:
* - An ObjectSchema is not extensible, i.e. it has a fixed number of properties.
* - A MapSchema is an object that can be extended with an arbitrary set of properties.
* The payload may include dynamic properties.
* <p>
*
* For example, an OpenAPI schema is considered an ObjectSchema in the following scenarios:
* <p>
*
* type: object
* additionalProperties: false
@@ -480,17 +479,16 @@ public class ModelUtils {
* Return true if the specified 'schema' is an object that can be extended with additional properties.
* Additional properties means a Schema should support all explicitly defined properties plus any
* undeclared properties.
* <p>
*
* A MapSchema differs from an ObjectSchema in the following way:
* - An ObjectSchema is not extensible, i.e. it has a fixed number of properties.
* - A MapSchema is an object that can be extended with an arbitrary set of properties.
* The payload may include dynamic properties.
* <p>
* The payload may include dynamic properties.
*
* Note that isMapSchema returns true for a composed schema (allOf, anyOf, oneOf) that also defines
* additionalproperties.
* <p>
*
* For example, an OpenAPI schema is considered a MapSchema in the following scenarios:
* <p>
*
* type: object
* additionalProperties: true
@@ -774,14 +772,14 @@ public class ModelUtils {
/**
* Check to see if the schema is a free form object.
* <p>
*
* A free form object is an object (i.e. 'type: object' in a OAS document) that:
* 1) Does not define properties, and
* 2) Is not a composed schema (no anyOf, oneOf, allOf), and
* 3) additionalproperties is not defined, or additionalproperties: true, or additionalproperties: {}.
* <p>
*
* Examples:
* <p>
*
* components:
* schemas:
* arbitraryObject:
@@ -800,7 +798,7 @@ public class ModelUtils {
* The value can be any type except the 'null' value.
*
* @param openAPI the object that encapsulates the OAS document.
* @param schema potentially containing a '$ref'
* @param schema potentially containing a '$ref'
* @return true if it's a free-form object
*/
public static boolean isFreeFormObject(OpenAPI openAPI, Schema schema) {
@@ -1056,10 +1054,10 @@ public class ModelUtils {
/**
* Return the first Schema from a specified OAS 'content' section.
* <p>
*
* For example, given the following OAS, this method returns the schema
* for the 'application/json' content type because it is listed first in the OAS.
* <p>
*
* responses:
* '200':
* content:
@@ -1101,8 +1099,8 @@ public class ModelUtils {
/**
* Has self reference?
*
* @param openAPI OpenAPI spec.
* @param schema Schema
* @param openAPI OpenAPI spec.
* @param schema Schema
* @param visitedSchemaNames A set of visited schema names
* @return boolean true if it has at least one self reference
*/
@@ -1259,7 +1257,7 @@ public class ModelUtils {
/**
* Returns the additionalProperties Schema for the specified input schema.
* <p>
*
* The additionalProperties keyword is used to control the handling of additional, undeclared
* properties, that is, properties whose names are not listed in the properties keyword.
* The additionalProperties keyword may be either a boolean or an object.
@@ -1269,9 +1267,9 @@ public class ModelUtils {
* to the boolean value True or setting additionalProperties: {}
*
* @param openAPI the object that encapsulates the OAS document.
* @param schema the input schema that may or may not have the additionalProperties keyword.
* @param schema the input schema that may or may not have the additionalProperties keyword.
* @return the Schema of the additionalProperties. The null value is returned if no additional
* properties are allowed.
* properties are allowed.
*/
public static Schema getAdditionalProperties(OpenAPI openAPI, Schema schema) {
Object addProps = schema.getAdditionalProperties();
@@ -1382,10 +1380,10 @@ public class ModelUtils {
* that specify a determinator.
* If there are multiple elements in the composed schema and it is not clear
* which one should be the parent, return null.
* <p>
*
* For example, given the following OAS spec, the parent of 'Dog' is Animal
* because 'Animal' specifies a discriminator.
* <p>
*
* animal:
* type: object
* discriminator:
@@ -1393,7 +1391,6 @@ public class ModelUtils {
* properties:
* type: string
*
* <p>
* dog:
* allOf:
* - $ref: '#/components/schemas/animal'
@@ -1421,10 +1418,10 @@ public class ModelUtils {
LOGGER.error("Failed to obtain schema from {}", parentName);
return "UNKNOWN_PARENT_NAME";
} else if (hasOrInheritsDiscriminator(s, allSchemas)) {
// discriminator.propertyName is used or x-parent is used
// discriminator.propertyName is used
return parentName;
} else {
// not a parent since discriminator.propertyName or x-parent is not set
// not a parent since discriminator.propertyName is not set
hasAmbiguousParents = true;
refedWithoutDiscriminator.add(parentName);
}
@@ -1479,7 +1476,7 @@ public class ModelUtils {
LOGGER.error("Failed to obtain schema from {}", parentName);
names.add("UNKNOWN_PARENT_NAME");
} else if (hasOrInheritsDiscriminator(s, allSchemas)) {
// discriminator.propertyName is used or x-parent is used
// discriminator.propertyName is used
names.add(parentName);
if (includeAncestors && s instanceof ComposedSchema) {
names.addAll(getAllParentsName((ComposedSchema) s, allSchemas, true));
@@ -1504,8 +1501,7 @@ public class ModelUtils {
}
private static boolean hasOrInheritsDiscriminator(Schema schema, Map<String, Schema> allSchemas) {
if ((schema.getDiscriminator() != null && StringUtils.isNotEmpty(schema.getDiscriminator().getPropertyName()))
|| (isExtensionParent(schema))) { // x-parent is used
if (schema.getDiscriminator() != null && StringUtils.isNotEmpty(schema.getDiscriminator().getPropertyName())) {
return true;
} else if (StringUtils.isNotEmpty(schema.get$ref())) {
String parentName = getSimpleRef(schema.get$ref());
@@ -1527,43 +1523,18 @@ public class ModelUtils {
return false;
}
/**
* If it's a boolean, returns the value of the extension `x-parent`.
* If it's string, return true if it's non-empty.
* If the return value is `true`, the schema is a parent.
*
* @param schema Schema
* @return boolean
*/
public static boolean isExtensionParent(Schema schema) {
if (schema.getExtensions() == null) {
return false;
} else {
Object xParent = schema.getExtensions().get("x-parent");
if (xParent == null) {
return false;
} else if (xParent instanceof Boolean) {
return (Boolean) xParent;
} else if (xParent instanceof String) {
return StringUtils.isNotEmpty((String) xParent);
} else {
return false;
}
}
}
/**
* Return true if the 'nullable' attribute is set to true in the schema, i.e. if the value
* of the property can be the null value.
* <p>
*
* In addition, if the OAS document is 3.1 or above, isNullable returns true if the input
* schema is a 'oneOf' composed document with at most two children, and one of the children
* is the 'null' type.
* <p>
*
* The caller is responsible for resolving schema references before invoking isNullable.
* If the input schema is a $ref and the referenced schema has 'nullable: true', this method
* returns false (because the nullable attribute is defined in the referenced schema).
* <p>
*
* The 'nullable' attribute was introduced in OAS 3.0.
* The 'nullable' attribute is deprecated in OAS 3.1. In a OAS 3.1 document, the preferred way
* to specify nullable properties is to use the 'null' type.
@@ -1593,11 +1564,11 @@ public class ModelUtils {
/**
* Return true if the specified composed schema is 'oneOf', contains one or two elements,
* and at least one of the elements is the 'null' type.
* <p>
*
* The 'null' type is supported in OAS 3.1 and above.
* In the example below, the 'OptionalOrder' can have the null value because the 'null'
* type is one of the elements under 'oneOf'.
* <p>
*
* OptionalOrder:
* oneOf:
* - type: 'null'
@@ -1620,13 +1591,13 @@ public class ModelUtils {
/**
* isNullType returns true if the input schema is the 'null' type.
* <p>
*
* The 'null' type is supported in OAS 3.1 and above. It is not supported
* in OAS 2.0 and OAS 3.0.x.
* <p>
*
* For example, the "null" type could be used to specify that a value must
* either be null or a specified type:
* <p>
*
* OptionalOrder:
* oneOf:
* - type: 'null'
@@ -1646,7 +1617,6 @@ public class ModelUtils {
* For when a type is not defined on a schema
* Note: properties, additionalProperties, enums, validations, items, and composed schemas (oneOf/anyOf/allOf)
* can be defined or omitted on these any type schemas
*
* @param schema the schema that we are checking
* @return boolean
*/
@@ -1743,7 +1713,7 @@ public class ModelUtils {
private static ObjectMapper getRightMapper(String data) {
ObjectMapper mapper;
if (data.trim().startsWith("{")) {
if (data.trim().startsWith("{")) {
mapper = JSON_MAPPER;
} else {
mapper = YAML_MAPPER;
@@ -1755,9 +1725,11 @@ public class ModelUtils {
* Parse and return a JsonNode representation of the input OAS document.
*
* @param location the URL of the OAS document.
* @param auths the list of authorization values to access the remote URL.
* @return A JsonNode representation of the input OAS document.
* @param auths the list of authorization values to access the remote URL.
*
* @throws java.lang.Exception if an error occurs while retrieving the OpenAPI document.
*
* @return A JsonNode representation of the input OAS document.
*/
public static JsonNode readWithInfo(String location, List<AuthorizationValue> auths) throws Exception {
String data;
@@ -1784,13 +1756,14 @@ public class ModelUtils {
/**
* Parse the OAS document at the specified location, get the swagger or openapi version
* as specified in the source document, and return the version.
* <p>
*
* For OAS 2.0 documents, return the value of the 'swagger' attribute.
* For OAS 3.x documents, return the value of the 'openapi' attribute.
*
* @param openAPI the object that encapsulates the OAS document.
* @param openAPI the object that encapsulates the OAS document.
* @param location the URL of the OAS document.
* @param auths the list of authorization values to access the remote URL.
* @param auths the list of authorization values to access the remote URL.
*
* @return the version of the OpenAPI document.
*/
public static SemVer getOpenApiVersion(OpenAPI openAPI, String location, List<AuthorizationValue> auths) {

View File

@@ -635,7 +635,7 @@ fail:
{{^isEnum}}
{{#isString}}
{{^required}}if ({{{name}}}) { {{/required}}
if(!cJSON_IsString({{{name}}}){{^required}} && !cJSON_IsNull({{{name}}}){{/required}})
if(!cJSON_IsString({{{name}}}))
{
goto end; //String
}
@@ -880,7 +880,7 @@ fail:
{{/isEnum}}
{{^isEnum}}
{{#isString}}
{{^required}}{{{name}}} && !cJSON_IsNull({{{name}}}) ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
{{^required}}{{{name}}} ? {{/required}}strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{^-last}},{{/-last}}
{{/isString}}
{{/isEnum}}
{{#isByteArray}}

View File

@@ -21,9 +21,9 @@ import com.sun.jersey.api.client.WebResource.Builder;
import com.sun.jersey.multipart.FormDataMultiPart;
import com.sun.jersey.multipart.file.FileDataBodyPart;
import {{javaxPackage}}.ws.rs.core.Cookie;
import {{javaxPackage}}.ws.rs.core.Response.Status.Family;
import {{javaxPackage}}.ws.rs.core.MediaType;
import javax.ws.rs.core.Cookie;
import javax.ws.rs.core.Response.Status.Family;
import javax.ws.rs.core.MediaType;
import java.util.Collection;
import java.util.Collections;

View File

@@ -2,8 +2,8 @@ package {{invokerPackage}};
import java.util.Set;
import {{javaxPackage}}.validation.ConstraintViolation;
import {{javaxPackage}}.validation.ValidationException;
import javax.validation.ConstraintViolation;
import javax.validation.ValidationException;
public class BeanValidationException extends ValidationException {
/**

View File

@@ -1 +1 @@
@{{javaxPackage}}.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}})
@javax.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}})

View File

@@ -343,12 +343,7 @@
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{/openApiNullable}}
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
{{/useJakartaEe}}
{{^useJakartaEe}}
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{/useJakartaEe}}
{{#useBeanValidation}}
<beanvalidation-version>3.0.2</beanvalidation-version>
{{/useBeanValidation}}

View File

@@ -124,7 +124,7 @@ public interface {{classname}} extends ApiClient.Api {
"{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}},
{{/-last}}{{/headerParams}}
})
{{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^isFormParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isFormParam}}{{#isFormParam}}@Param("{{baseName}}") {{/isFormParam}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) {{operationIdCamelCase}}QueryParams queryParams);
{{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^isFormParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isFormParam}}{{#isFormParam}}@Param("{{baseName}}") {{/isFormParam}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map<String, Object> queryParams);
/**
* {{summary}}
@@ -164,7 +164,7 @@ public interface {{classname}} extends ApiClient.Api {
"{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}},
{{/-last}}{{/headerParams}}
})
ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^isFormParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isFormParam}}{{#isFormParam}}@Param("{{baseName}}") {{/isFormParam}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) {{operationIdCamelCase}}QueryParams queryParams);
ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^isFormParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isFormParam}}{{#isFormParam}}@Param("{{baseName}}") {{/isFormParam}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map<String, Object> queryParams);
/**

View File

@@ -386,12 +386,7 @@
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{/openApiNullable}}
<jackson-databind-version>2.13.4.2</jackson-databind-version>
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
{{/useJakartaEe}}
{{^useJakartaEe}}
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{/useJakartaEe}}
<junit-version>5.7.0</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<scribejava-version>8.0.0</scribejava-version>

View File

@@ -14,7 +14,7 @@ import com.google.api.client.http.HttpMethods;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.json.Json;
import {{javaxPackage}}.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriBuilder;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;

View File

@@ -307,12 +307,7 @@
{{#joda}}
<jodatime-version>2.9.9</jodatime-version>
{{/joda}}
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
{{/useJakartaEe}}
{{^useJakartaEe}}
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{/useJakartaEe}}
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.13.2</junit-version>
</properties>

View File

@@ -6,7 +6,7 @@ import {{invokerPackage}}.ApiException;
import java.util.Objects;
import java.lang.reflect.Type;
import java.util.Map;
import {{javaxPackage}}.ws.rs.core.GenericType;
import javax.ws.rs.core.GenericType;
import com.fasterxml.jackson.annotation.JsonValue;

View File

@@ -1,15 +1,15 @@
package {{invokerPackage}};
import {{javaxPackage}}.ws.rs.client.Client;
import {{javaxPackage}}.ws.rs.client.ClientBuilder;
import {{javaxPackage}}.ws.rs.client.Entity;
import {{javaxPackage}}.ws.rs.client.Invocation;
import {{javaxPackage}}.ws.rs.client.WebTarget;
import {{javaxPackage}}.ws.rs.core.Form;
import {{javaxPackage}}.ws.rs.core.GenericType;
import {{javaxPackage}}.ws.rs.core.MediaType;
import {{javaxPackage}}.ws.rs.core.Response;
import {{javaxPackage}}.ws.rs.core.Response.Status;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
{{#hasOAuthMethods}}
import com.github.scribejava.core.model.OAuth2AccessToken;
@@ -251,7 +251,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/**
* <p>Getter for the field <code>httpClient</code>.</p>
*
* @return a {@link {{javaxPackage}}.ws.rs.client.Client} object.
* @return a {@link javax.ws.rs.client.Client} object.
*/
public Client getHttpClient() {
return httpClient;
@@ -260,7 +260,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/**
* <p>Setter for the field <code>httpClient</code>.</p>
*
* @param httpClient a {@link {{javaxPackage}}.ws.rs.client.Client} object.
* @param httpClient a {@link javax.ws.rs.client.Client} object.
* @return a {@link org.openapitools.client.ApiClient} object.
*/
public ApiClient setHttpClient(Client httpClient) {
@@ -1098,7 +1098,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/**
* <p>Prepare the file for download from the response.</p>
*
* @param response a {@link {{javaxPackage}}.ws.rs.core.Response} object.
* @param response a {@link javax.ws.rs.core.Response} object.
* @return a {@link java.io.File} object.
* @throws java.io.IOException if any.
*/
@@ -1387,7 +1387,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
* To completely disable certificate validation (at your own risk), you can
* override this method and invoke disableCertificateValidation(clientBuilder).
*
* @param clientBuilder a {@link {{javaxPackage}}.ws.rs.client.ClientBuilder} object.
* @param clientBuilder a {@link javax.ws.rs.client.ClientBuilder} object.
*/
protected void customizeClientBuilder(ClientBuilder clientBuilder) {
// No-op extension point
@@ -1399,7 +1399,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
* Please note that trusting all certificates is extremely risky.
* This may be useful in a development environment with self-signed certificates.
*
* @param clientBuilder a {@link {{javaxPackage}}.ws.rs.client.ClientBuilder} object.
* @param clientBuilder a {@link javax.ws.rs.client.ClientBuilder} object.
* @throws java.security.KeyManagementException if any.
* @throws java.security.NoSuchAlgorithmException if any.
*/
@@ -1426,7 +1426,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/**
* <p>Build the response headers.</p>
*
* @param response a {@link {{javaxPackage}}.ws.rs.core.Response} object.
* @param response a {@link javax.ws.rs.core.Response} object.
* @return a {@link java.util.Map} of response headers.
*/
protected Map<String, List<String>> buildResponseHeaders(Response response) {

View File

@@ -19,8 +19,8 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import {{javaxPackage}}.ws.rs.core.GenericType;
import {{javaxPackage}}.ws.rs.ext.ContextResolver;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.ext.ContextResolver;
{{>generatedAnnotation}}
public class JSON implements ContextResolver<ObjectMapper> {

View File

@@ -1,5 +1,5 @@
import {{javaxPackage}}.ws.rs.core.GenericType;
import {{javaxPackage}}.ws.rs.core.Response;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

View File

@@ -6,7 +6,7 @@ import {{invokerPackage}}.ApiResponse;
import {{invokerPackage}}.Configuration;
import {{invokerPackage}}.Pair;
import {{javaxPackage}}.ws.rs.core.GenericType;
import javax.ws.rs.core.GenericType;
{{#imports}}import {{import}};
{{/imports}}

View File

@@ -10,7 +10,7 @@ import com.github.scribejava.core.exceptions.OAuthException;
import com.github.scribejava.core.model.OAuth2AccessToken;
import com.github.scribejava.core.oauth.OAuth20Service;
import {{javaxPackage}}.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriBuilder;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;

View File

@@ -36,15 +36,15 @@ import com.fasterxml.jackson.annotation.JsonCreator;
{{/vendorExtensions.x-has-readonly-properties}}
{{/jackson}}
{{#withXml}}
import {{javaxPackage}}.xml.bind.annotation.*;
import javax.xml.bind.annotation.*;
{{/withXml}}
{{#parcelableModel}}
import android.os.Parcelable;
import android.os.Parcel;
{{/parcelableModel}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
import javax.validation.constraints.*;
import javax.validation.Valid;
{{/useBeanValidation}}
{{#performBeanValidation}}
import org.hibernate.validator.constraints.*;

View File

@@ -1,5 +1,5 @@
import {{javaxPackage}}.ws.rs.core.GenericType;
import {{javaxPackage}}.ws.rs.core.Response;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

View File

@@ -206,14 +206,14 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{/deprecated}}
{{#required}}
{{#isNullable}}
@{{javaxPackage}}.annotation.Nullable
@javax.annotation.Nullable
{{/isNullable}}
{{^isNullable}}
@{{javaxPackage}}.annotation.Nonnull
@javax.annotation.Nonnull
{{/isNullable}}
{{/required}}
{{^required}}
@{{javaxPackage}}.annotation.Nullable
@javax.annotation.Nullable
{{/required}}
{{#useBeanValidation}}
{{>beanValidation}}

View File

@@ -387,12 +387,7 @@
<jackson-version>2.13.4</jackson-version>
<jackson-databind-version>2.13.4.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
{{/useJakartaEe}}
{{^useJakartaEe}}
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{/useJakartaEe}}
{{#useBeanValidation}}
<beanvalidation-version>2.0.2</beanvalidation-version>
{{/useBeanValidation}}

View File

@@ -6,7 +6,7 @@ import {{invokerPackage}}.ApiException;
import java.util.Objects;
import java.lang.reflect.Type;
import java.util.Map;
import {{javaxPackage}}.ws.rs.core.GenericType;
import jakarta.ws.rs.core.GenericType;
import com.fasterxml.jackson.annotation.JsonValue;

View File

@@ -1,15 +1,15 @@
package {{invokerPackage}};
import {{javaxPackage}}.ws.rs.client.Client;
import {{javaxPackage}}.ws.rs.client.ClientBuilder;
import {{javaxPackage}}.ws.rs.client.Entity;
import {{javaxPackage}}.ws.rs.client.Invocation;
import {{javaxPackage}}.ws.rs.client.WebTarget;
import {{javaxPackage}}.ws.rs.core.Form;
import {{javaxPackage}}.ws.rs.core.GenericType;
import {{javaxPackage}}.ws.rs.core.MediaType;
import {{javaxPackage}}.ws.rs.core.Response;
import {{javaxPackage}}.ws.rs.core.Response.Status;
import jakarta.ws.rs.client.Client;
import jakarta.ws.rs.client.ClientBuilder;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.client.Invocation;
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status;
{{#hasOAuthMethods}}
import com.github.scribejava.core.model.OAuth2AccessToken;
@@ -251,7 +251,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/**
* <p>Getter for the field <code>httpClient</code>.</p>
*
* @return a {@link {{javaxPackage}}.ws.rs.client.Client} object.
* @return a {@link jakarta.ws.rs.client.Client} object.
*/
public Client getHttpClient() {
return httpClient;
@@ -260,7 +260,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/**
* <p>Setter for the field <code>httpClient</code>.</p>
*
* @param httpClient a {@link {{javaxPackage}}.ws.rs.client.Client} object.
* @param httpClient a {@link jakarta.ws.rs.client.Client} object.
* @return a {@link org.openapitools.client.ApiClient} object.
*/
public ApiClient setHttpClient(Client httpClient) {
@@ -1098,7 +1098,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/**
* <p>Prepare the file for download from the response.</p>
*
* @param response a {@link {{javaxPackage}}.ws.rs.core.Response} object.
* @param response a {@link jakarta.ws.rs.core.Response} object.
* @return a {@link java.io.File} object.
* @throws java.io.IOException if any.
*/
@@ -1234,12 +1234,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
queryParams,
allHeaderParams,
cookieParams,
{{#hasHttpSignatureMethods}}
serializeToString(body, formParams, contentType, isBodyNullable),
{{/hasHttpSignatureMethods}}
{{^hasHttpSignatureMethods}}
null,
{{/hasHttpSignatureMethods}}
method,
target.getUri());
@@ -1387,7 +1382,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
* To completely disable certificate validation (at your own risk), you can
* override this method and invoke disableCertificateValidation(clientBuilder).
*
* @param clientBuilder a {@link {{javaxPackage}}.ws.rs.client.ClientBuilder} object.
* @param clientBuilder a {@link jakarta.ws.rs.client.ClientBuilder} object.
*/
protected void customizeClientBuilder(ClientBuilder clientBuilder) {
// No-op extension point
@@ -1399,7 +1394,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
* Please note that trusting all certificates is extremely risky.
* This may be useful in a development environment with self-signed certificates.
*
* @param clientBuilder a {@link {{javaxPackage}}.ws.rs.client.ClientBuilder} object.
* @param clientBuilder a {@link jakarta.ws.rs.client.ClientBuilder} object.
* @throws java.security.KeyManagementException if any.
* @throws java.security.NoSuchAlgorithmException if any.
*/
@@ -1426,7 +1421,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
/**
* <p>Build the response headers.</p>
*
* @param response a {@link {{javaxPackage}}.ws.rs.core.Response} object.
* @param response a {@link jakarta.ws.rs.core.Response} object.
* @return a {@link java.util.Map} of response headers.
*/
protected Map<String, List<String>> buildResponseHeaders(Response response) {

View File

@@ -19,8 +19,8 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import {{javaxPackage}}.ws.rs.core.GenericType;
import {{javaxPackage}}.ws.rs.ext.ContextResolver;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.ext.ContextResolver;
{{>generatedAnnotation}}
public class JSON implements ContextResolver<ObjectMapper> {

View File

@@ -1,5 +1,5 @@
import {{javaxPackage}}.ws.rs.core.GenericType;
import {{javaxPackage}}.ws.rs.core.Response;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

View File

@@ -6,7 +6,7 @@ import {{invokerPackage}}.ApiResponse;
import {{invokerPackage}}.Configuration;
import {{invokerPackage}}.Pair;
import {{javaxPackage}}.ws.rs.core.GenericType;
import jakarta.ws.rs.core.GenericType;
{{#imports}}import {{import}};
{{/imports}}

View File

@@ -10,7 +10,7 @@ import com.github.scribejava.core.exceptions.OAuthException;
import com.github.scribejava.core.model.OAuth2AccessToken;
import com.github.scribejava.core.oauth.OAuth20Service;
import {{javaxPackage}}.ws.rs.core.UriBuilder;
import jakarta.ws.rs.core.UriBuilder;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;

View File

@@ -1 +1 @@
@{{javaxPackage}}.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}})
@jakarta.annotation.Generated(value = "{{generatorClass}}"{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}})

View File

@@ -36,15 +36,15 @@ import com.fasterxml.jackson.annotation.JsonCreator;
{{/vendorExtensions.x-has-readonly-properties}}
{{/jackson}}
{{#withXml}}
import {{javaxPackage}}.xml.bind.annotation.*;
import javax.xml.bind.annotation.*;
{{/withXml}}
{{#parcelableModel}}
import android.os.Parcelable;
import android.os.Parcel;
{{/parcelableModel}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
import javax.validation.constraints.*;
import javax.validation.Valid;
{{/useBeanValidation}}
{{#performBeanValidation}}
import org.hibernate.validator.constraints.*;

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