Compare commits

...

32 Commits

Author SHA1 Message Date
William Cheng
b8d8f3c7a0 update jackson databind nullable to v0.2.8 2025-10-26 23:56:00 +08:00
Kevin Liddle
91a499b8c6 [rust-axum] Fix polymorphic type discriminators (#22222)
* [rust-axum] Make discriminator field name camelCase

* [rust-axum] Give polymorphic enum values a serde alias using the mapping keys if available

* update samples

* update test file checksum
2025-10-25 22:43:56 +08:00
dependabot[bot]
eda2e67b94 Bump actions/download-artifact from 5 to 6 (#22225)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-25 17:31:18 +08:00
Rens Groothuijsen
8643bc1d66 [python-fastapi] Remove additional slashes in query regex (#22223) 2025-10-25 17:16:17 +08:00
dependabot[bot]
2b22d172da Bump actions/upload-artifact from 4 to 5 (#22224)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-25 17:14:59 +08:00
William Cheng
d605afeef5 update vertx-web to 4.x 2025-10-23 10:32:20 +08:00
William Cheng
6eff628139 update logback to newer versions (#22204) 2025-10-22 18:51:38 +08:00
William Cheng
1d071288f8 use path from spec in ts angular documentation (#22194) 2025-10-21 15:40:48 +08:00
dependabot[bot]
816befc466 Bump vite and @angular-devkit/build-angular (#22192)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) to 6.4.1 and updates ancestor dependency [@angular-devkit/build-angular](https://github.com/angular/angular-cli). These dependencies need to be updated together.


Updates `vite` from 6.3.6 to 6.4.1
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/create-vite@6.4.1/packages/vite)

Updates `@angular-devkit/build-angular` from 19.2.17 to 19.2.17
- [Release notes](https://github.com/angular/angular-cli/releases)
- [Changelog](https://github.com/angular/angular-cli/blob/main/CHANGELOG.md)
- [Commits](https://github.com/angular/angular-cli/compare/19.2.17...19.2.17)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.4.1
  dependency-type: indirect
- dependency-name: "@angular-devkit/build-angular"
  dependency-version: 19.2.17
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-21 15:08:27 +08:00
William Cheng
3d00fd2adc update C# samples 2025-10-21 11:40:43 +08:00
Fabian Buchenberger
00d16496c8 [csharp] do not use deprecated HttpRequestMessage.Properties (#20737) 2025-10-21 10:58:47 +08:00
William Cheng
57752d190c add cache: gradle to java setup workflow (#22183) 2025-10-20 17:15:36 +08:00
William Cheng
6572d5d9a6 Use JDK11 for kotlin-server projects (#22182)
* use jdk11 for kotlin server projects

* test with jdk11 by default
2025-10-20 16:54:50 +08:00
William Cheng
c15ba67fc9 update kotlin-spring projects to use jdk11 (#22181) 2025-10-20 15:48:10 +08:00
William Cheng
63ddce0c1b default REFACTOR_ALLOF_WITH_PROPERTIES_ONLY to true (#22180) 2025-10-20 11:39:09 +08:00
Kevin Liddle
01139e6963 [rust-axum] don't include quotes in output string from Display trait for string types (#22161)
* [rust-axum] don't include quotes in output string from Display trait for string types

* [rust-axum] update samples
2025-10-20 10:35:18 +08:00
Sven Allers
e7dae1a81e Custom error messages for size, length, min & max validations in Spring & Spring-Kotlin (#22090)
* Custom error messages for size, length, min & max validations in Spring & Spring-Kotlin

* Run scripts
2025-10-19 21:25:03 +08:00
Ilia
4e7bba659b [dart] Fix compile error in inline enum properties with "default" values(#22120) (#22165) 2025-10-19 20:47:20 +08:00
jpfinne
88bba259e9 OpenApiNormalizer FILTER improvements. Multi filters + filter on path (#22128)
* Use Filter Parser and allow multiple filters

* OpenAPINormalizer fails for invalid FILTER syntax

* Fix typo

* Use constants for filter keys.
Improve exception handling and tests.

* Fix format missing Locale.ROOT

* Make Filter extensible

* Additional unit test for invalid filter
2025-10-18 22:39:44 +08:00
William Cheng
8c85e3cedc [typescript-axios] Add support for AWSv4 Signature (#22174)
* [typescript-axios] Add support for AWSv4 Signature

* update typescript-axios.md file

* update doc

---------

Co-authored-by: qasim <qasim@calo.app>
2025-10-18 16:52:24 +08:00
Jérémy Reynard
d840c495c4 [FEAT] Support nullable Array<org.springframework.web.multipart.MultipartFile> in Kotlin-Spring generator (#21994)
* Support nullable `org.springframework.web.multipart.MultipartFile` in Kotlin Spring generator

- nullable is only supported for MultipartFile. However, Array<MultipartFile> could be also nullable

* Support nullable `org.springframework.web.multipart.MultipartFile` in Kotlin Spring generator

* Support nullable `org.springframework.web.multipart.MultipartFile` in Kotlin Spring generator

Update kotlin-spring-additionalproperties samples
2025-10-18 16:44:19 +08:00
Martin Tomašovič
7c000687e4 [csharp][generichost] Fix DateOnly parsing (#22099)
* Fix DateOnly parsing

* update samples
2025-10-18 14:58:36 +08:00
Mattias Sehlstedt
23a2aafe91 [CSHARP] Fix how the array type is set when using NULLABLE_REFERENCE_TYPES (#22071)
* Fix how the type is calculated for deep inline arrays

* Add list alias objects to petstore specification and regenerate samples
2025-10-18 14:58:08 +08:00
daberni
2afe7d29cd [Spring] Remove unnecessary modifiers from API interface templates (#22132)
* public static final String PATH_

* regenerate samples
2025-10-18 14:56:59 +08:00
William Cheng
6ede03d546 remove includeEndpointUrl (#22173) 2025-10-18 14:52:51 +08:00
Rostislav Svoboda
ee85775afd chore: Misc cleanup related to deprecations (#22172)
* Replace deprecated StringUtils.startsWith methods

* Add missing @Deprecated annotations
2025-10-18 14:52:19 +08:00
Robin Csutorás
94e8997cc7 [typescript-angular] Add includeEndpointUrl option to include endpoint URLs in generated service comments (#22152)
Adds a new boolean option 'includeEndpointUrl' that, when enabled, includes endpoint URL information as JSDoc comments in generated service methods and interfaces. This helps developers quickly identify the HTTP method and path for each API operation.

Co-authored-by: Robin Csutoras <robin.csutoras@Robins-Laptop.local>
2025-10-18 14:35:58 +08:00
jheyens
552ab4c6d5 Java-wiremock: Correctly handle multiple MIME-types in HTTP-Accept-headers (#22133)
* Java-wiremock: Allow matching multiple Accept-header values

* Wiremock: Ignore casing when matching requests' Content-Type headers

* Java-wiremock: Regenerate samples
2025-10-18 14:27:03 +08:00
daberni
2b00bab60a [Spring] Optimize and omit unnecessary imports on Api in ApiController templates (#22164)
* Optimize imports

* remove unnecessary blank line

* revert unintended indentation
2025-10-18 14:19:35 +08:00
Zach Hornback
ccd43a5ce4 [python-fastapi] Fix: Skip sorting of path operations (#22163) (#22166)
* [python-fastapi] Fix: Skip sorting of path operations (#22163)

Make use of helpful code added in
243f501aef to skip sorting of path
parameters.  In FastAPI, order matters, see link for details:
https://fastapi.tiangolo.com/tutorial/path-params/?h=path#order-matters

Issue: https://github.com/OpenAPITools/openapi-generator/issues/22163

* Update samples after previous commit

Reading comprehension is hard.  I missed the part of step 3 where
samples would be updated in response to the change I had previous
submitted.

Via this commit, update samples to match expectations.  The order of
various endpoint implementations is now changed in the sample, matchcing
the order in the yaml files that created them.
2025-10-18 14:18:15 +08:00
Rens Groothuijsen
592c262277 Set default value for isOauth field (#22162) 2025-10-17 15:49:26 +08:00
Bradford Hovinen
40b9d69d5a Support deprecated API endpoints in reqwest-based Rust clients (#22131)
Previously, if an API endpoint was marked deprecated, this fact was not
reflected in the generated Rust clients using the reqwest library. We
want to know exactly when our client code is using a deprecated endpoint,
so marking the corresponding functions with the `#[deprecatd]` attribute
would be very helpful. Uses of the endpoint would then be picked up by
linters so that we can react.

This adds a line to the template which marks functions generated from
deprecated endpoints with the `#[deprecated]` attribute.

This does not touch any of the other client generators for Rust or any
other language, since they are out of scope for our needs.

Co-authored-by: Bradford Hovinen <bho@qwello.eu>
2025-10-16 19:41:28 +08:00
1037 changed files with 9201 additions and 5809 deletions

View File

@@ -19,6 +19,7 @@ jobs:
with:
java-version: 11
distribution: 'temurin'
cache: gradle
- name: Cache maven dependencies
uses: actions/cache@v4
env:

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -26,6 +26,7 @@ jobs:
with:
distribution: 'temurin'
java-version: 8
cache: gradle
- name: Cache maven dependencies
uses: actions/cache@v4
env:

View File

@@ -118,6 +118,7 @@ jobs:
with:
distribution: 'temurin'
java-version: 11
cache: gradle
- name: Cache maven dependencies
uses: actions/cache@v4
env:

View File

@@ -42,6 +42,7 @@ jobs:
with:
distribution: 'temurin'
java-version: 17
cache: gradle
- name: Cache maven dependencies
uses: actions/cache@v4
env:

View File

@@ -77,6 +77,7 @@ jobs:
with:
distribution: 'temurin'
java-version: 11
cache: gradle
- name: Cache maven dependencies
uses: actions/cache@v4
env:

View File

@@ -26,6 +26,7 @@ jobs:
with:
distribution: 'temurin'
java-version: 17
cache: gradle
- name: Cache maven dependencies
uses: actions/cache@v4
env:

View File

@@ -52,6 +52,7 @@ jobs:
with:
distribution: 'temurin'
java-version: 17
cache: gradle
- name: Cache maven dependencies
uses: actions/cache@v4
env:

View File

@@ -32,6 +32,7 @@ jobs:
with:
distribution: 'temurin'
java-version: 21
cache: gradle
- name: Cache maven dependencies
uses: actions/cache@v4
env:

View File

@@ -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:

View File

@@ -24,6 +24,7 @@ jobs:
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: gradle
- name: Cache maven dependencies
uses: actions/cache@v4
env:

View File

@@ -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

View File

@@ -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)
@@ -645,7 +646,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
- `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 +659,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 +669,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.

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 |

View File

@@ -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())) {

View File

@@ -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();

View File

@@ -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<>();
@@ -133,10 +133,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";
@@ -215,6 +211,7 @@ public class OpenAPINormalizer {
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 +272,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 +318,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 +392,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 +417,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());
@@ -1363,7 +1334,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 +1803,164 @@ 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);
}
}
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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 ";

View File

@@ -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;

View File

@@ -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 ";

View File

@@ -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 ";

View File

@@ -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 ";

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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();
}

View File

@@ -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.

View File

@@ -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}}

View File

@@ -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"

View File

@@ -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>

View File

@@ -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"

View File

@@ -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>

View File

@@ -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"

View File

@@ -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>

View File

@@ -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}}

View File

@@ -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",

View File

@@ -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>

View File

@@ -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}}

View File

@@ -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",

View File

@@ -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>

View File

@@ -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}}

View File

@@ -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}}

View File

@@ -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"

View File

@@ -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>

View File

@@ -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'

View File

@@ -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",

View File

@@ -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>

View File

@@ -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}}

View File

@@ -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",

View File

@@ -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>

View File

@@ -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"

View File

@@ -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}}

View File

@@ -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"

View File

@@ -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>

View File

@@ -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"

View File

@@ -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>

View File

@@ -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}}

View File

@@ -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}}

View File

@@ -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"
}

View File

@@ -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}}

View File

@@ -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"

View File

@@ -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>

View File

@@ -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}}

View File

@@ -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}}

View File

@@ -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>

View File

@@ -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}}

View File

@@ -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}}

View File

@@ -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>

View File

@@ -222,7 +222,7 @@ for this project used jakarta.validation-api -->
<jersey2-version>2.35</jersey2-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>4.0.4</servlet-api-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

View File

@@ -200,7 +200,7 @@
<jakarta.ws.rs-version>2.1.6</jakarta.ws.rs-version>
{{/useJakartaEe}}
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.8</jackson-databind-nullable-version>
{{/openApiNullable}}
</properties>
</project>

View File

@@ -24,14 +24,16 @@ import io.swagger.v3.oas.annotations.media.ExampleObject;
{{#swagger1AnnotationLibrary}}
import io.swagger.annotations.*;
{{/swagger1AnnotationLibrary}}
{{#jdk8-no-delegate}}
{{^isDelegate}}
{{#jdk8-default-interface}}
{{#virtualService}}
import io.virtualan.annotation.ApiVirtual;
import io.virtualan.annotation.VirtualService;
{{/virtualService}}
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
{{/jdk8-no-delegate}}
{{/jdk8-default-interface}}
{{/isDelegate}}
{{^useResponseEntity}}
import org.springframework.http.HttpStatus;
{{/useResponseEntity}}
@@ -48,11 +50,13 @@ import org.springframework.web.bind.annotation.RestController;
{{/useResponseEntity}}
{{/useSpringController}}
import org.springframework.web.bind.annotation.*;
{{#jdk8-no-delegate}}
{{^reactive}}
{{#jdk8-default-interface}}
{{^isDelegate}}
{{^reactive}}
import org.springframework.web.context.request.NativeWebRequest;
{{/reactive}}
{{/jdk8-no-delegate}}
{{/reactive}}
{{/isDelegate}}
{{/jdk8-default-interface}}
import org.springframework.web.multipart.MultipartFile;
{{#reactive}}
import org.springframework.web.server.ServerWebExchange;
@@ -67,14 +71,14 @@ import {{javaxPackage}}.validation.constraints.*;
{{/useBeanValidation}}
import java.util.List;
import java.util.Map;
{{#jdk8-no-delegate}}
{{^isDelegate}}
import java.util.Optional;
{{/jdk8-no-delegate}}
{{^jdk8-no-delegate}}
{{/isDelegate}}
{{#isDelegate}}
{{#useOptional}}
import java.util.Optional;
{{/useOptional}}
{{/jdk8-no-delegate}}
{{/isDelegate}}
{{#async}}
import java.util.concurrent.CompletableFuture;
{{/async}}
@@ -128,7 +132,7 @@ public interface {{classname}} {
{{/jdk8-default-interface}}
{{#operation}}
public static final String PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}} = "{{{path}}}";
String PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}} = "{{{path}}}";
/**
* {{httpMethod}} {{{path}}}{{#summary}} : {{.}}{{/summary}}
{{#notes}}
@@ -261,7 +265,9 @@ public interface {{classname}} {
{{#vendorExtensions.x-operation-extra-annotation}}
{{{.}}}
{{/vendorExtensions.x-operation-extra-annotation}}
{{#vendorExtensions.x-sse}}@ResponseBody{{/vendorExtensions.x-sse}}
{{#vendorExtensions.x-sse}}
@ResponseBody
{{/vendorExtensions.x-sse}}
{{#jdk8-default-interface}}default {{/jdk8-default-interface}}{{>responseType}} {{#delegate-method}}_{{/delegate-method}}{{operationId}}(
{{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{>cookieParams}}{{^-last}},
{{/-last}}{{/allParams}}{{#reactive}}{{#hasParams}},

View File

@@ -1,24 +1,24 @@
{{^isUuid}}{{#pattern}}{{^isByteArray}}@Pattern(regexp = "{{{pattern}}}"{{#vendorExtensions.x-pattern-message}}, message="{{vendorExtensions.x-pattern-message}}"{{/vendorExtensions.x-pattern-message}}) {{/isByteArray}}{{/pattern}}{{!
{{^isUuid}}{{#pattern}}{{^isByteArray}}@Pattern(regexp = "{{{pattern}}}"{{#vendorExtensions.x-pattern-message}}, message = "{{vendorExtensions.x-pattern-message}}"{{/vendorExtensions.x-pattern-message}}) {{/isByteArray}}{{/pattern}}{{!
minLength && maxLength set
}}{{#minLength}}{{#maxLength}}@Size(min = {{minLength}}, max = {{maxLength}}) {{/maxLength}}{{/minLength}}{{!
}}{{#minLength}}{{#maxLength}}@Size(min = {{minLength}}, max = {{maxLength}}{{#vendorExtensions.x-size-message}}, message = "{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxLength}}{{/minLength}}{{!
minLength set, maxLength not
}}{{#minLength}}{{^maxLength}}@Size(min = {{minLength}}) {{/maxLength}}{{/minLength}}{{!
}}{{#minLength}}{{^maxLength}}@Size(min = {{minLength}}{{#vendorExtensions.x-size-message}}, message = "{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxLength}}{{/minLength}}{{!
minLength not set, maxLength set
}}{{^minLength}}{{#maxLength}}@Size(max = {{.}}) {{/maxLength}}{{/minLength}}{{!
}}{{^minLength}}{{#maxLength}}@Size(max = {{.}}{{#vendorExtensions.x-size-message}}, message = "{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxLength}}{{/minLength}}{{!
@Size: minItems && maxItems set
}}{{#minItems}}{{#maxItems}}@Size(min = {{minItems}}, max = {{maxItems}}) {{/maxItems}}{{/minItems}}{{!
}}{{#minItems}}{{#maxItems}}@Size(min = {{minItems}}, max = {{maxItems}}{{#vendorExtensions.x-size-message}}, message = "{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxItems}}{{/minItems}}{{!
@Size: minItems set, maxItems not
}}{{#minItems}}{{^maxItems}}@Size(min = {{minItems}}) {{/maxItems}}{{/minItems}}{{!
}}{{#minItems}}{{^maxItems}}@Size(min = {{minItems}}{{#vendorExtensions.x-size-message}}, message = "{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxItems}}{{/minItems}}{{!
@Size: minItems not set && maxItems set
}}{{^minItems}}{{#maxItems}}@Size(max = {{.}}) {{/maxItems}}{{/minItems}}{{!
}}{{^minItems}}{{#maxItems}}@Size(max = {{.}}{{#vendorExtensions.x-size-message}}, message = "{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxItems}}{{/minItems}}{{!
@Email: useBeanValidation
}}{{#isEmail}}{{#useBeanValidation}}@{{javaxPackage}}.validation.constraints.Email {{/useBeanValidation}}{{!
@Email: performBeanValidation exclusive
}}{{^useBeanValidation}}{{#performBeanValidation}}@org.hibernate.validator.constraints.Email {{/performBeanValidation}}{{/useBeanValidation}}{{/isEmail}}{{!
check for integer or long / all others=decimal type with @Decimal*
isInteger set
}}{{#isInteger}}{{#minimum}}@Min({{.}}) {{/minimum}}{{#maximum}}@Max({{.}}) {{/maximum}}{{/isInteger}}{{!
}}{{#isInteger}}{{#minimum}}@Min(value = {{.}}{{#vendorExtensions.x-minimum-message}}, message = "{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}) {{/minimum}}{{#maximum}}@Max(value = {{.}}{{#vendorExtensions.x-maximum-message}}, message = "{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}) {{/maximum}}{{/isInteger}}{{!
isLong set
}}{{#isLong}}{{#minimum}}@Min({{.}}L) {{/minimum}}{{#maximum}}@Max({{.}}L) {{/maximum}}{{/isLong}}{{!
}}{{#isLong}}{{#minimum}}@Min(value = {{.}}L{{#vendorExtensions.x-minimum-message}}, message = "{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}) {{/minimum}}{{#maximum}}@Max(value = {{.}}L{{#vendorExtensions.x-maximum-message}}, message = "{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}) {{/maximum}}{{/isLong}}{{!
Not Integer, not Long => we have a decimal value!
}}{{^isInteger}}{{^isLong}}{{#minimum}}@DecimalMin({{#exclusiveMinimum}}value = {{/exclusiveMinimum}}"{{minimum}}"{{#exclusiveMinimum}}, inclusive = false{{/exclusiveMinimum}}) {{/minimum}}{{#maximum}}@DecimalMax({{#exclusiveMaximum}}value = {{/exclusiveMaximum}}"{{maximum}}"{{#exclusiveMaximum}}, inclusive = false{{/exclusiveMaximum}}) {{/maximum}}{{/isLong}}{{/isInteger}}{{/isUuid}}
}}{{^isInteger}}{{^isLong}}{{#minimum}}@DecimalMin(value = "{{minimum}}"{{#exclusiveMinimum}}, inclusive = false{{/exclusiveMinimum}}{{#vendorExtensions.x-minimum-message}}, message = "{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}) {{/minimum}}{{#maximum}}@DecimalMax(value = "{{maximum}}"{{#exclusiveMaximum}}, inclusive = false{{/exclusiveMaximum}}{{#vendorExtensions.x-maximum-message}}, message = "{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}) {{/maximum}}{{/isLong}}{{/isInteger}}{{/isUuid}}

View File

@@ -208,7 +208,7 @@
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.7</version>
<version>0.2.8</version>
</dependency>
{{/openApiNullable}}
{{#useBeanValidation}}

View File

@@ -223,7 +223,7 @@
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.7</version>
<version>0.2.8</version>
</dependency>
{{/openApiNullable}}
{{#useBeanValidation}}

View File

@@ -139,7 +139,7 @@
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
{{^parentOverridden}}
<version>0.2.7</version>
<version>0.2.8</version>
{{/parentOverridden}}
</dependency>
{{/openApiNullable}}

View File

@@ -155,7 +155,7 @@
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
{{^parentOverridden}}
<version>0.2.7</version>
<version>0.2.8</version>
{{/parentOverridden}}
</dependency>
{{/openApiNullable}}

View File

@@ -86,7 +86,7 @@
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.7</version>
<version>0.2.8</version>
</dependency>
{{/openApiNullable}}
{{#lombok}}

View File

@@ -167,6 +167,9 @@ namespace {{packageName}}.Client
/// </remarks>
{{>visibility}} partial class ApiClient : IDisposable, ISynchronousClient{{#supportsAsync}}, IAsynchronousClient{{/supportsAsync}}
{
{{#net60OrLater}}
private static readonly HttpRequestOptionsKey<List<Cookie>> _httpOptionsCookieContainerKey = new("CookieContainer");
{{/net60OrLater}}
private readonly string _baseUrl;
private readonly HttpClientHandler _httpClientHandler;
@@ -382,12 +385,15 @@ namespace {{packageName}}.Client
}
}
// TODO provide an alternative that allows cookies per request instead of per API client
if (options.Cookies != null && options.Cookies.Count > 0)
{
{{#net60OrLater}}
request.Options.Set(_httpOptionsCookieContainerKey, options.Cookies);
{{/net60OrLater}}
{{^net60OrLater}}
request.Properties["CookieContainer"] = options.Cookies;
{{/net60OrLater}}
}
return request;
@@ -474,9 +480,16 @@ namespace {{packageName}}.Client
_httpClientHandler.ClientCertificates.AddRange(configuration.ClientCertificates);
}
{{^net60OrLater}}
var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List<Cookie> : null;
{{/net60OrLater}}
{{#net60OrLater}}
if (req.Options.TryGetValue(_httpOptionsCookieContainerKey, out var cookieContainer))
{{/net60OrLater}}
{{^net60OrLater}}
if (cookieContainer != null)
{{/net60OrLater}}
{
if(_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
foreach (var cookie in cookieContainer)

View File

@@ -34,7 +34,7 @@ namespace {{packageName}}.{{clientPackage}}
string value = reader.GetString(){{nrt!}};
foreach(string format in Formats)
if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result))
if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateOnly result))
return result;
throw new NotSupportedException();

View File

@@ -34,7 +34,7 @@ namespace {{packageName}}.{{clientPackage}}
string value = reader.GetString(){{nrt!}};
foreach(string format in Formats)
if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result))
if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateOnly result))
return result;
throw new NotSupportedException();

View File

@@ -79,7 +79,7 @@ namespace {{packageName}}.Client
public async Task<T> Deserialize<T>(HttpResponseMessage response)
{
var result = (T) await Deserialize(response, typeof(T)).ConfigureAwait(false);
var result = (T)await Deserialize(response, typeof(T)).ConfigureAwait(false);
return result;
}
@@ -95,13 +95,13 @@ namespace {{packageName}}.Client
// process response headers, e.g. Access-Control-Allow-Methods
foreach (var responseHeader in response.Headers)
{
headers.Add(responseHeader.Key + "=" + ClientUtils.ParameterToString(responseHeader.Value));
headers.Add(responseHeader.Key + "=" + ClientUtils.ParameterToString(responseHeader.Value));
}
// process response content headers, e.g. Content-Type
foreach (var responseHeader in response.Content.Headers)
{
headers.Add(responseHeader.Key + "=" + ClientUtils.ParameterToString(responseHeader.Value));
headers.Add(responseHeader.Key + "=" + ClientUtils.ParameterToString(responseHeader.Value));
}
// RFC 2183 & RFC 2616
@@ -112,7 +112,8 @@ namespace {{packageName}}.Client
}
else if (type == typeof(FileParameter))
{
if (headers != null) {
if (headers != null)
{
foreach (var header in headers)
{
var match = fileNameRegex.Match(header.ToString());
@@ -191,6 +192,9 @@ namespace {{packageName}}.Client
/// </remarks>
{{>visibility}} partial class ApiClient : IDisposable, ISynchronousClient{{#supportsAsync}}, IAsynchronousClient{{/supportsAsync}}
{
{{#net60OrLater}}
private static readonly HttpRequestOptionsKey<List<Cookie>> _httpOptionsCookieContainerKey = new("CookieContainer");
{{/net60OrLater}}
private readonly string _baseUrl;
private readonly HttpClientHandler _httpClientHandler;
@@ -283,7 +287,8 @@ namespace {{packageName}}.Client
/// </summary>
public void Dispose()
{
if(_disposeClient) {
if(_disposeClient)
{
_httpClient.Dispose();
}
}
@@ -413,7 +418,12 @@ namespace {{packageName}}.Client
// TODO provide an alternative that allows cookies per request instead of per API client
if (options.Cookies != null && options.Cookies.Count > 0)
{
{{#net60OrLater}}
request.Options.Set(_httpOptionsCookieContainerKey, options.Cookies);
{{/net60OrLater}}
{{^net60OrLater}}
request.Properties["CookieContainer"] = options.Cookies;
{{/net60OrLater}}
}
return request;
@@ -424,7 +434,7 @@ namespace {{packageName}}.Client
private async Task<ApiResponse<T>> ToApiResponse<T>(HttpResponseMessage response, object responseData, Uri uri)
{
T result = (T) responseData;
T result = (T)responseData;
string rawContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
var transformed = new ApiResponse<T>(response.StatusCode, new Multimap<string, string>({{#caseInsensitiveResponseHeaders}}StringComparer.OrdinalIgnoreCase{{/caseInsensitiveResponseHeaders}}), result, rawContent)
@@ -459,7 +469,7 @@ namespace {{packageName}}.Client
transformed.Cookies.Add(cookie);
}
}
catch (PlatformNotSupportedException) {}
catch (PlatformNotSupportedException) { }
}
return transformed;
@@ -496,15 +506,22 @@ namespace {{packageName}}.Client
if (configuration.ClientCertificates != null)
{
if(_httpClientHandler == null) throw new InvalidOperationException("Configuration `ClientCertificates` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
if (_httpClientHandler == null) throw new InvalidOperationException("Configuration `ClientCertificates` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
_httpClientHandler.ClientCertificates.AddRange(configuration.ClientCertificates);
}
{{^net60OrLater}}
var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List<Cookie> : null;
{{/net60OrLater}}
{{#net60OrLater}}
if (req.Options.TryGetValue(_httpOptionsCookieContainerKey, out var cookieContainer))
{{/net60OrLater}}
{{^net60OrLater}}
if (cookieContainer != null)
{{/net60OrLater}}
{
if(_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
if (_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
foreach (var cookie in cookieContainer)
{
_httpClientHandler.CookieContainer.Add(cookie);
@@ -546,11 +563,11 @@ namespace {{packageName}}.Client
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
if (typeof({{{packageName}}}.{{modelPackage}}.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
{
responseData = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
responseData = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
}
else if (typeof(T).Name == "Stream") // for binary response
{
responseData = (T) (object) await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
responseData = (T)(object) await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
}
InterceptResponse(req, response);

View File

@@ -32,7 +32,7 @@
@BuiltValueHook(initializeBuilder: true)
static void _defaults({{{classname}}}Builder b) => b{{#vendorExtensions.x-parent-discriminator}}..{{propertyName}}=b.discriminatorValue{{/vendorExtensions.x-parent-discriminator}}{{#vendorExtensions.x-self-and-ancestor-only-props}}{{#defaultValue}}
..{{{name}}} = {{#isEnum}}{{^isContainer}}{{{defaultValue}}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/defaultValue}}{{/vendorExtensions.x-self-and-ancestor-only-props}};
..{{{name}}} = {{#isEnum}}{{^isContainer}}{{#enumName}}{{enumName}}.valueOf({{{defaultValue}}}){{/enumName}}{{^enumName}}{{{defaultValue}}}{{/enumName}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/defaultValue}}{{/vendorExtensions.x-self-and-ancestor-only-props}};
{{/vendorExtensions.x-is-parent}} @BuiltValueSerializer(custom: true)
static Serializer<{{classname}}> get serializer => _${{classname}}Serializer();

View File

@@ -116,7 +116,7 @@ Do not edit the class manually.
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.7</version>
<version>0.2.8</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>

View File

@@ -18,7 +18,7 @@
<properties>
{{#openApiNullable}}
<version.jackson.databind.nullable>0.2.7</version.jackson.databind.nullable>
<version.jackson.databind.nullable>0.2.8</version.jackson.databind.nullable>
{{/openApiNullable}}
</properties>

View File

@@ -19,7 +19,7 @@
<properties>
{{#openApiNullable}}
<version.jackson.databind.nullable>0.2.7</version.jackson.databind.nullable>
<version.jackson.databind.nullable>0.2.8</version.jackson.databind.nullable>
{{/openApiNullable}}
</properties>

View File

@@ -20,7 +20,7 @@
<properties>
<mainClass>{{{invokerPackage}}}.Main</mainClass>
{{#openApiNullable}}
<version.jackson.databind.nullable>0.2.7</version.jackson.databind.nullable>
<version.jackson.databind.nullable>0.2.8</version.jackson.databind.nullable>
{{/openApiNullable}}
</properties>

View File

@@ -1,6 +1,6 @@
package {{package}};
{{^jdk8-no-delegate}}
{{^isDelegate}}
{{#imports}}import {{import}};
{{/imports}}
@@ -8,9 +8,9 @@ import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
{{/jdk8-no-delegate}}
{{/isDelegate}}
import org.springframework.stereotype.Controller;
{{^jdk8-no-delegate}}
{{^isDelegate}}
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
@@ -26,7 +26,7 @@ import java.util.Optional;
{{#async}}
import java.util.concurrent.Callable;
{{/async}}
{{/jdk8-no-delegate}}
{{/isDelegate}}
{{^useSpringCloudClient}}
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -60,7 +60,7 @@ public class {{classname}}Controller implements {{classname}} {
}
{{/isDelegate}}
{{^jdk8-no-delegate}}
{{^isDelegate}}
{{#operation}}
public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},
{{/allParams}}@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
@@ -111,6 +111,6 @@ public class {{classname}}Controller implements {{classname}} {
}
{{/operation}}
{{/jdk8-no-delegate}}
{{/isDelegate}}
}
{{/operations}}

View File

@@ -25,8 +25,8 @@
<springfox-swagger-ui>2.6.0</springfox-swagger-ui>
<slf4j-api>1.7.25</slf4j-api>
<logstash-logback-encoder>4.11</logstash-logback-encoder>
<logback-core>1.5.13</logback-core>
<logback-classic>1.5.13</logback-classic>
<logback-core>1.5.19</logback-core>
<logback-classic>1.5.19</logback-classic>
<gatling.version>2.3.0</gatling.version>
<gatling-plugin.version>2.2.4</gatling-plugin.version>
<scala-maven-plugin.version>3.2.2</scala-maven-plugin.version>

View File

@@ -26,7 +26,7 @@
<version.commons.codec>1.10</version.commons.codec>
<version.encoder>1.2</version.encoder>
<version.metrics>3.1.2</version.metrics>
<version.logback>1.5.13</version.logback>
<version.logback>1.5.19</version.logback>
<version.junit>4.13.2</version.junit>
<version.mockito>2.1.0-beta.124</version.mockito>
<version.undertow>2.3.17.Final</version.undertow>

View File

@@ -18,9 +18,9 @@ public class {{classname}}MockServer {
@Deprecated
{{/isDeprecated}}
public static MappingBuilder stub{{#lambda.pascalcase}}{{operationId}}{{/lambda.pascalcase}}{{{code}}}({{#allParams}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable {{/isNullable}}{{^isNullable}}@{{javaxPackage}}.annotation.Nonnull {{/isNullable}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable {{/required}}{{^isBodyParam}}String {{paramName}}{{/isBodyParam}}{{#isBodyParam}}String body{{/isBodyParam}}{{^-last}}, {{/-last}}{{#-last}}{{#headers.0}}, {{/headers.0}}{{^headers.0}}{{#returnType}}, {{/returnType}}{{/headers.0}}{{/-last}}{{/allParams}}{{#headers}}String response{{#lambda.pascalcase}}{{baseName}}{{/lambda.pascalcase}}{{^-last}}, {{/-last}}{{#-last}}{{#returnType}}, {{/returnType}}{{/-last}}{{/headers}}{{#returnType}}String response{{/returnType}}) {
MappingBuilder stub = {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}({{^pathParams.0}}urlPathEqualTo{{/pathParams.0}}{{#pathParams.0}}urlPathTemplate{{/pathParams.0}}("{{{path}}}")){{#hasProduces}}
.withHeader("Accept", havingExactly({{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}})){{/hasProduces}}{{#hasAuthMethods}}{{#hasConsumes}}
.withHeader("Content-Type", havingExactly("{{#consumes.0}}{{{mediaType}}}{{/consumes.0}}")){{/hasConsumes}}
MappingBuilder stub = {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}({{^pathParams.0}}urlPathEqualTo{{/pathParams.0}}{{#pathParams.0}}urlPathTemplate{{/pathParams.0}}("{{{path}}}")){{#hasProduces}}{{#produces}}
.withHeader("Accept", containing("{{{mediaType}}}")){{/produces}}{{/hasProduces}}{{#hasAuthMethods}}{{#hasConsumes}}
.withHeader("Content-Type", havingExactly(equalToIgnoreCase("{{#consumes.0}}{{{mediaType}}}{{/consumes.0}}"))){{/hasConsumes}}
.withHeader("Authorization", matching(".*")){{/hasAuthMethods}}{{#cookieParams}}
.withCookie("{{baseName}}", havingExactly({{paramName}})){{/cookieParams}}{{#hasBodyParam}}
.withRequestBody(equalToJson(body)){{/hasBodyParam}}
@@ -105,9 +105,9 @@ public class {{classname}}MockServer {
{{/responses}}
public static MappingBuilder stub{{#lambda.pascalcase}}{{operationId}}{{/lambda.pascalcase}}Fault({{#allParams}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable {{/isNullable}}{{^isNullable}}@{{javaxPackage}}.annotation.Nonnull {{/isNullable}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable {{/required}}{{^isBodyParam}}String {{paramName}}{{/isBodyParam}}{{#isBodyParam}}String body{{/isBodyParam}}, {{/allParams}}Fault fault) {
MappingBuilder stub = {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}({{^pathParams.0}}urlPathEqualTo{{/pathParams.0}}{{#pathParams.0}}urlPathTemplate{{/pathParams.0}}("{{{path}}}")){{#hasProduces}}
.withHeader("Accept", havingExactly({{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}})){{/hasProduces}}{{#hasAuthMethods}}{{#hasConsumes}}
.withHeader("Content-Type", havingExactly("{{#consumes.0}}{{{mediaType}}}{{/consumes.0}}")){{/hasConsumes}}
MappingBuilder stub = {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}({{^pathParams.0}}urlPathEqualTo{{/pathParams.0}}{{#pathParams.0}}urlPathTemplate{{/pathParams.0}}("{{{path}}}")){{#hasProduces}}{{#produces}}
.withHeader("Accept", containing("{{{mediaType}}}")){{/produces}}{{/hasProduces}}{{#hasAuthMethods}}{{#hasConsumes}}
.withHeader("Content-Type", havingExactly(equalToIgnoreCase("{{#consumes.0}}{{{mediaType}}}{{/consumes.0}}"))){{/hasConsumes}}
.withHeader("Authorization", matching(".*")){{/hasAuthMethods}}{{#cookieParams}}
.withCookie("{{baseName}}", havingExactly({{paramName}})){{/cookieParams}}{{#bodyParam}}
.withRequestBody(equalToJson(body)){{/bodyParam}}

View File

@@ -37,14 +37,14 @@ apply plugin: "java"
apply plugin: "kotlin"
apply plugin: "application"
sourceCompatibility = 1.8
sourceCompatibility = 11
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "11"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "11"
}
repositories {

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