mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-07 23:26:10 +00:00
Compare commits
52 Commits
jdk21-test
...
JoseLora-b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c7b8b64b7 | ||
|
|
044bd9c63e | ||
|
|
3d4f29eac7 | ||
|
|
351b601368 | ||
|
|
2c248e6c93 | ||
|
|
68b0dfe6d1 | ||
|
|
31e462dc3e | ||
|
|
74488fa3c3 | ||
|
|
8c54f18f7c | ||
|
|
57d12811ef | ||
|
|
676efae183 | ||
|
|
a4d05b38f5 | ||
|
|
75ae04ecfd | ||
|
|
808d106e0c | ||
|
|
9d810e0fbb | ||
|
|
91a499b8c6 | ||
|
|
eda2e67b94 | ||
|
|
8643bc1d66 | ||
|
|
2b22d172da | ||
|
|
d605afeef5 | ||
|
|
6eff628139 | ||
|
|
1d071288f8 | ||
|
|
816befc466 | ||
|
|
3d00fd2adc | ||
|
|
00d16496c8 | ||
|
|
57752d190c | ||
|
|
6572d5d9a6 | ||
|
|
c15ba67fc9 | ||
|
|
63ddce0c1b | ||
|
|
01139e6963 | ||
|
|
e7dae1a81e | ||
|
|
4e7bba659b | ||
|
|
88bba259e9 | ||
|
|
8c85e3cedc | ||
|
|
d840c495c4 | ||
|
|
7c000687e4 | ||
|
|
23a2aafe91 | ||
|
|
2afe7d29cd | ||
|
|
6ede03d546 | ||
|
|
ee85775afd | ||
|
|
94e8997cc7 | ||
|
|
552ab4c6d5 | ||
|
|
2b00bab60a | ||
|
|
ccd43a5ce4 | ||
|
|
592c262277 | ||
|
|
40b9d69d5a | ||
|
|
3cf4994ba2 | ||
|
|
df2a8d6d46 | ||
|
|
ade1e5838e | ||
|
|
8ecdb15528 | ||
|
|
ce89695bb6 | ||
|
|
a424b5af8e |
1
.github/workflows/gradle-plugin-tests.yaml
vendored
1
.github/workflows/gradle-plugin-tests.yaml
vendored
@@ -19,6 +19,7 @@ jobs:
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
|
||||
1
.github/workflows/gradle-test.yaml
vendored
1
.github/workflows/gradle-test.yaml
vendored
@@ -37,6 +37,7 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 11
|
||||
cache: gradle
|
||||
# Cache Gradle Dependencies
|
||||
- name: Setup Gradle Dependencies Cache
|
||||
uses: actions/cache@v4
|
||||
|
||||
6
.github/workflows/linux.yaml
vendored
6
.github/workflows/linux.yaml
vendored
@@ -27,6 +27,7 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: ${{ matrix.java }}
|
||||
cache: gradle
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
@@ -61,7 +62,7 @@ jobs:
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
|
||||
|
||||
- name: Upload Maven build artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v5
|
||||
if: matrix.java == '11' && matrix.os == 'ubuntu-latest'
|
||||
with:
|
||||
name: artifact
|
||||
@@ -95,8 +96,9 @@ jobs:
|
||||
with:
|
||||
java-version: 11
|
||||
maven-version: 3.8.8
|
||||
cache: gradle
|
||||
- name: Download build artifact
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: artifact
|
||||
- name: Run Ensures Script
|
||||
|
||||
10
.github/workflows/openapi-generator.yaml
vendored
10
.github/workflows/openapi-generator.yaml
vendored
@@ -21,6 +21,7 @@ jobs:
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
@@ -41,7 +42,7 @@ jobs:
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
|
||||
- run: ls -la modules/openapi-generator-cli/target
|
||||
- name: Upload openapi-generator-cli.jar artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: openapi-generator-cli.jar
|
||||
path: modules/openapi-generator-cli/target/openapi-generator-cli.jar
|
||||
@@ -59,6 +60,7 @@ jobs:
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
@@ -79,7 +81,7 @@ jobs:
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
|
||||
- name: Publish unit test reports
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: surefire-test-results
|
||||
path: '**/surefire-reports/TEST-*.xml'
|
||||
@@ -97,7 +99,7 @@ jobs:
|
||||
java-version: 11
|
||||
distribution: 'temurin'
|
||||
- name: Download openapi-generator-cli.jar artifact
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: openapi-generator-cli.jar
|
||||
path: modules/openapi-generator-cli/target
|
||||
@@ -136,7 +138,7 @@ jobs:
|
||||
java-version: 11
|
||||
distribution: 'temurin'
|
||||
- name: Download openapi-generator-cli.jar artifact
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: openapi-generator-cli.jar
|
||||
path: modules/openapi-generator-cli/target
|
||||
|
||||
1
.github/workflows/samples-groovy.yaml
vendored
1
.github/workflows/samples-groovy.yaml
vendored
@@ -26,6 +26,7 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 8
|
||||
cache: gradle
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
|
||||
@@ -118,6 +118,7 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 11
|
||||
cache: gradle
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
|
||||
@@ -42,6 +42,7 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
cache: gradle
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
|
||||
1
.github/workflows/samples-kotlin-client.yaml
vendored
1
.github/workflows/samples-kotlin-client.yaml
vendored
@@ -77,6 +77,7 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 11
|
||||
cache: gradle
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
|
||||
@@ -26,6 +26,7 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
cache: gradle
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
|
||||
@@ -52,6 +52,7 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
cache: gradle
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
|
||||
@@ -32,6 +32,7 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 21
|
||||
cache: gradle
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
|
||||
3
.github/workflows/samples-kotlin-server.yaml
vendored
3
.github/workflows/samples-kotlin-server.yaml
vendored
@@ -59,7 +59,8 @@ jobs:
|
||||
- uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 8
|
||||
java-version: 11
|
||||
cache: gradle
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
|
||||
1
.github/workflows/windows.yaml
vendored
1
.github/workflows/windows.yaml
vendored
@@ -24,6 +24,7 @@ jobs:
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
|
||||
@@ -59,6 +59,6 @@
|
||||
sha256: 45cdaba3d2adc212cd4f0184ad475419a95e2326254c2ef84175e210c922b2f3
|
||||
# rust axum test files
|
||||
- filename: "samples/server/petstore/rust-axum/output/rust-axum-oneof/tests/oneof_with_discriminator.rs"
|
||||
sha256: 2d4f5a069fdcb3057bb078d5e75b3de63cd477b97725e457079df24bd2c30600
|
||||
sha256: b2093528aac971193f2863a70f46eea45cf8bda79120b133a614599e80d8b46d
|
||||
- filename: "samples/server/petstore/rust-axum/output/openapi-v3/tests/oneof_untagged.rs"
|
||||
sha256: 1d3fb01f65e98290b1d3eece28014c7d3e3f2fdf18e7110249d3c591cc4642ab
|
||||
|
||||
@@ -538,6 +538,7 @@ OpenAPI Normalizer transforms the input OpenAPI doc/spec (which may not perfectl
|
||||
|
||||
- SIMPLIFY_ONEOF_ANYOF
|
||||
- SIMPLIFY_BOOLEAN_ENUM
|
||||
- REFACTOR_ALLOF_WITH_PROPERTIES_ONLY
|
||||
|
||||
(One can use `DISABLE_ALL=true` to disable all the rules)
|
||||
|
||||
@@ -643,9 +644,16 @@ Example:
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/required-properties.yaml -o /tmp/java-okhttp/ --openapi-normalizer NORMALIZER_CLASS=org.openapitools.codegen.OpenAPINormalizerTest$RemoveRequiredNormalizer
|
||||
```
|
||||
|
||||
- `REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT`: When set to true, remove the "properties" of a schema with type other than "object".
|
||||
|
||||
Example:
|
||||
```
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/required-properties.yaml -o /tmp/java-okhttp/ --openapi-normalizer REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT=true
|
||||
```
|
||||
|
||||
- `FILTER`
|
||||
|
||||
The `FILTER` parameter allows selective inclusion of API operations based on specific criteria. It applies the `x-internal: true` property to operations that do **not** match the specified values, preventing them from being generated.
|
||||
The `FILTER` parameter allows selective inclusion of API operations based on specific criteria. It applies the `x-internal: true` property to operations that do **not** match the specified values, preventing them from being generated. Multiple filters can be separated by a semicolon.
|
||||
|
||||
### Available Filters
|
||||
|
||||
@@ -658,6 +666,9 @@ The `FILTER` parameter allows selective inclusion of API operations based on spe
|
||||
- **`tag`**
|
||||
When set to `tag:person|basic`, operations **not** tagged with `person` or `basic` will be marked as internal (`x-internal: true`), and will not be generated.
|
||||
|
||||
- **`path`**
|
||||
When set to `path:/v1|/v2`, operations on paths **not** starting with `/v1` or with `/v2` will be marked as internal (`x-internal: true`), and will not be generated.
|
||||
|
||||
### Example Usage
|
||||
|
||||
```sh
|
||||
@@ -665,7 +676,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
|
||||
-g java \
|
||||
-i modules/openapi-generator/src/test/resources/3_0/petstore.yaml \
|
||||
-o /tmp/java-okhttp/ \
|
||||
--openapi-normalizer FILTER="operationId:addPet|getPetById"
|
||||
--openapi-normalizer FILTER="operationId:addPet|getPetById ; tag:store"
|
||||
```
|
||||
|
||||
- `SET_CONTAINER_TO_NULLABLE`: When set to `array|set|map` (or just `array`) for example, it will set `nullable` in array, set and map to true.
|
||||
|
||||
@@ -3,6 +3,7 @@ id: generators
|
||||
title: Generators List
|
||||
---
|
||||
|
||||
[main] INFO o.o.c.l.PythonFastAPIServerCodegen - Skipping sorting of path operations, order matters, let the developer decide via their specification file.
|
||||
The following generators are available:
|
||||
|
||||
## CLIENT generators
|
||||
|
||||
@@ -133,6 +133,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
|
||||
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
|
||||
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-size-message|Add this property whenever you need to customize the invalidation error message for the size or length of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-minimum-message|Add this property whenever you need to customize the invalidation error message for the minimum value of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-maximum-message|Add this property whenever you need to customize the invalidation error message for the maximum value of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-spring-api-version|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).|OPERATION|null
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +67,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL|
|
||||
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|
||||
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-size-message|Add this property whenever you need to customize the invalidation error message for the size or length of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-minimum-message|Add this property whenever you need to customize the invalidation error message for the minimum value of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-maximum-message|Add this property whenever you need to customize the invalidation error message for the maximum value of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-kotlin-implements|Ability to specify interfaces that model must implement|MODEL|empty array
|
||||
|x-kotlin-implements-fields|Specify attributes that are implemented by the interface(s) added via `x-kotlin-implements`|MODEL|empty array
|
||||
|
||||
|
||||
@@ -126,6 +126,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
|
||||
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
|
||||
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-size-message|Add this property whenever you need to customize the invalidation error message for the size or length of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-minimum-message|Add this property whenever you need to customize the invalidation error message for the minimum value of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-maximum-message|Add this property whenever you need to customize the invalidation error message for the maximum value of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-spring-api-version|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).|OPERATION|null
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |false|
|
||||
|useSquareBracketsInArrayNames|Setting this property to true will add brackets to array attribute names, e.g. my_values[].| |false|
|
||||
|withAWSV4Signature|whether to include AWS v4 signature support| |false|
|
||||
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|
||||
|withNodeImports|Setting this property to true adds imports for NodeJS| |false|
|
||||
|withSeparateModelsAndApi|Put the model and api in separate folders and in separate classes. This requires in addition a value for 'apiPackage' and 'modelPackage'| |false|
|
||||
@@ -291,7 +292,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|
||||
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
|
||||
|SignatureAuth|✗|OAS3
|
||||
|AWSV4Signature|✗|ToolingExtension
|
||||
|AWSV4Signature|✓|ToolingExtension
|
||||
|
||||
### Wire Format Feature
|
||||
| Name | Supported | Defined By |
|
||||
|
||||
@@ -29,6 +29,7 @@ import io.airlift.airline.Arguments;
|
||||
import io.airlift.airline.Command;
|
||||
import io.airlift.airline.Option;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.ClientOptInput;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
@@ -248,7 +249,7 @@ public class GenerateBatch extends OpenApiGeneratorCommand {
|
||||
Path filesMeta = Paths.get(outDir.toAbsolutePath().toString(), ".openapi-generator", "FILES");
|
||||
if (filesMeta.toFile().exists()) {
|
||||
FileUtils.readLines(filesMeta.toFile(), StandardCharsets.UTF_8).forEach(relativePath -> {
|
||||
if (!StringUtils.startsWith(relativePath, ".")) {
|
||||
if (!Strings.CS.startsWith(relativePath, ".")) {
|
||||
Path file = outDir.resolve(relativePath).toAbsolutePath();
|
||||
// hack: disallow directory traversal outside of output directory. we don't want to delete wrong files.
|
||||
if (file.toString().startsWith(outDir.toAbsolutePath().toString())) {
|
||||
|
||||
@@ -81,12 +81,12 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
|
||||
/**
|
||||
* The template directory holding a custom template.
|
||||
*/
|
||||
val templateDir = project.objects.property<String?>()
|
||||
val templateDir = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* The template location (which may be a directory or a classpath location) holding custom templates.
|
||||
*/
|
||||
val templateResourcePath = project.objects.property<String?>()
|
||||
val templateResourcePath = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Adds authorization headers when fetching the OpenAPI definitions remotely.
|
||||
@@ -109,7 +109,7 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
|
||||
/**
|
||||
* Specifies if the existing files should be overwritten during the generation.
|
||||
*/
|
||||
val skipOverwrite = project.objects.property<Boolean?>()
|
||||
val skipOverwrite = project.objects.property<Boolean>()
|
||||
|
||||
/**
|
||||
* Package for generated classes (where supported)
|
||||
@@ -244,32 +244,32 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
|
||||
/**
|
||||
* Reference the library template (sub-template) of a generator.
|
||||
*/
|
||||
val library = project.objects.property<String?>()
|
||||
val library = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Git host, e.g. gitlab.com.
|
||||
*/
|
||||
val gitHost = project.objects.property<String?>()
|
||||
val gitHost = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Git user ID, e.g. openapitools.
|
||||
*/
|
||||
val gitUserId = project.objects.property<String?>()
|
||||
val gitUserId = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Git repo ID, e.g. openapi-generator.
|
||||
*/
|
||||
val gitRepoId = project.objects.property<String?>()
|
||||
val gitRepoId = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Release note, default to 'Minor update'.
|
||||
*/
|
||||
val releaseNote = project.objects.property<String?>()
|
||||
val releaseNote = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* HTTP user agent, e.g. codegen_csharp_api_client, default to 'OpenAPI-Generator/{packageVersion}/{language}'
|
||||
*/
|
||||
val httpUserAgent = project.objects.property<String?>()
|
||||
val httpUserAgent = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Specifies how a reserved name should be escaped to. Otherwise, the default _<name> is used.
|
||||
@@ -279,17 +279,17 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
|
||||
/**
|
||||
* Specifies an override location for the .openapi-generator-ignore file. Most useful on initial generation.
|
||||
*/
|
||||
val ignoreFileOverride = project.objects.property<String?>()
|
||||
val ignoreFileOverride = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Remove prefix of operationId, e.g. config_getId => getId
|
||||
*/
|
||||
val removeOperationIdPrefix = project.objects.property<Boolean?>()
|
||||
val removeOperationIdPrefix = project.objects.property<Boolean>()
|
||||
|
||||
/**
|
||||
* Skip examples defined in the operation
|
||||
*/
|
||||
val skipOperationExample = project.objects.property<Boolean?>()
|
||||
val skipOperationExample = project.objects.property<Boolean>()
|
||||
|
||||
/**
|
||||
* Defines which API-related files should be generated. This allows you to create a subset of generated files (or none at all).
|
||||
@@ -394,7 +394,7 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
|
||||
/**
|
||||
* Templating engine: "mustache" (default) or "handlebars" (beta)
|
||||
*/
|
||||
val engine = project.objects.property<String?>()
|
||||
val engine = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Defines whether the output dir should be cleaned up before generating the output.
|
||||
|
||||
@@ -55,7 +55,6 @@ import org.openapitools.codegen.config.MergedSpecBuilder
|
||||
*
|
||||
* @author Jim Schubert
|
||||
*/
|
||||
@Suppress("UnstableApiUsage")
|
||||
@CacheableTask
|
||||
open class GenerateTask @Inject constructor(private val objectFactory: ObjectFactory) : DefaultTask() {
|
||||
|
||||
@@ -154,14 +153,14 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
|
||||
@get:Optional
|
||||
@get:InputDirectory
|
||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
val templateDir = project.objects.property<String?>()
|
||||
val templateDir = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Resource path containing template files.
|
||||
*/
|
||||
@get:Optional
|
||||
@get:Input
|
||||
val templateResourcePath = project.objects.property<String?>()
|
||||
val templateResourcePath = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Adds authorization headers when fetching the OpenAPI definitions remotely.
|
||||
@@ -193,7 +192,7 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
|
||||
*/
|
||||
@get:Optional
|
||||
@get:Input
|
||||
val skipOverwrite = project.objects.property<Boolean?>()
|
||||
val skipOverwrite = project.objects.property<Boolean>()
|
||||
|
||||
/**
|
||||
* Package for generated classes (where supported)
|
||||
@@ -384,42 +383,42 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
|
||||
*/
|
||||
@get:Optional
|
||||
@get:Input
|
||||
val library = project.objects.property<String?>()
|
||||
val library = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Git host, e.g. gitlab.com.
|
||||
*/
|
||||
@get:Optional
|
||||
@get:Input
|
||||
val gitHost = project.objects.property<String?>()
|
||||
val gitHost = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Git user ID, e.g. openapitools.
|
||||
*/
|
||||
@get:Optional
|
||||
@get:Input
|
||||
val gitUserId = project.objects.property<String?>()
|
||||
val gitUserId = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Git repo ID, e.g. openapi-generator.
|
||||
*/
|
||||
@get:Optional
|
||||
@get:Input
|
||||
val gitRepoId = project.objects.property<String?>()
|
||||
val gitRepoId = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Release note, default to 'Minor update'.
|
||||
*/
|
||||
@get:Optional
|
||||
@get:Input
|
||||
val releaseNote = project.objects.property<String?>()
|
||||
val releaseNote = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* HTTP user agent, e.g. codegen_csharp_api_client, default to 'OpenAPI-Generator/{packageVersion}/{language}'
|
||||
*/
|
||||
@get:Optional
|
||||
@get:Input
|
||||
val httpUserAgent = project.objects.property<String?>()
|
||||
val httpUserAgent = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Specifies how a reserved name should be escaped to.
|
||||
@@ -434,21 +433,21 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
|
||||
@get:Optional
|
||||
@get:InputFile
|
||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
val ignoreFileOverride = project.objects.property<String?>()
|
||||
val ignoreFileOverride = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Remove prefix of operationId, e.g. config_getId => getId
|
||||
*/
|
||||
@get:Optional
|
||||
@get:Input
|
||||
val removeOperationIdPrefix = project.objects.property<Boolean?>()
|
||||
val removeOperationIdPrefix = project.objects.property<Boolean>()
|
||||
|
||||
/**
|
||||
* Remove examples defined in the operation
|
||||
*/
|
||||
@get:Optional
|
||||
@get:Input
|
||||
val skipOperationExample = project.objects.property<Boolean?>()
|
||||
val skipOperationExample = project.objects.property<Boolean>()
|
||||
|
||||
/**
|
||||
* Defines which API-related files should be generated. This allows you to create a subset of generated files (or none at all).
|
||||
@@ -581,7 +580,7 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
|
||||
*/
|
||||
@get:Optional
|
||||
@get:Input
|
||||
val engine = project.objects.property<String?>()
|
||||
val engine = project.objects.property<String>()
|
||||
|
||||
/**
|
||||
* Defines whether the output dir should be cleaned up before generating the output.
|
||||
@@ -598,19 +597,11 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
|
||||
@get:Input
|
||||
val dryRun = project.objects.property<Boolean>()
|
||||
|
||||
private fun <T : Any?> Property<T>.ifNotEmpty(block: Property<T>.(T) -> Unit) {
|
||||
private fun <T> Property<T>.ifNotEmpty(block: Property<T>.(T) -> Unit) {
|
||||
if (isPresent) {
|
||||
val item: T? = get()
|
||||
if (item != null) {
|
||||
when (get()) {
|
||||
is String -> if ((get() as String).isNotEmpty()) {
|
||||
block(get())
|
||||
}
|
||||
is String? -> if (true == (get() as String?)?.isNotEmpty()) {
|
||||
block(get())
|
||||
}
|
||||
else -> block(get())
|
||||
}
|
||||
when (val value = get()) {
|
||||
is String -> if (value.isNotEmpty()) block(value)
|
||||
else -> block(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -725,7 +716,7 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
|
||||
}
|
||||
|
||||
skipOverwrite.ifNotEmpty { value ->
|
||||
configurator.setSkipOverwrite(value ?: false)
|
||||
configurator.setSkipOverwrite(value)
|
||||
}
|
||||
|
||||
generatorName.ifNotEmpty { value ->
|
||||
@@ -820,11 +811,11 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
|
||||
}
|
||||
|
||||
removeOperationIdPrefix.ifNotEmpty { value ->
|
||||
configurator.setRemoveOperationIdPrefix(value!!)
|
||||
configurator.setRemoveOperationIdPrefix(value)
|
||||
}
|
||||
|
||||
skipOperationExample.ifNotEmpty { value ->
|
||||
configurator.setSkipOperationExample(value!!)
|
||||
configurator.setSkipOperationExample(value)
|
||||
}
|
||||
|
||||
logToStderr.ifNotEmpty { value ->
|
||||
|
||||
@@ -5734,7 +5734,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
cs.name = key;
|
||||
cs.description = securityScheme.getDescription();
|
||||
cs.type = securityScheme.getType().toString();
|
||||
cs.isCode = cs.isPassword = cs.isApplication = cs.isImplicit = cs.isOpenId = false;
|
||||
cs.isCode = cs.isPassword = cs.isApplication = cs.isImplicit = cs.isOpenId = cs.isOAuth = false;
|
||||
cs.isHttpSignature = false;
|
||||
cs.isBasicBasic = cs.isBasicBearer = false;
|
||||
cs.scheme = securityScheme.getScheme();
|
||||
|
||||
@@ -356,7 +356,9 @@ public class InlineModelResolver {
|
||||
} else if (schema.getProperties() != null) {
|
||||
// If non-object type is specified but also properties
|
||||
LOGGER.error("Illegal schema found with non-object type combined with properties," +
|
||||
" no properties should be defined:\n " + schema.toString());
|
||||
" no properties should be defined:" +
|
||||
" consider using --openapi-normalizer REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT=true\n " +
|
||||
schema.toString());
|
||||
return;
|
||||
} else if (schema.getAdditionalProperties() != null) {
|
||||
// If non-object type is specified but also additionalProperties
|
||||
|
||||
@@ -49,7 +49,7 @@ public class OpenAPINormalizer {
|
||||
|
||||
private TreeSet<String> anyTypeTreeSet = new TreeSet<>();
|
||||
|
||||
protected final Logger LOGGER = LoggerFactory.getLogger(OpenAPINormalizer.class);
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(OpenAPINormalizer.class);
|
||||
|
||||
Set<String> ruleNames = new TreeSet<>();
|
||||
Set<String> rulesDefaultToTrue = new TreeSet<>();
|
||||
@@ -124,6 +124,9 @@ public class OpenAPINormalizer {
|
||||
// the allOf contains a new schema containing the properties in the top level
|
||||
final String REFACTOR_ALLOF_WITH_PROPERTIES_ONLY = "REFACTOR_ALLOF_WITH_PROPERTIES_ONLY";
|
||||
|
||||
// when set to true, remove the "properties" of a schema with type other than "object"
|
||||
final String REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT = "REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT";
|
||||
|
||||
// when set to true, normalize OpenAPI 3.1 spec to make it work with the generator
|
||||
final String NORMALIZE_31SPEC = "NORMALIZE_31SPEC";
|
||||
|
||||
@@ -133,10 +136,6 @@ public class OpenAPINormalizer {
|
||||
|
||||
// when set (e.g. operationId:getPetById|addPet), filter out (or remove) everything else
|
||||
final String FILTER = "FILTER";
|
||||
HashSet<String> operationIdFilters = new HashSet<>();
|
||||
HashSet<String> methodFilters = new HashSet<>();
|
||||
|
||||
HashSet<String> tagFilters = new HashSet<>();
|
||||
|
||||
// when set (e.g. operationId:getPetById|addPet), filter out (or remove) everything else
|
||||
final String SET_CONTAINER_TO_NULLABLE = "SET_CONTAINER_TO_NULLABLE";
|
||||
@@ -210,11 +209,13 @@ public class OpenAPINormalizer {
|
||||
ruleNames.add(SET_CONTAINER_TO_NULLABLE);
|
||||
ruleNames.add(SET_PRIMITIVE_TYPES_TO_NULLABLE);
|
||||
ruleNames.add(SIMPLIFY_ONEOF_ANYOF_ENUM);
|
||||
ruleNames.add(REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT);
|
||||
|
||||
// rules that are default to true
|
||||
rules.put(SIMPLIFY_ONEOF_ANYOF, true);
|
||||
rules.put(SIMPLIFY_BOOLEAN_ENUM, true);
|
||||
rules.put(SIMPLIFY_ONEOF_ANYOF_ENUM, true);
|
||||
rules.put(REFACTOR_ALLOF_WITH_PROPERTIES_ONLY, true);
|
||||
|
||||
processRules(inputRules);
|
||||
|
||||
@@ -275,30 +276,7 @@ public class OpenAPINormalizer {
|
||||
|
||||
if (inputRules.get(FILTER) != null) {
|
||||
rules.put(FILTER, true);
|
||||
|
||||
String[] filterStrs = inputRules.get(FILTER).split(":");
|
||||
if (filterStrs.length != 2) { // only support operationId with : at the moment
|
||||
LOGGER.error("FILTER rule must be in the form of `operationId:name1|name2|name3` or `method:get|post|put` or `tag:tag1|tag2|tag3`: {}", inputRules.get(FILTER));
|
||||
} else {
|
||||
if ("operationId".equals(filterStrs[0])) {
|
||||
operationIdFilters = Arrays.stream(filterStrs[1].split("[|]"))
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::trim)
|
||||
.collect(Collectors.toCollection(HashSet::new));
|
||||
} else if ("method".equals(filterStrs[0])) {
|
||||
methodFilters = Arrays.stream(filterStrs[1].split("[|]"))
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::trim)
|
||||
.collect(Collectors.toCollection(HashSet::new));
|
||||
} else if ("tag".equals(filterStrs[0])) {
|
||||
tagFilters = Arrays.stream(filterStrs[1].split("[|]"))
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::trim)
|
||||
.collect(Collectors.toCollection(HashSet::new));
|
||||
} else {
|
||||
LOGGER.error("FILTER rule must be in the form of `operationId:name1|name2|name3` or `method:get|post|put` or `tag:tag1|tag2|tag3`: {}", inputRules.get(FILTER));
|
||||
}
|
||||
}
|
||||
// actual parsing is delayed to allow customization of the Filter processing
|
||||
}
|
||||
|
||||
if (inputRules.get(SET_CONTAINER_TO_NULLABLE) != null) {
|
||||
@@ -344,6 +322,19 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the filter to process the FILTER normalizer.
|
||||
* Override this to create a custom filter normalizer.
|
||||
*
|
||||
* @param openApi Contract used in the filtering (could be used for customization).
|
||||
* @param filters full FILTER value
|
||||
*
|
||||
* @return a Filter containing the parsed filters.
|
||||
*/
|
||||
protected Filter createFilter(OpenAPI openApi, String filters) {
|
||||
return new Filter(filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes the OpenAPI input, which may not perfectly conform to
|
||||
* the specification.
|
||||
@@ -405,15 +396,15 @@ public class OpenAPINormalizer {
|
||||
"trace", PathItem::getTrace
|
||||
);
|
||||
|
||||
// Iterates over each HTTP method in methodMap, retrieves the corresponding Operation from the PathItem,
|
||||
// and marks it as internal (`x-internal`) if the method is not in methodFilters.
|
||||
methodMap.forEach((method, getter) -> {
|
||||
Operation operation = getter.apply(path);
|
||||
if (operation != null && !methodFilters.isEmpty()) {
|
||||
LOGGER.info("operation `{}` marked internal only (x-internal: `{}`) by the method FILTER", operation.getOperationId(), !methodFilters.contains(method));
|
||||
operation.addExtension("x-internal", !methodFilters.contains(method));
|
||||
if (Boolean.TRUE.equals(getRule(FILTER))) {
|
||||
String filters = inputRules.get(FILTER);
|
||||
Filter filter = createFilter(this.openAPI, filters);
|
||||
if (filter.parse()) {
|
||||
// Iterates over each HTTP method in methodMap, retrieves the corresponding Operations from the PathItem,
|
||||
// and marks it as internal (`x-internal=true`) if the method/operationId/tag/path is not in the filters.
|
||||
filter.apply(pathsEntry.getKey(), path, methodMap);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Include callback operation as well
|
||||
for (Operation operation : path.readOperations()) {
|
||||
@@ -430,22 +421,6 @@ public class OpenAPINormalizer {
|
||||
normalizeParameters(path.getParameters());
|
||||
|
||||
for (Operation operation : operations) {
|
||||
if (operationIdFilters.size() > 0) {
|
||||
if (operationIdFilters.contains(operation.getOperationId())) {
|
||||
operation.addExtension(X_INTERNAL, false);
|
||||
} else {
|
||||
LOGGER.info("operation `{}` marked as internal only (x-internal: true) by the operationId FILTER", operation.getOperationId());
|
||||
operation.addExtension(X_INTERNAL, true);
|
||||
}
|
||||
} else if (!tagFilters.isEmpty()) {
|
||||
if (operation.getTags().stream().anyMatch(tagFilters::contains)) {
|
||||
operation.addExtension(X_INTERNAL, false);
|
||||
} else {
|
||||
LOGGER.info("operation `{}` marked as internal only (x-internal: true) by the tag FILTER", operation.getOperationId());
|
||||
operation.addExtension(X_INTERNAL, true);
|
||||
}
|
||||
}
|
||||
|
||||
normalizeOperation(operation);
|
||||
normalizeRequestBody(operation);
|
||||
normalizeParameters(operation.getParameters());
|
||||
@@ -731,6 +706,8 @@ public class OpenAPINormalizer {
|
||||
|
||||
markSchemaAsVisited(schema, visitedSchemas);
|
||||
|
||||
processNormalizeOtherThanObjectWithProperties(schema);
|
||||
|
||||
if (ModelUtils.isArraySchema(schema)) { // array
|
||||
Schema result = normalizeArraySchema(schema);
|
||||
normalizeSchema(result.getItems(), visitedSchemas);
|
||||
@@ -1363,7 +1340,7 @@ public class OpenAPINormalizer {
|
||||
*
|
||||
* @param schema Schema to modify
|
||||
* @param subSchemas List of sub-schemas to check
|
||||
* @param schemaType Type of composed schema ("oneOf" or "anyOf")
|
||||
* @param composedType Type of composed schema ("oneOf" or "anyOf")
|
||||
* @return Simplified schema
|
||||
*/
|
||||
protected Schema simplifyComposedSchemaWithEnums(Schema schema, List<Object> subSchemas, String composedType) {
|
||||
@@ -1832,4 +1809,181 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
|
||||
// ===================== end of rules =====================
|
||||
|
||||
protected static class Filter {
|
||||
public static final String OPERATION_ID = "operationId";
|
||||
public static final String METHOD = "method";
|
||||
public static final String TAG = "tag";
|
||||
public static final String PATH = "path";
|
||||
private final String filters;
|
||||
protected Set<String> operationIdFilters = Collections.emptySet();
|
||||
protected Set<String> methodFilters = Collections.emptySet();
|
||||
protected Set<String> tagFilters = Collections.emptySet();
|
||||
protected Set<String> pathStartingWithFilters = Collections.emptySet();
|
||||
private boolean hasFilter;
|
||||
|
||||
protected Filter(String filters) {
|
||||
this.filters = filters.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the parsing of the filter string.
|
||||
*
|
||||
* @return true if filters need to be processed
|
||||
*/
|
||||
public boolean parse() {
|
||||
if (StringUtils.isEmpty(filters)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
doParse();
|
||||
return hasFilter();
|
||||
} catch (RuntimeException e) {
|
||||
String message = String.format(Locale.ROOT, "FILTER rule [%s] must be in the form of `%s:name1|name2|name3` or `%s:get|post|put` or `%s:tag1|tag2|tag3` or `%s:/v1|/v2`. Error: %s",
|
||||
filters, Filter.OPERATION_ID, Filter.METHOD, Filter.TAG, Filter.PATH, e.getMessage());
|
||||
// throw an exception. This is a breaking change compared to pre 7.16.0
|
||||
// Workaround: fix the syntax!
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private void doParse() {
|
||||
for (String filter : filters.split(";")) {
|
||||
filter = filter.trim();
|
||||
String[] filterStrs = filter.split(":");
|
||||
if (filterStrs.length != 2) { // only support filter with : at the moment
|
||||
throw new IllegalArgumentException("filter with no value not supported :[" + filter + "]");
|
||||
} else {
|
||||
String filterKey = filterStrs[0].trim();
|
||||
String filterValue = filterStrs[1];
|
||||
Set<String> parsedFilters = splitByPipe(filterValue);
|
||||
hasFilter = true;
|
||||
if (OPERATION_ID.equals(filterKey)) {
|
||||
operationIdFilters = parsedFilters;
|
||||
} else if (METHOD.equals(filterKey)) {
|
||||
methodFilters = parsedFilters;
|
||||
} else if (TAG.equals(filterKey)) {
|
||||
tagFilters = parsedFilters;
|
||||
} else if (PATH.equals(filterKey)) {
|
||||
pathStartingWithFilters = parsedFilters;
|
||||
} else {
|
||||
parse(filterKey, filterValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Split the filterValue by pipe.
|
||||
*
|
||||
* @return the split values.
|
||||
*/
|
||||
protected Set<String> splitByPipe(String filterValue) {
|
||||
return Arrays.stream(filterValue.split("[|]"))
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::trim)
|
||||
.collect(Collectors.toCollection(HashSet::new));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse non default filters.
|
||||
*
|
||||
* Override this method to add custom parsing logic.
|
||||
*
|
||||
* By default throws IllegalArgumentException.
|
||||
*
|
||||
* @param filterName name of the filter
|
||||
* @param filterValue value of the filter
|
||||
*/
|
||||
protected void parse(String filterName, String filterValue) {
|
||||
parseFails(filterName, filterValue);
|
||||
}
|
||||
|
||||
protected void parseFails(String filterName, String filterValue) {
|
||||
throw new IllegalArgumentException("filter not supported :[" + filterName + ":" + filterValue + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the OpenAPI contract match an extra filter.
|
||||
*
|
||||
* Override this method to add custom logic.
|
||||
*
|
||||
* @param operation Openapi Operation
|
||||
* @param path Path of the operation
|
||||
*
|
||||
* @return true if the operation of path match the filter
|
||||
*/
|
||||
protected boolean hasCustomFilterMatch(String path, Operation operation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasFilter() {
|
||||
return hasFilter;
|
||||
}
|
||||
|
||||
public void apply(String path, PathItem pathItem, Map<String, Function<PathItem, Operation>> methodMap) {
|
||||
methodMap.forEach((method, getter) -> {
|
||||
Operation operation = getter.apply(pathItem);
|
||||
if (operation != null) {
|
||||
boolean found = false;
|
||||
found |= logIfMatch(PATH, operation, hasPathStarting(path));
|
||||
found |= logIfMatch(TAG, operation, hasTag(operation));
|
||||
found |= logIfMatch(OPERATION_ID, operation, hasOperationId(operation));
|
||||
found |= logIfMatch(METHOD, operation, hasMethod(method));
|
||||
found |= hasCustomFilterMatch(path, operation);
|
||||
|
||||
operation.addExtension(X_INTERNAL, !found);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected boolean logIfMatch(String filterName, Operation operation, boolean filterMatched) {
|
||||
if (filterMatched) {
|
||||
logMatch(filterName, operation);
|
||||
}
|
||||
return filterMatched;
|
||||
}
|
||||
|
||||
protected void logMatch(String filterName, Operation operation) {
|
||||
getLogger().info("operation `{}` marked as internal only (x-internal: true) by the {} FILTER", operation.getOperationId(), filterName);
|
||||
}
|
||||
|
||||
protected Logger getLogger() {
|
||||
return OpenAPINormalizer.LOGGER;
|
||||
}
|
||||
|
||||
private boolean hasPathStarting(String path) {
|
||||
return pathStartingWithFilters.stream().anyMatch(filter -> path.startsWith(filter));
|
||||
}
|
||||
|
||||
private boolean hasTag( Operation operation) {
|
||||
return operation.getTags() != null && operation.getTags().stream().anyMatch(tagFilters::contains);
|
||||
}
|
||||
|
||||
private boolean hasOperationId(Operation operation) {
|
||||
return operationIdFilters.contains(operation.getOperationId());
|
||||
}
|
||||
|
||||
private boolean hasMethod(String method) {
|
||||
return methodFilters.contains(method);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* When set to true, remove "properties" attribute on schema other than "object"
|
||||
* since it should be ignored and may result in odd generated code
|
||||
*
|
||||
* @param schema Schema
|
||||
* @return Schema
|
||||
*/
|
||||
protected void processNormalizeOtherThanObjectWithProperties(Schema schema) {
|
||||
if (getRule(REMOVE_PROPERTIES_FROM_TYPE_OTHER_THAN_OBJECT)) {
|
||||
// Check object models / any type models / composed models for properties,
|
||||
// if the schema has a type defined that is not "object" it should not define
|
||||
// any properties
|
||||
if (schema.getType() != null && !"object".equals(schema.getType())) {
|
||||
schema.setProperties(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ public enum VendorExtension {
|
||||
X_OPERATION_EXTRA_ANNOTATION("x-operation-extra-annotation", ExtensionLevel.OPERATION, "List of custom annotations to be added to operation", null),
|
||||
X_VERSION_PARAM("x-version-param", ExtensionLevel.OPERATION_PARAMETER, "Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false", null),
|
||||
X_PATTERN_MESSAGE("x-pattern-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable", null),
|
||||
X_SIZE_MESSAGE("x-size-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the size or length of a variable", null),
|
||||
X_MINIMUM_MESSAGE("x-minimum-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the minimum value of a variable", null),
|
||||
X_MAXIMUM_MESSAGE("x-maximum-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the maximum value of a variable", null),
|
||||
X_ZERO_BASED_ENUM("x-zero-based-enum", ExtensionLevel.MODEL, "When used on an enum, the index will not be generated and the default numbering will be used, zero-based", "false");
|
||||
|
||||
private final String name;
|
||||
|
||||
@@ -1628,7 +1628,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
Schema<?> target = ModelUtils.isGenerateAliasAsModel() ? p : schema;
|
||||
if (ModelUtils.isArraySchema(target)) {
|
||||
Schema<?> items = getSchemaItems(schema);
|
||||
return getSchemaType(target) + "<" + getTypeDeclarationForArray(items) + ">";
|
||||
return typeMapping.get("array") + "<" + getTypeDeclarationForArray(items) + ">";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
// Should we also support maps of maps?
|
||||
Schema<?> inner = ModelUtils.getAdditionalProperties(p);
|
||||
|
||||
@@ -1891,6 +1891,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
model.imports.add("Arrays");
|
||||
} else if ("set".equals(property.containerType)) {
|
||||
model.imports.add("LinkedHashSet");
|
||||
model.imports.add("Arrays");
|
||||
if ((!openApiNullable || !property.isNullable) && jackson) { // cannot be wrapped to nullable
|
||||
model.imports.add("JsonDeserialize");
|
||||
property.vendorExtensions.put("x-setter-extra-annotation", "@JsonDeserialize(as = LinkedHashSet.class)");
|
||||
|
||||
@@ -119,6 +119,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
||||
convertPropertyToStringAndWriteBack(CodegenConstants.IMPL_FOLDER, this::setImplFolder);
|
||||
convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION, this::setUseBeanValidation);
|
||||
convertPropertyToBooleanAndWriteBack(USE_TAGS, this::setUseTags);
|
||||
convertPropertyToBooleanAndWriteBack(JACKSON, this::setJackson);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,6 +34,7 @@ import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
@@ -601,7 +602,7 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
@Override
|
||||
public String toModelImport(String name) {
|
||||
String modelImport;
|
||||
if (StringUtils.startsWithAny(name, "import", "from")) {
|
||||
if (Strings.CS.startsWithAny(name, "import", "from")) {
|
||||
modelImport = name;
|
||||
} else {
|
||||
modelImport = "from ";
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
@@ -440,6 +441,17 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
StringJoiner joinedDefaultValues = new StringJoiner(", ");
|
||||
Object defaultValues = p.getDefault();
|
||||
if (defaultValues instanceof ArrayNode) {
|
||||
for (var value : (ArrayNode) defaultValues) {
|
||||
joinedDefaultValues.add(value.toString());
|
||||
}
|
||||
return "{" + joinedDefaultValues + "}";
|
||||
}
|
||||
}
|
||||
|
||||
return super.toDefaultValue(p);
|
||||
}
|
||||
|
||||
|
||||
@@ -187,19 +187,22 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")
|
||||
.doNotOverwrite());
|
||||
supportingFiles.add(new SupportingFile("RestResourceRoot.mustache",
|
||||
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestResourceRoot.java")
|
||||
.doNotOverwrite());
|
||||
|
||||
if (!interfaceOnly) {
|
||||
supportingFiles.add(new SupportingFile("RestResourceRoot.mustache",
|
||||
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestResourceRoot.java")
|
||||
.doNotOverwrite());
|
||||
|
||||
supportingFiles.add(new SupportingFile("RestApplication.mustache",
|
||||
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestApplication.java")
|
||||
.doNotOverwrite());
|
||||
}
|
||||
|
||||
if (generatePom) {
|
||||
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")
|
||||
.doNotOverwrite());
|
||||
}
|
||||
|
||||
supportingFiles.add(new SupportingFile("RestApplication.mustache",
|
||||
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestApplication.java")
|
||||
.doNotOverwrite());
|
||||
|
||||
if (StringUtils.isNotEmpty(openApiSpecFileLocation)) {
|
||||
int index = openApiSpecFileLocation.lastIndexOf('/');
|
||||
String fileFolder;
|
||||
@@ -276,6 +279,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
if (!jackson) {
|
||||
codegenModel.imports.remove("JsonValue");
|
||||
codegenModel.imports.remove("JsonProperty");
|
||||
codegenModel.imports.remove("JsonTypeName");
|
||||
}
|
||||
return codegenModel;
|
||||
}
|
||||
|
||||
@@ -1012,6 +1012,9 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
extensions.add(VendorExtension.X_DISCRIMINATOR_VALUE);
|
||||
extensions.add(VendorExtension.X_FIELD_EXTRA_ANNOTATION);
|
||||
extensions.add(VendorExtension.X_PATTERN_MESSAGE);
|
||||
extensions.add(VendorExtension.X_SIZE_MESSAGE);
|
||||
extensions.add(VendorExtension.X_MINIMUM_MESSAGE);
|
||||
extensions.add(VendorExtension.X_MAXIMUM_MESSAGE);
|
||||
extensions.add(VendorExtension.X_KOTLIN_IMPLEMENTS);
|
||||
extensions.add(VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS);
|
||||
return extensions;
|
||||
|
||||
@@ -20,7 +20,7 @@ package org.openapitools.codegen.languages;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
@@ -355,7 +355,7 @@ public class PythonClientCodegen extends AbstractPythonCodegen implements Codege
|
||||
@Override
|
||||
public String toModelImport(String name) {
|
||||
String modelImport;
|
||||
if (StringUtils.startsWithAny(name, "import", "from")) {
|
||||
if (Strings.CS.startsWithAny(name, "import", "from")) {
|
||||
modelImport = name;
|
||||
} else {
|
||||
modelImport = "from ";
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
@@ -89,6 +90,11 @@ public class PythonFastAPIServerCodegen extends AbstractPythonCodegen {
|
||||
public PythonFastAPIServerCodegen() {
|
||||
super();
|
||||
|
||||
// Skip sorting of operations to preserve the order found in the OpenAPI spec file. See
|
||||
// https://fastapi.tiangolo.com/tutorial/path-params/?h=path#order-matters for details on why order matters.
|
||||
LOGGER.info("Skipping sorting of path operations, order matters, let the developer decide via their specification file.");
|
||||
setSkipSortingOperations(true);
|
||||
|
||||
modifyFeatureSet(features -> features.includeSecurityFeatures(
|
||||
SecurityFeature.OAuth2_AuthorizationCode,
|
||||
SecurityFeature.OAuth2_Password
|
||||
@@ -198,7 +204,7 @@ public class PythonFastAPIServerCodegen extends AbstractPythonCodegen {
|
||||
@Override
|
||||
public String toModelImport(String name) {
|
||||
String modelImport;
|
||||
if (StringUtils.startsWithAny(name, "import", "from")) {
|
||||
if (Strings.CS.startsWithAny(name, "import", "from")) {
|
||||
modelImport = name;
|
||||
} else {
|
||||
modelImport = "from ";
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.openapitools.codegen.languages;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
@@ -353,7 +354,7 @@ public class PythonPydanticV1ClientCodegen extends AbstractPythonPydanticV1Codeg
|
||||
@Override
|
||||
public String toModelImport(String name) {
|
||||
String modelImport;
|
||||
if (StringUtils.startsWithAny(name, "import", "from")) {
|
||||
if (Strings.CS.startsWithAny(name, "import", "from")) {
|
||||
modelImport = name;
|
||||
} else {
|
||||
modelImport = "from ";
|
||||
|
||||
@@ -271,6 +271,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
supportingFiles.add(new SupportingFile("gem.mustache", libFolder, gemName + ".rb"));
|
||||
String gemFolder = libFolder + File.separator + gemName;
|
||||
supportingFiles.add(new SupportingFile("api_error.mustache", gemFolder, "api_error.rb"));
|
||||
supportingFiles.add(new SupportingFile("api_model_base.mustache", gemFolder, "api_model_base.rb"));
|
||||
supportingFiles.add(new SupportingFile("version.mustache", gemFolder, "version.rb"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
|
||||
@@ -648,7 +648,7 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
}
|
||||
|
||||
private void postProcessPolymorphism(final List<ModelMap> allModels) {
|
||||
final HashMap<String, List<String>> discriminatorsForModel = new HashMap<>();
|
||||
final HashMap<String, List<CodegenDiscriminator>> discriminatorsForModel = new HashMap<>();
|
||||
|
||||
for (final ModelMap mo : allModels) {
|
||||
final CodegenModel cm = mo.getModel();
|
||||
@@ -656,15 +656,17 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
final CodegenComposedSchemas cs = cm.getComposedSchemas();
|
||||
if (cs != null) {
|
||||
final List<CodegenProperty> csOneOf = cs.getOneOf();
|
||||
CodegenDiscriminator discriminator = cm.getDiscriminator();
|
||||
|
||||
if (csOneOf != null) {
|
||||
processPolymorphismDataType(csOneOf);
|
||||
processPolymorphismDataType(csOneOf, discriminator);
|
||||
cs.setOneOf(csOneOf);
|
||||
cm.setComposedSchemas(cs);
|
||||
}
|
||||
|
||||
final List<CodegenProperty> csAnyOf = cs.getAnyOf();
|
||||
if (csAnyOf != null) {
|
||||
processPolymorphismDataType(csAnyOf);
|
||||
processPolymorphismDataType(csAnyOf, discriminator);
|
||||
cs.setAnyOf(csAnyOf);
|
||||
cm.setComposedSchemas(cs);
|
||||
}
|
||||
@@ -672,14 +674,14 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
|
||||
if (cm.discriminator != null) {
|
||||
for (final String model : cm.oneOf) {
|
||||
final List<String> discriminators = discriminatorsForModel.getOrDefault(model, new ArrayList<>());
|
||||
discriminators.add(cm.discriminator.getPropertyName());
|
||||
final List<CodegenDiscriminator> discriminators = discriminatorsForModel.getOrDefault(model, new ArrayList<>());
|
||||
discriminators.add(cm.discriminator);
|
||||
discriminatorsForModel.put(model, discriminators);
|
||||
}
|
||||
|
||||
for (final String model : cm.anyOf) {
|
||||
final List<String> discriminators = discriminatorsForModel.getOrDefault(model, new ArrayList<>());
|
||||
discriminators.add(cm.discriminator.getPropertyName());
|
||||
final List<CodegenDiscriminator> discriminators = discriminatorsForModel.getOrDefault(model, new ArrayList<>());
|
||||
discriminators.add(cm.discriminator);
|
||||
discriminatorsForModel.put(model, discriminators);
|
||||
}
|
||||
}
|
||||
@@ -689,11 +691,11 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
for (ModelMap mo : allModels) {
|
||||
final CodegenModel cm = mo.getModel();
|
||||
|
||||
final List<String> discriminators = discriminatorsForModel.get(cm.getSchemaName());
|
||||
final List<CodegenDiscriminator> discriminators = discriminatorsForModel.get(cm.getSchemaName());
|
||||
if (discriminators != null) {
|
||||
// If the discriminator field is not a defined attribute in the variant structure, create it.
|
||||
if (!discriminating(discriminators, cm)) {
|
||||
final String discriminator = discriminators.get(0);
|
||||
final CodegenDiscriminator discriminator = discriminators.get(0);
|
||||
|
||||
CodegenProperty property = new CodegenProperty();
|
||||
|
||||
@@ -710,17 +712,18 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
property.isDiscriminator = true;
|
||||
|
||||
// Attributes based on the discriminator value
|
||||
property.baseName = discriminator;
|
||||
property.name = discriminator;
|
||||
property.nameInCamelCase = camelize(discriminator);
|
||||
property.baseName = discriminator.getPropertyBaseName();
|
||||
property.name = discriminator.getPropertyName();
|
||||
property.nameInCamelCase = camelize(discriminator.getPropertyName());
|
||||
property.nameInPascalCase = property.nameInCamelCase.substring(0, 1).toUpperCase(Locale.ROOT) + property.nameInCamelCase.substring(1);
|
||||
property.nameInSnakeCase = underscore(discriminator).toUpperCase(Locale.ROOT);
|
||||
property.nameInSnakeCase = underscore(discriminator.getPropertyName()).toUpperCase(Locale.ROOT);
|
||||
property.getter = String.format(Locale.ROOT, "get%s", property.nameInPascalCase);
|
||||
property.setter = String.format(Locale.ROOT, "set%s", property.nameInPascalCase);
|
||||
property.defaultValueWithParam = String.format(Locale.ROOT, " = data.%s;", property.name);
|
||||
|
||||
// Attributes based on the model name
|
||||
property.defaultValue = String.format(Locale.ROOT, "r#\"%s\"#.to_string()", cm.getSchemaName());
|
||||
property.discriminatorValue = getDiscriminatorValue(cm.getClassname(), discriminator);
|
||||
property.jsonSchema = String.format(Locale.ROOT, "{ \"default\":\"%s\"; \"type\":\"string\" }", cm.getSchemaName());
|
||||
|
||||
cm.vars.add(property);
|
||||
@@ -743,14 +746,27 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean discriminating(final List<String> discriminatorsForModel, final CodegenModel cm) {
|
||||
private static String getDiscriminatorValue(String modelName, CodegenDiscriminator discriminator) {
|
||||
if (discriminator == null || discriminator.getMappedModels() == null) {
|
||||
return modelName;
|
||||
}
|
||||
return discriminator
|
||||
.getMappedModels()
|
||||
.stream()
|
||||
.filter(m -> m.getModelName().equals(modelName) && m.getMappingName() != null)
|
||||
.map(CodegenDiscriminator.MappedModel::getMappingName)
|
||||
.findFirst()
|
||||
.orElse(modelName);
|
||||
}
|
||||
|
||||
private static boolean discriminating(final List<CodegenDiscriminator> discriminatorsForModel, final CodegenModel cm) {
|
||||
resetDiscriminatorProperty(cm);
|
||||
|
||||
// Discriminator will be presented as enum tag -> One and only one tag is allowed
|
||||
int countString = 0;
|
||||
int countNonString = 0;
|
||||
for (final CodegenProperty var : cm.vars) {
|
||||
if (discriminatorsForModel.stream().anyMatch(discriminator -> var.baseName.equals(discriminator) || var.name.equals(discriminator))) {
|
||||
if (discriminatorsForModel.stream().anyMatch(discriminator -> var.baseName.equals(discriminator.getPropertyBaseName()) || var.name.equals(discriminator.getPropertyName()))) {
|
||||
if (var.isString) {
|
||||
var.isDiscriminator = true;
|
||||
++countString;
|
||||
@@ -773,7 +789,7 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
}
|
||||
}
|
||||
|
||||
private static void processPolymorphismDataType(final List<CodegenProperty> cp) {
|
||||
private static void processPolymorphismDataType(final List<CodegenProperty> cp, CodegenDiscriminator discriminator) {
|
||||
final HashSet<String> dedupDataTypeWithEnum = new HashSet<>();
|
||||
final HashMap<String, Integer> dedupDataType = new HashMap<>();
|
||||
|
||||
@@ -783,6 +799,7 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
// Mainly needed for primitive types.
|
||||
model.datatypeWithEnum = camelize(model.dataType.replaceAll("(?:\\w+::)+(\\w+)", "$1")
|
||||
.replace("<", "Of").replace(">", "")).replace(" ", "").replace(",", "");
|
||||
model.discriminatorValue = getDiscriminatorValue(model.datatypeWithEnum, discriminator);
|
||||
if (!dedupDataTypeWithEnum.add(model.datatypeWithEnum)) {
|
||||
model.datatypeWithEnum += ++idx;
|
||||
}
|
||||
|
||||
@@ -1408,6 +1408,7 @@ public class RustServerCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
*
|
||||
* @deprecated Avoid using this - use a different mechanism instead.
|
||||
*/
|
||||
@Deprecated
|
||||
private static String stripNullable(String type) {
|
||||
if (type.startsWith("swagger::Nullable<") && type.endsWith(">")) {
|
||||
return type.substring("swagger::Nullable<".length(), type.length() - 1);
|
||||
|
||||
@@ -1408,6 +1408,7 @@ public class RustServerCodegenDeprecated extends AbstractRustCodegen implements
|
||||
*
|
||||
* @deprecated Avoid using this - use a different mechanism instead.
|
||||
*/
|
||||
@Deprecated
|
||||
private static String stripNullable(String type) {
|
||||
if (type.startsWith("swagger::Nullable<") && type.endsWith(">")) {
|
||||
return type.substring("swagger::Nullable<".length(), type.length() - 1);
|
||||
|
||||
@@ -568,12 +568,8 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiUtil.java"));
|
||||
}
|
||||
|
||||
if (!delegatePattern || delegateMethod) {
|
||||
additionalProperties.put("jdk8-no-delegate", true);
|
||||
}
|
||||
|
||||
if (delegatePattern && !delegateMethod) {
|
||||
additionalProperties.put("isDelegate", "true");
|
||||
additionalProperties.put("isDelegate", true);
|
||||
apiTemplateFiles.put("apiDelegate.mustache", "Delegate.java");
|
||||
}
|
||||
|
||||
@@ -1217,6 +1213,9 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
extensions.add(VendorExtension.X_SPRING_PAGINATED);
|
||||
extensions.add(VendorExtension.X_VERSION_PARAM);
|
||||
extensions.add(VendorExtension.X_PATTERN_MESSAGE);
|
||||
extensions.add(VendorExtension.X_SIZE_MESSAGE);
|
||||
extensions.add(VendorExtension.X_MINIMUM_MESSAGE);
|
||||
extensions.add(VendorExtension.X_MAXIMUM_MESSAGE);
|
||||
extensions.add(VendorExtension.X_SPRING_API_VERSION);
|
||||
return extensions;
|
||||
}
|
||||
|
||||
@@ -461,6 +461,9 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
||||
}
|
||||
}
|
||||
|
||||
// backup path in extensions
|
||||
op.vendorExtensions.put("x-path-from-spec", op.path);
|
||||
|
||||
// Overwrite path to TypeScript template string, after applying everything we just did.
|
||||
op.path = pathBuffer.toString();
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
public static final String USE_SQUARE_BRACKETS_IN_ARRAY_NAMES = "useSquareBracketsInArrayNames";
|
||||
public static final String AXIOS_VERSION = "axiosVersion";
|
||||
public static final String DEFAULT_AXIOS_VERSION = "^1.6.1";
|
||||
public static final String WITH_AWSV4_SIGNATURE = "withAWSV4Signature";
|
||||
|
||||
@Getter @Setter
|
||||
protected String npmRepository = null;
|
||||
@@ -60,6 +61,7 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
|
||||
@Getter @Setter
|
||||
protected String axiosVersion = DEFAULT_AXIOS_VERSION;
|
||||
protected boolean withAWSV4Signature = false;
|
||||
|
||||
private String tsModelPackage = "";
|
||||
|
||||
@@ -71,7 +73,7 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
|
||||
modifyFeatureSet(features -> features
|
||||
.includeDocumentationFeatures(DocumentationFeature.Readme)
|
||||
.includeSecurityFeatures(SecurityFeature.BearerToken));
|
||||
.includeSecurityFeatures(SecurityFeature.BearerToken, SecurityFeature.AWSV4Signature));
|
||||
|
||||
// clear import mapping (from default generator) as TS does not use it
|
||||
// at the moment
|
||||
@@ -94,6 +96,7 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
this.cliOptions.add(new CliOption(IMPORT_FILE_EXTENSION_SWITCH, IMPORT_FILE_EXTENSION_SWITCH_DESC, SchemaTypeUtil.STRING_TYPE).defaultValue(this.importFileExtension));
|
||||
this.cliOptions.add(new CliOption(USE_SQUARE_BRACKETS_IN_ARRAY_NAMES, "Setting this property to true will add brackets to array attribute names, e.g. my_values[].", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
this.cliOptions.add(new CliOption(AXIOS_VERSION, "Use this property to override the axios version in package.json").defaultValue(DEFAULT_AXIOS_VERSION));
|
||||
this.cliOptions.add(new CliOption(WITH_AWSV4_SIGNATURE, "whether to include AWS v4 signature support", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||
// Templates have no mapping between formatted property names and original base names so use only "original" and remove this option
|
||||
removeOption(CodegenConstants.MODEL_PROPERTY_NAMING);
|
||||
}
|
||||
@@ -182,6 +185,10 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
setAxiosVersion(additionalProperties.get(AXIOS_VERSION).toString());
|
||||
}
|
||||
additionalProperties.put("axiosVersion", getAxiosVersion());
|
||||
if (additionalProperties.containsKey(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT)) {
|
||||
this.setWithAWSV4Signature(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT).toString()));
|
||||
}
|
||||
additionalProperties.put(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT, withAWSV4Signature);
|
||||
|
||||
}
|
||||
|
||||
@@ -307,6 +314,10 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
public void setWithAWSV4Signature(boolean withAWSV4Signature) {
|
||||
this.withAWSV4Signature = withAWSV4Signature;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriding toRegularExpression() to avoid escapeText() being called,
|
||||
* as it would return a broken regular expression if any escaped character / metacharacter were present.
|
||||
|
||||
@@ -117,7 +117,7 @@ ext {
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
{{#useBeanValidation}}
|
||||
|
||||
@@ -117,7 +117,7 @@ ext {
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
httpclient_version = "5.1.3"
|
||||
|
||||
@@ -354,7 +354,7 @@
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
|
||||
@@ -107,7 +107,7 @@ ext {
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{/jackson}}
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
feign_version = "13.5"
|
||||
|
||||
@@ -63,7 +63,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
|
||||
{{/gson}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{#isContainer}}
|
||||
|
||||
@@ -416,7 +416,7 @@
|
||||
<gson-version>2.10.1</gson-version>
|
||||
{{/gson}}
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
|
||||
@@ -101,7 +101,7 @@ ext {
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
google_api_client_version = "1.32.2"
|
||||
|
||||
@@ -313,7 +313,7 @@
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#joda}}
|
||||
<jodatime-version>2.9.9</jodatime-version>
|
||||
|
||||
@@ -107,7 +107,7 @@ ext {
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
{{#useBeanValidation}}
|
||||
|
||||
@@ -24,7 +24,7 @@ lazy val root = (project in file(".")).
|
||||
{{/joda}}
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.19.2" % "compile",
|
||||
{{#openApiNullable}}
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.7" % "compile",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.8" % "compile",
|
||||
{{/openApiNullable}}
|
||||
{{#hasOAuthMethods}}
|
||||
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",
|
||||
|
||||
@@ -63,7 +63,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
|
||||
{{/gson}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{#isContainer}}
|
||||
|
||||
@@ -407,7 +407,7 @@
|
||||
<jersey-version>2.37</jersey-version>
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
<beanvalidation-version>3.0.2</beanvalidation-version>
|
||||
|
||||
@@ -102,7 +102,7 @@ ext {
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "2.1.0"
|
||||
{{#useBeanValidation}}
|
||||
|
||||
@@ -24,7 +24,7 @@ lazy val root = (project in file(".")).
|
||||
{{/joda}}
|
||||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.19.2" % "compile",
|
||||
{{#openApiNullable}}
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.7" % "compile",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.8" % "compile",
|
||||
{{/openApiNullable}}
|
||||
{{#hasOAuthMethods}}
|
||||
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",
|
||||
|
||||
@@ -63,7 +63,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
|
||||
{{/gson}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{#isContainer}}
|
||||
|
||||
@@ -407,7 +407,7 @@
|
||||
<jersey-version>3.1.1</jersey-version>
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
<beanvalidation-version>3.0.2</beanvalidation-version>
|
||||
|
||||
@@ -49,7 +49,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
|
||||
{{#jsonb}}{{^isDiscriminator}}@JsonbProperty("{{baseName}}"){{/isDiscriminator}}{{#isDiscriminator}}{{#jsonbPolymorphism}}@JsonbTransient{{/jsonbPolymorphism}}{{^jsonbPolymorphism}}@JsonbProperty("{{baseName}}"){{/jsonbPolymorphism}}{{/isDiscriminator}}{{/jsonb}}
|
||||
{{/withXml}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{#isContainer}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
<swagger.core.version>1.5.18</swagger.core.version>
|
||||
<jetty.version>9.2.9.v20150224</jetty.version>
|
||||
<junit.version>5.10.2</junit.version>
|
||||
<logback.version>1.5.13</logback.version>
|
||||
<logback.version>1.5.19</logback.version>
|
||||
{{#useBeanValidation}}
|
||||
<beanvalidation.version>3.0.2</beanvalidation.version>
|
||||
{{/useBeanValidation}}
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
<swagger.core.version>1.5.18</swagger.core.version>
|
||||
<jetty.version>9.2.9.v20150224</jetty.version>
|
||||
<junit.version>5.10.2</junit.version>
|
||||
<logback.version>1.5.13</logback.version>
|
||||
<logback.version>1.5.19</logback.version>
|
||||
{{#useBeanValidation}}
|
||||
<beanvalidation.version>3.0.1</beanvalidation.version>
|
||||
{{/useBeanValidation}}
|
||||
|
||||
@@ -102,7 +102,7 @@ dependencies {
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||
implementation "org.openapitools:jackson-databind-nullable:0.2.7"
|
||||
implementation "org.openapitools:jackson-databind-nullable:0.2.8"
|
||||
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
{{#useBeanValidation}}
|
||||
implementation "jakarta.validation:jakarta.validation-api:$beanvalidation_version"
|
||||
|
||||
@@ -66,7 +66,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
|
||||
{{/gson}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{#isContainer}}
|
||||
|
||||
@@ -300,7 +300,7 @@
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
<beanvalidation-version>3.0.2</beanvalidation-version>
|
||||
|
||||
@@ -132,7 +132,7 @@ dependencies {
|
||||
implementation 'io.gsonfire:gson-fire:1.9.0'
|
||||
implementation 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6'
|
||||
{{#openApiNullable}}
|
||||
implementation 'org.openapitools:jackson-databind-nullable:0.2.7'
|
||||
implementation 'org.openapitools:jackson-databind-nullable:0.2.8'
|
||||
{{/openApiNullable}}
|
||||
{{#withAWSV4Signature}}
|
||||
implementation 'software.amazon.awssdk:auth:2.20.157'
|
||||
|
||||
@@ -16,7 +16,7 @@ lazy val root = (project in file(".")).
|
||||
"org.apache.commons" % "commons-lang3" % "3.18.0",
|
||||
"jakarta.ws.rs" % "jakarta.ws.rs-api" % "2.1.6",
|
||||
{{#openApiNullable}}
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.7",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.8",
|
||||
{{/openApiNullable}}
|
||||
{{#withAWSV4Signature}}
|
||||
"software.amazon.awssdk" % "auth" % "2.20.157",
|
||||
|
||||
@@ -71,7 +71,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{/deprecated}}
|
||||
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||
{{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
|
||||
@@ -416,7 +416,7 @@
|
||||
<gson-version>2.10.1</gson-version>
|
||||
<commons-lang3-version>3.18.0</commons-lang3-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#joda}}
|
||||
<jodatime-version>2.12.0</jodatime-version>
|
||||
|
||||
@@ -109,7 +109,7 @@ ext {
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
{{/jackson}}
|
||||
{{#gson}}
|
||||
|
||||
@@ -18,7 +18,7 @@ lazy val root = (project in file(".")).
|
||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.19.2",
|
||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.19.2",
|
||||
{{#openApiNullable}}
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.7",
|
||||
"org.openapitools" % "jackson-databind-nullable" % "0.2.8",
|
||||
{{/openApiNullable}}
|
||||
{{#withXml}}
|
||||
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.13.4.1",
|
||||
|
||||
@@ -354,7 +354,7 @@
|
||||
{{#jackson}}
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{/jackson}}
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
|
||||
@@ -106,7 +106,7 @@ ext {
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
spring_web_version = "6.1.21"
|
||||
jakarta_annotation_version = "2.1.1"
|
||||
|
||||
@@ -74,7 +74,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
|
||||
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||
{{/isDiscriminator}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{#isContainer}}
|
||||
|
||||
@@ -350,7 +350,7 @@
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
{{#joda}}
|
||||
|
||||
@@ -101,7 +101,7 @@ ext {
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
threetenbp_version = "2.9.10"
|
||||
|
||||
@@ -301,7 +301,7 @@
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
|
||||
@@ -118,7 +118,7 @@ ext {
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
{{#useJakartaEe}}
|
||||
spring_web_version = "6.2.8"
|
||||
|
||||
@@ -74,7 +74,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||
{{/isDiscriminator}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{#isContainer}}
|
||||
|
||||
@@ -364,7 +364,7 @@
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#useJakartaEe}}
|
||||
<spring-web-version>6.2.8</spring-web-version>
|
||||
|
||||
@@ -104,7 +104,7 @@ ext {
|
||||
jackson_databind_version = "2.19.2"
|
||||
javax_ws_rs_api_version = "2.1.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
{{/jackson}}
|
||||
{{#usePlayWS}}
|
||||
|
||||
@@ -386,7 +386,7 @@
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
<javax.ws.rs-api-version>2.1.1</javax.ws.rs-api-version>
|
||||
{{/jackson}}
|
||||
|
||||
@@ -35,7 +35,7 @@ ext {
|
||||
vertx_version = "{{#supportVertxFuture}}4.0.0{{/supportVertxFuture}}{{^supportVertxFuture}}3.5.2{{/supportVertxFuture}}"
|
||||
junit_version = "5.10.3"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind>2.19.2</jackson-databind>
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
{{/useJakartaEe}}
|
||||
|
||||
@@ -147,7 +147,7 @@ ext {
|
||||
jackson_version = "2.19.2"
|
||||
jackson_databind_version = "2.19.2"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.7"
|
||||
jackson_databind_nullable_version = "0.2.8"
|
||||
{{/openApiNullable}}
|
||||
{{#joda}}
|
||||
jodatime_version = "2.9.9"
|
||||
|
||||
@@ -74,7 +74,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
|
||||
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||
{{/isDiscriminator}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{#isContainer}}
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
<jackson-version>2.19.2</jackson-version>
|
||||
<jackson-databind-version>2.19.2</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#useJakartaEe}}
|
||||
<spring-boot-version>3.2.12</spring-boot-version>
|
||||
|
||||
@@ -74,7 +74,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||
{{/isDiscriminator}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{#isContainer}}
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<swagger-inflector-version>1.0.14</swagger-inflector-version>
|
||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||
<logback-version>1.5.13</logback-version>
|
||||
<logback-version>1.5.19</logback-version>
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
{{/useJakartaEe}}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
|
||||
|
||||
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
{{/vars}}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'hh:mm:ss.SSSX")
|
||||
{{/isDateTime}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
{{/vars}}
|
||||
|
||||
@@ -220,7 +220,7 @@ for this project used jakarta.validation-api -->
|
||||
<swagger-core-version>1.5.22</swagger-core-version>
|
||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||
<junit-version>4.13.2</junit-version>
|
||||
<logback-version>1.5.13</logback-version>
|
||||
<logback-version>1.5.19</logback-version>
|
||||
{{#useBeanValidation}}
|
||||
<beanvalidation-version>2.0.2</beanvalidation-version>
|
||||
{{/useBeanValidation}}
|
||||
|
||||
@@ -342,7 +342,7 @@ for this project used jakarta.validation-api -->
|
||||
{{/generateSpringApplication}}
|
||||
{{^generateSpringBootApplication}}
|
||||
<junit-version>4.13.2</junit-version>
|
||||
<logback-version>1.5.13</logback-version>
|
||||
<logback-version>1.5.19</logback-version>
|
||||
{{/generateSpringBootApplication}}
|
||||
<cxf-version>3.5.9</cxf-version>
|
||||
<jackson-jaxrs-version>2.17.1</jackson-jaxrs-version>
|
||||
|
||||
@@ -56,7 +56,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
|
||||
@Valid
|
||||
{{/useBeanValidation}}{{/isFile}}{{/isString}}{{/isDateTime}}{{/isDate}}{{/isPrimitiveType}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
{{#vendorExtensions.x-is-jackson-optional-nullable}}
|
||||
{{#isContainer}}
|
||||
|
||||
@@ -255,7 +255,7 @@ for this project used jakarta.validation-api -->
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||
<junit-version>4.13.2</junit-version>
|
||||
<logback-version>1.5.13</logback-version>
|
||||
<logback-version>1.5.19</logback-version>
|
||||
{{#useBeanValidation}}
|
||||
<beanvalidation-version>2.0.2</beanvalidation-version>
|
||||
{{/useBeanValidation}}
|
||||
|
||||
@@ -311,7 +311,7 @@ for this project used jakarta.validation-api -->
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||
<junit-version>4.13.2</junit-version>
|
||||
<logback-version>1.5.13</logback-version>
|
||||
<logback-version>1.5.19</logback-version>
|
||||
{{#useBeanValidation}}
|
||||
<beanvalidation-version>2.0.2</beanvalidation-version>
|
||||
{{/useBeanValidation}}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
|
||||
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
|
||||
{{/gson}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
<jersey3-version>3.1.3</jersey3-version>
|
||||
<jackson-version>2.17.1</jackson-version>
|
||||
<junit-version>4.13.2</junit-version>
|
||||
<logback-version>1.5.13</logback-version>
|
||||
<logback-version>1.5.19</logback-version>
|
||||
<servlet-api-version>5.0.0</servlet-api-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
@@ -36,7 +36,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
|
||||
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
|
||||
{{/gson}}
|
||||
{{#vendorExtensions.x-field-extra-annotation}}
|
||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-field-extra-annotation}}
|
||||
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user