Compare commits

..

1 Commits

Author SHA1 Message Date
William Cheng
e5275b3315 fix enum ref in rust api paramaters 2024-01-24 16:32:04 +08:00
1079 changed files with 12686 additions and 52739 deletions

View File

@@ -35,7 +35,7 @@ jobs:
~/.gradle
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Install Gradle wrapper
uses: eskatos/gradle-command-action@v3
uses: eskatos/gradle-command-action@v2
with:
gradle-version: ${{ env.GRADLE_VERSION }}
build-root-directory: ${{ matrix.sample }}

View File

@@ -84,7 +84,7 @@ jobs:
~/.gradle
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Install Gradle wrapper
uses: eskatos/gradle-command-action@v3
uses: eskatos/gradle-command-action@v2
with:
gradle-version: ${{ env.GRADLE_VERSION }}
build-root-directory: ${{ matrix.sample }}

View File

@@ -46,7 +46,7 @@ jobs:
~/.gradle
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Install Gradle wrapper
uses: eskatos/gradle-command-action@v3
uses: eskatos/gradle-command-action@v2
with:
gradle-version: ${{ env.GRADLE_VERSION }}
build-root-directory: ${{ matrix.sample }}

View File

@@ -58,7 +58,7 @@ jobs:
~/.gradle
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Install Gradle wrapper
uses: eskatos/gradle-command-action@v3
uses: eskatos/gradle-command-action@v2
with:
gradle-version: ${{ env.GRADLE_VERSION }}
build-root-directory: ${{ matrix.sample }}

View File

@@ -7,8 +7,6 @@ on:
pull_request:
paths:
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
- samples/server/petstore/springboot-lombok-data
- samples/server/petstore/springboot-lombok-tostring
jobs:
build:
name: Build Java Spring (JDK17)
@@ -19,9 +17,6 @@ jobs:
sample:
# clients
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
# servers
- samples/server/petstore/springboot-lombok-data
- samples/server/petstore/springboot-lombok-tostring
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4

View File

@@ -57,7 +57,6 @@ jobs:
- samples/server/petstore/springboot-spring-pageable-without-j8
- samples/server/petstore/springboot-spring-pageable
- samples/server/petstore/springboot-spring-provide-args
- samples/server/petstore/springboot-lombok-data
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4

View File

@@ -29,7 +29,7 @@ jobs:
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
(cd http-echo-server && git checkout 15a684c41d4de692878636f47fcc1670af309a0f && npm install && npm start &)
(cd http-echo-server && npm install && npm start &)
- name: Install
working-directory: ${{ matrix.sample }}

26
.github/workflows/sonar.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: Sonar CI
on:
push:
branches:
- master
- '[4-9]+.[0-9]+.x'
- sonar
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'OpenAPITools' }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
- name: Compile with Maven
run: ./mvnw -B -q clean install jacoco:report
- name: Jacoco Aggregate
run: ./mvnw jacoco:report-aggregate
- name: Publish to Sonar
run: ./mvnw -B -q -nsu sonar:sonar -Dsonar.projectKey=OpenAPITools_openapi-generator -Dsonar.organization=openapitools -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_LOGIN }} -Dsonar.branch.name=${GITHUB_REF##*/}

View File

@@ -53,7 +53,7 @@ jobs:
# generator names containing "-" caused problems in the past, see https://github.com/OpenAPITools/openapi-generator/issues/9528
java -jar ./openapi-generator-cli.jar author template --verbose -g jaxrs-spec --library quarkus
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
uses: gradle/gradle-build-action@v2
- name: Gradle tests
run: |
gradle -b modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle buildGoSdk --stacktrace

View File

@@ -69,7 +69,6 @@ elif [ "$NODE_INDEX" = "3" ]; then
(cd samples/client/petstore/typescript-angular-v14-provided-in-root && mvn integration-test)
(cd samples/client/petstore/typescript-angular-v15-provided-in-root && mvn integration-test)
(cd samples/client/petstore/typescript-angular-v16-provided-in-root && mvn integration-test)
(cd samples/client/petstore/typescript-angular-v17-provided-in-root && mvn integration-test)
(cd samples/openapi3/client/petstore/typescript/builds/default && mvn integration-test)
(cd samples/openapi3/client/petstore/typescript/tests/default && mvn integration-test)
(cd samples/openapi3/client/petstore/typescript/builds/jquery && mvn integration-test)

View File

@@ -65,9 +65,6 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
[<img src="https://openapi-generator.tech/img/companies/adyen.png" width="128" height="128">](https://adyen.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor)
[<img src="https://openapi-generator.tech/img/companies/fornex.png" width="128" height="128">](https://fornex.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor)
[<img src="https://openapi-generator.tech/img/companies/alloyautomation.png" width="128" height="128">](https://runalloy.com/signup?utm_source=github&utm_medium=referral&utm_campaign=1524_openapigenerator)
[<img src="https://openapi-generator.tech/img/companies/ssstwitter.png" width="128" height="128">](https://ssstwitter.com/?utm_source=github&utm_medium=referral&utm_campaign=sponsor)
[<img src="https://openapi-generator.tech/img/companies/svix.png" width="128" height="128">](https://www.svix.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
#### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS, Checkly for sponsoring the API monitoring and Gradle for sponsoring Develocity
@@ -82,7 +79,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
| | Languages/Frameworks |
| -------------------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient 4.x, Apache HttpClient 5.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **N4JS**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient, pekko), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (9.x - 17.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo**, **Zapier** |
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient 4.x, Apache HttpClient 5.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **N4JS**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient, pekko), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (9.x - 16.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo**, **Zapier** |
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, [Ktor](https://github.com/ktorio/ktor), [Vert.x](https://vertx.io/)), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) |
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
@@ -708,7 +705,6 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Splitit](https://www.splitit.com/)
- [Stingray](http://www.stingray.com)
- [Suva](https://www.suva.ch/)
- [Svix](https://www.svix.com/)
- [Telstra](https://dev.telstra.com)
- [Tencent](https://www.tencent.com)
- [The University of Aizu](https://www.u-aizu.ac.jp/en/)

View File

@@ -1,6 +0,0 @@
generatorName: go
outputDir: samples/client/echo_api/go-external-refs
inputSpec: modules/openapi-generator/src/test/resources/3_0/external-refs/echo_api.yaml
templateDir: modules/openapi-generator/src/main/resources/go
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -1,5 +0,0 @@
generatorName: go
outputDir: samples/client/others/go/oneof-anyof-required
inputSpec: modules/openapi-generator/src/test/resources/3_0/go/spec-with-oneof-anyof-required.yaml
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -17,6 +17,3 @@ additionalProperties:
enumNameMappings:
s: LOWER_CASE_S
S: UPPER_CASE_S
operationIdNameMappings:
getArrayOfEnums: getFakeArrayofenums
fakeHealthGet: getFakeHealth

View File

@@ -1,9 +0,0 @@
generatorName: spring
outputDir: samples/server/petstore/springboot-lombok-data
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
groupId: org.openapitools.openapi3
artifactId: springboot-lombok-data
hideGenerationTimestamp: "true"
additionalModelTypeAnnotations: "@lombok.Data;@lombok.Builder;@lombok.NoArgsConstructor;@lombok.AllArgsConstructor"

View File

@@ -1,11 +0,0 @@
generatorName: spring
outputDir: samples/server/petstore/springboot-lombok-tostring
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
groupId: org.openapitools.openapi3
artifactId: springboot-lombok-tostring
hideGenerationTimestamp: "true"
performBeanValidation: "true"
useSpringBoot3: "true"
additionalModelTypeAnnotations: "@lombok.Getter;@lombok.Setter;@lombok.ToString;@lombok.EqualsAndHashCode"

View File

@@ -1,7 +0,0 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
additionalProperties:
ngVersion: 17.0.0
supportsES6: true

View File

@@ -10,7 +10,7 @@
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/ClientTest.java"
sha256: db505f7801fef62c13a08a8e9ca1fc4c5c947ab46b46f12943139d353feacf17
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java"
sha256: c479b587cf0d51fa550eb81d33b277081807b87dc28649027d1164224c25ad0a
sha256: 7b9514ac0b3730685590d6ef273b2c2a1fb72d968529c2423a139ee9b0b92a65
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java"
sha256: 0d64cdc11809a7b5b952ccdad2bd91bd0045b3894d6fabf3e368fa0be12b8217
- filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/PetTest.java"

View File

@@ -436,13 +436,6 @@ Not all generators support thess features yet. Please give it a try to confirm t
NOTE: some generators use `baseName` (original name obtained direclty from OpenAPI spec, e.g. `shipping-date`) mustache tag in the templates so the mapping feature won't work.
To map `operationId` (used in method naming) to something else, use `operationIdNameMappings` option, e.g.
```sh
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/java/ --operation-id-name-mappings getPetById=returnPetById
```
will name the API method as `returnPetById` instead of `getPetById` obtained from OpenAPI doc/spec.
## Schema Mapping
One can map the schema to something else (e.g. external objects/models outside of the package) using the `schemaMappings` option, e.g. in CLI
@@ -578,9 +571,3 @@ Example:
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/allOf_extension_parent.yaml -o /tmp/java-okhttp/ --openapi-normalizer REFACTOR_ALLOF_WITH_PROPERTIES_ONLY=true
```
- `REMOVE_X_INTERNAL`: When set to true, remove `x-internal` extension from operations and models.
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer REMOVE_X_INTERNAL=true
```

View File

@@ -125,12 +125,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>reinterpret_cast</li>
<li>requires</li>
<li>return</li>
<li>set</li>
<li>short</li>
<li>signals</li>
<li>signed</li>
<li>sizeof</li>
<li>slots</li>
<li>static</li>
<li>static_assert</li>
<li>static_cast</li>
@@ -148,7 +145,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>union</li>
<li>unsigned</li>
<li>using</li>
<li>valid</li>
<li>virtual</li>
<li>void</li>
<li>volatile</li>

View File

@@ -123,10 +123,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>requires</li>
<li>return</li>
<li>short</li>
<li>signals</li>
<li>signed</li>
<li>sizeof</li>
<li>slots</li>
<li>static</li>
<li>static_assert</li>
<li>static_cast</li>

View File

@@ -32,7 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|licenseName|The name of the license| |null|
|modelPackage|package for generated models| |null|
|modern|use modern language features (generated code will require PHP 8.1)| |false|
|modern|use modern language features (generated code will require PHP 8.0)| |false|
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|

View File

@@ -11,7 +11,7 @@ title: Documentation for the typescript-angular Generator
| generator type | CLIENT | |
| generator language | Typescript | |
| generator default templating engine | mustache | |
| helpTxt | Generates a TypeScript Angular (9.x - 17.x) client library. | |
| helpTxt | Generates a TypeScript Angular (9.x - 16.x) client library. | |
## CONFIG OPTIONS
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
@@ -32,7 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|modelFileSuffix|The suffix of the file of the generated model (model&lt;suffix&gt;.ts).| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|modelSuffix|The suffix of the generated model.| |null|
|ngVersion|The version of Angular. (At least 9.0.0)| |17.0.0|
|ngVersion|The version of Angular. (At least 9.0.0)| |16.1.2|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.3.0</version>
<version>7.3.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -92,9 +92,6 @@ public class ConfigHelp extends OpenApiGeneratorCommand {
@Option(name = {"--enum-name-mappings"}, title = "enum name mappings", description = "displays the enum name mappings (none)")
private Boolean enumNameMappings;
@Option(name = {"--operation-id-name-mappings"}, title = "operation id name mappings", description = "displays the operation id name mappings (none)")
private Boolean operationIdNameMappings;
@Option(name = {"--openapi-normalizer"}, title = "openapi normalizer rules", description = "displays the OpenAPI normalizer rules (none)")
private Boolean openapiNormalizer;
@@ -563,18 +560,6 @@ public class ConfigHelp extends OpenApiGeneratorCommand {
sb.append(newline);
}
if (Boolean.TRUE.equals(operationIdNameMappings)) {
sb.append(newline).append("OPERATION ID MAPPING").append(newline).append(newline);
Map<String, String> map = config.operationIdNameMapping()
.entrySet()
.stream()
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> {
throw new IllegalStateException(String.format(Locale.ROOT, "Duplicated options! %s and %s", a, b));
}, TreeMap::new));
writePlainTextFromMap(sb, map, optIndent, optNestedIndent, "operation id name", "Mapped to");
sb.append(newline);
}
if (Boolean.TRUE.equals(openapiNormalizer)) {
sb.append(newline).append("OPENAPI NORMALIZER RULES").append(newline).append(newline);
Map<String, String> map = config.openapiNormalizer()

View File

@@ -223,13 +223,6 @@ public class Generate extends OpenApiGeneratorCommand {
+ " You can also have multiple occurrences of this option.")
private List<String> enumNameMappings = new ArrayList<>();
@Option(
name = {"--operation-id-name-mappings"},
title = "operation id name mappings",
description = "specifies mappings between the operation id name and the new name in the format of operation_id_name=AnotherName,operation_id_name2=OtherName2."
+ " You can also have multiple occurrences of this option.")
private List<String> operationIdNameMappings = new ArrayList<>();
@Option(
name = {"--openapi-normalizer"},
title = "OpenAPI normalizer rules",
@@ -514,7 +507,6 @@ public class Generate extends OpenApiGeneratorCommand {
applyParameterNameMappingsKvpList(parameterNameMappings, configurator);
applyModelNameMappingsKvpList(modelNameMappings, configurator);
applyEnumNameMappingsKvpList(enumNameMappings, configurator);
applyOperationIdNameMappingsKvpList(operationIdNameMappings, configurator);
applyOpenAPINormalizerKvpList(openapiNormalizer, configurator);
applyTypeMappingsKvpList(typeMappings, configurator);
applyAdditionalPropertiesKvpList(additionalProperties, configurator);

View File

@@ -6,7 +6,7 @@
<artifactId>openapi-generator-project</artifactId>
<groupId>org.openapitools</groupId>
<!-- RELEASE_VERSION -->
<version>7.3.0</version>
<version>7.3.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -57,7 +57,6 @@ public final class GeneratorSettings implements Serializable {
private final Map<String, String> parameterNameMappings;
private final Map<String, String> modelNameMappings;
private final Map<String, String> enumNameMappings;
private final Map<String, String> operationIdNameMappings;
private final Map<String, String> openapiNormalizer;
private final Set<String> languageSpecificPrimitives;
private final Set<String> openapiGeneratorIgnoreList;
@@ -307,15 +306,6 @@ public final class GeneratorSettings implements Serializable {
return enumNameMappings;
}
/**
* Gets operation id name mappings between an operation id name and the new name.
*
* @return the operation id name mappings
*/
public Map<String, String> getOperationIdNameMappings() {
return operationIdNameMappings;
}
/**
* Gets OpenAPI normalizer rules
*
@@ -456,7 +446,6 @@ public final class GeneratorSettings implements Serializable {
parameterNameMappings = Collections.unmodifiableMap(builder.parameterNameMappings);
modelNameMappings = Collections.unmodifiableMap(builder.modelNameMappings);
enumNameMappings = Collections.unmodifiableMap(builder.enumNameMappings);
operationIdNameMappings = Collections.unmodifiableMap(builder.operationIdNameMappings);
openapiNormalizer = Collections.unmodifiableMap(builder.openapiNormalizer);
languageSpecificPrimitives = Collections.unmodifiableSet(builder.languageSpecificPrimitives);
openapiGeneratorIgnoreList = Collections.unmodifiableSet(builder.openapiGeneratorIgnoreList);
@@ -536,7 +525,6 @@ public final class GeneratorSettings implements Serializable {
parameterNameMappings = Collections.unmodifiableMap(new HashMap<>(0));
modelNameMappings = Collections.unmodifiableMap(new HashMap<>(0));
enumNameMappings = Collections.unmodifiableMap(new HashMap<>(0));
operationIdNameMappings = Collections.unmodifiableMap(new HashMap<>(0));
openapiNormalizer = Collections.unmodifiableMap(new HashMap<>(0));
languageSpecificPrimitives = Collections.unmodifiableSet(new HashSet<>(0));
openapiGeneratorIgnoreList = Collections.unmodifiableSet(new HashSet<>(0));
@@ -611,9 +599,6 @@ public final class GeneratorSettings implements Serializable {
if (copy.getEnumNameMappings() != null) {
builder.enumNameMappings.putAll(copy.getEnumNameMappings());
}
if (copy.getOperationIdNameMappings() != null) {
builder.operationIdNameMappings.putAll(copy.getOperationIdNameMappings());
}
if (copy.getOpenAPINormalizer() != null) {
builder.openapiNormalizer.putAll(copy.getOpenAPINormalizer());
}
@@ -666,7 +651,6 @@ public final class GeneratorSettings implements Serializable {
private Map<String, String> parameterNameMappings;
private Map<String, String> modelNameMappings;
private Map<String, String> enumNameMappings;
private Map<String, String> operationIdNameMappings;
private Map<String, String> openapiNormalizer;
private Set<String> languageSpecificPrimitives;
private Set<String> openapiGeneratorIgnoreList;
@@ -693,7 +677,6 @@ public final class GeneratorSettings implements Serializable {
parameterNameMappings = new HashMap<>();
modelNameMappings = new HashMap<>();
enumNameMappings = new HashMap<>();
operationIdNameMappings = new HashMap<>();
openapiNormalizer = new HashMap<>();
languageSpecificPrimitives = new HashSet<>();
openapiGeneratorIgnoreList = new HashSet<>();
@@ -1120,32 +1103,6 @@ public final class GeneratorSettings implements Serializable {
return this;
}
/**
* Sets the {@code operationIdNameMappings} and returns a reference to this Builder so that the methods can be chained together.
*
* @param operationIdNameMappings the {@code operationIdNameMappings} to set
* @return a reference to this Builder
*/
public Builder withOperationIdNameMappings(Map<String, String> operationIdNameMappings) {
this.operationIdNameMappings = operationIdNameMappings;
return this;
}
/**
* Sets a single {@code operationIdNameMappings} and returns a reference to this Builder so that the methods can be chained together.
*
* @param key A key for the name mapping
* @param value The value of name mapping
* @return a reference to this Builder
*/
public Builder withOperationIdNameMapping(String key, String value) {
if (this.operationIdNameMappings == null) {
this.operationIdNameMappings = new HashMap<>();
}
this.operationIdNameMappings.put(key, value);
return this;
}
/**
* Sets the {@code openapiNormalizer} and returns a reference to this Builder so that the methods can be chained together.
*
@@ -1389,7 +1346,6 @@ public final class GeneratorSettings implements Serializable {
Objects.equals(getParameterNameMappings(), that.getParameterNameMappings()) &&
Objects.equals(getModelNameMappings(), that.getModelNameMappings()) &&
Objects.equals(getEnumNameMappings(), that.getEnumNameMappings()) &&
Objects.equals(getOperationIdNameMappings(), that.getOperationIdNameMappings()) &&
Objects.equals(getOpenAPINormalizer(), that.getOpenAPINormalizer()) &&
Objects.equals(getLanguageSpecificPrimitives(), that.getLanguageSpecificPrimitives()) &&
Objects.equals(getOpenAPIGeneratorIgnoreList(), that.getOpenAPIGeneratorIgnoreList()) &&
@@ -1427,7 +1383,6 @@ public final class GeneratorSettings implements Serializable {
getParameterNameMappings(),
getModelNameMappings(),
getEnumNameMappings(),
getOperationIdNameMappings(),
getOpenAPINormalizer(),
getLanguageSpecificPrimitives(),
getOpenAPIGeneratorIgnoreList(),

View File

@@ -1,5 +1,5 @@
# RELEASE_VERSION
openApiGeneratorVersion=7.3.0
openApiGeneratorVersion=7.3.0-SNAPSHOT
# /RELEASE_VERSION
# BEGIN placeholders

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.3.0</version>
<version>7.3.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -1,3 +1,3 @@
# RELEASE_VERSION
openApiGeneratorVersion=7.3.0
openApiGeneratorVersion=7.3.0-SNAPSHOT
# /RELEASE_VERSION

View File

@@ -192,11 +192,6 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
*/
val enumNameMappings = project.objects.mapProperty<String, String>()
/**
* Specifies mappings between an operation id name and the new name
*/
val operationIdNameMappings = project.objects.mapProperty<String, String>()
/**
* Specifies mappings (rules) in OpenAPI normalizer
*/

View File

@@ -307,13 +307,6 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
@Input
val enumNameMappings = project.objects.mapProperty<String, String>()
/**
* Specifies mappings between the operation id name and the new name
*/
@Optional
@Input
val operationIdNameMappings = project.objects.mapProperty<String, String>()
/**
* Specifies mappings (rules) in OpenAPI normalizer
*/
@@ -879,12 +872,6 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
}
}
if (operationIdNameMappings.isPresent) {
operationIdNameMappings.get().forEach { entry ->
configurator.addOperationIdNameMapping(entry.key, entry.value)
}
}
if (openapiNormalizer.isPresent) {
openapiNormalizer.get().forEach { entry ->
configurator.addOpenAPINormalizer(entry.key, entry.value)

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.3.0</version>
<version>7.3.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -15,7 +15,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.3.0</version>
<version>7.3.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -19,7 +19,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.3.0</version>
<version>7.3.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<dependencies>
<dependency>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.3.0</version>
<version>7.3.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.3.0</version>
<version>7.3.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -20,7 +20,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.3.0</version>
<version>7.3.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -5,7 +5,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.3.0</version>
<version>7.3.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -356,12 +356,6 @@ public class CodeGenMojo extends AbstractMojo {
@Parameter(name = "enumNameMappings", property = "openapi.generator.maven.plugin.enumNameMappings")
private List<String> enumNameMappings;
/**
* A map of operation id names and the new names
*/
@Parameter(name = "operationIdNameMappings", property = "openapi.generator.maven.plugin.operationIdNameMappings")
private List<String> operationIdNameMappings;
/**
* A set of rules for OpenAPI normalizer
*/
@@ -863,11 +857,6 @@ public class CodeGenMojo extends AbstractMojo {
applyEnumNameMappingsKvpList(enumNameMappings, configurator);
}
// Apply Operation ID Name Mappings
if (operationIdNameMappings != null && (configOptions == null || !configOptions.containsKey("operation-id-name-mappings"))) {
applyOperationIdNameMappingsKvpList(operationIdNameMappings, configurator);
}
// Apply OpenAPI normalizer rules
if (openapiNormalizer != null && (configOptions == null || !configOptions.containsKey("openapi-normalizer"))) {
applyOpenAPINormalizerKvpList(openapiNormalizer, configurator);

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.3.0</version>
<version>7.3.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.3.0</version>
<version>7.3.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -158,8 +158,6 @@ public interface CodegenConfig {
Map<String, String> enumNameMapping();
Map<String, String> operationIdNameMapping();
Map<String, String> openapiNormalizer();
Map<String, String> apiTemplateFiles();

View File

@@ -51,11 +51,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public Set<String> oneOf = new TreeSet<>();
public Set<String> allOf = new TreeSet<>();
// The schema name as written in the OpenAPI document
// If it's a reserved word, it will be escaped.
// The schema name as written in the OpenAPI document.
public String name;
// The original schema name as written in the OpenAPI document.
public String schemaName;
// The language-specific name of the class that implements this schema.
// The name of the class is derived from the OpenAPI schema name with formatting rules applied.
// The classname is derived from the OpenAPI schema name, with sanitization and escaping rules applied.
@@ -495,15 +492,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
this.name = name;
}
public String getSchemaName() {
return schemaName;
}
public void setSchemaName(String schemaName) {
this.schemaName = schemaName;
}
public List<CodegenProperty> getOptionalVars() {
return optionalVars;
}
@@ -1156,7 +1144,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
Objects.equals(oneOf, that.oneOf) &&
Objects.equals(allOf, that.allOf) &&
Objects.equals(name, that.name) &&
Objects.equals(schemaName, that.schemaName) &&
Objects.equals(classname, that.classname) &&
Objects.equals(title, that.title) &&
Objects.equals(description, that.description) &&
@@ -1205,7 +1192,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
@Override
public int hashCode() {
return Objects.hash(getParent(), getParentSchema(), getInterfaces(), getAllParents(), getParentModel(),
getInterfaceModels(), getChildren(), anyOf, oneOf, allOf, getName(), getSchemaName(), getClassname(), getTitle(),
getInterfaceModels(), getChildren(), anyOf, oneOf, allOf, getName(), getClassname(), getTitle(),
getDescription(), getClassVarName(), getModelJson(), getDataType(), getXmlPrefix(), getXmlNamespace(),
getXmlName(), getClassFilename(), getUnescapedDescription(), getDiscriminator(), getDefaultValue(),
getArrayModelType(), isAlias, isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble,
@@ -1227,7 +1214,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenModel{");
sb.append("name='").append(name).append('\'');
sb.append(", schemaName='").append(schemaName).append('\'');
sb.append(", parent='").append(parent).append('\'');
sb.append(", parentSchema='").append(parentSchema).append('\'');
sb.append(", interfaces=").append(interfaces);

View File

@@ -177,8 +177,6 @@ public class DefaultCodegen implements CodegenConfig {
protected Map<String, String> modelNameMapping = new HashMap<>();
// a map to store the mapping between enum name and the name provided by the user
protected Map<String, String> enumNameMapping = new HashMap<>();
// a map to store the mapping between operation id name and the name provided by the user
protected Map<String, String> operationIdNameMapping = new HashMap<>();
// a map to store the rules in OpenAPI Normalizer
protected Map<String, String> openapiNormalizer = new HashMap<>();
protected String modelPackage = "", apiPackage = "", fileSuffix;
@@ -667,16 +665,14 @@ public class DefaultCodegen implements CodegenConfig {
}
parent.getChildren().add(cm);
parent.hasChildren = true;
Schema parentSchema = this.openAPI.getComponents().getSchemas().get(parent.schemaName);
Schema parentSchema = this.openAPI.getComponents().getSchemas().get(parent.name);
if (parentSchema == null) {
LOGGER.warn("Failed to look up parent schema: {}", parent.schemaName);
parent = null;
throw new NullPointerException(parent.name + " in " + this.openAPI.getComponents().getSchemas());
}
if (parentSchema.getDiscriminator() == null) {
parent = allModels.get(parent.getParent());
} else {
if (parentSchema.getDiscriminator() == null) {
parent = allModels.get(parent.getParent());
} else {
parent = null;
}
parent = null;
}
}
}
@@ -1275,11 +1271,6 @@ public class DefaultCodegen implements CodegenConfig {
return enumNameMapping;
}
@Override
public Map<String, String> operationIdNameMapping() {
return operationIdNameMapping;
}
@Override
public Map<String, String> openapiNormalizer() {
return openapiNormalizer;
@@ -3124,7 +3115,6 @@ public class DefaultCodegen implements CodegenConfig {
} else {
m.name = name;
}
m.schemaName = name; // original schema name
m.title = escapeText(schema.getTitle());
m.description = escapeText(schema.getDescription());
m.unescapedDescription = schema.getDescription();
@@ -3763,7 +3753,7 @@ public class DefaultCodegen implements CodegenConfig {
for (String r : required) {
if (!properties.containsKey(r)) {
LOGGER.error("Required var {} not in properties", r);
LOGGER.error("Required var %s not in properties", r);
}
}
return;
@@ -4517,6 +4507,11 @@ public class DefaultCodegen implements CodegenConfig {
if (operation == null)
throw new RuntimeException("operation cannot be null in fromOperation");
if (operation.getExtensions() != null && Boolean.TRUE.equals(operation.getExtensions().get("x-internal"))) {
LOGGER.info("Operation ({} {} - {}) not generated since x-internal is set to true",
httpMethod, path, operation.getOperationId());
}
Map<String, Schema> schemas = ModelUtils.getSchemas(this.openAPI);
CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION);
Set<String> imports = new HashSet<>();
@@ -4561,11 +4556,7 @@ public class DefaultCodegen implements CodegenConfig {
op.path = path;
}
if (operationIdNameMapping.containsKey(operationId)) {
op.operationId = operationIdNameMapping.get(operationId);
} else {
op.operationId = toOperationId(operationId);
}
op.operationId = toOperationId(operationId);
op.summary = escapeText(operation.getSummary());
op.unescapedNotes = operation.getDescription();
op.notes = escapeText(operation.getDescription());
@@ -5092,31 +5083,25 @@ public class DefaultCodegen implements CodegenConfig {
String method = p.getKey();
Operation op = p.getValue();
if (op.getExtensions() != null && Boolean.TRUE.equals(op.getExtensions().get("x-internal"))) {
// skip operation if x-internal sets to true
LOGGER.info("Operation ({} {} - {}) not generated since x-internal is set to true",
method, expression, op.getOperationId());
} else {
boolean genId = op.getOperationId() == null;
if (genId) {
op.setOperationId(getOrGenerateOperationId(op, c.name + "_" + expression.replaceAll("\\{\\$.*}", ""), method));
}
if (op.getExtensions() == null) {
op.setExtensions(new HashMap<>());
}
// This extension will be removed later by `fromOperation()` as it is only needed here to
// distinguish between normal operations and callback requests
op.getExtensions().put("x-callback-request", true);
CodegenOperation co = fromOperation(expression, method, op, servers);
if (genId) {
co.operationIdOriginal = null;
// legacy (see `fromOperation()`)
co.nickname = co.operationId;
}
u.requests.add(co);
boolean genId = op.getOperationId() == null;
if (genId) {
op.setOperationId(getOrGenerateOperationId(op, c.name + "_" + expression.replaceAll("\\{\\$.*}", ""), method));
}
if (op.getExtensions() == null) {
op.setExtensions(new HashMap<>());
}
// This extension will be removed later by `fromOperation()` as it is only needed here to
// distinguish between normal operations and callback requests
op.getExtensions().put("x-callback-request", true);
CodegenOperation co = fromOperation(expression, method, op, servers);
if (genId) {
co.operationIdOriginal = null;
// legacy (see `fromOperation()`)
co.nickname = co.operationId;
}
u.requests.add(co);
});
c.urls.add(u);
@@ -7373,20 +7358,7 @@ public class DefaultCodegen implements CodegenConfig {
}
protected void updateRequestBodyForMap(CodegenParameter codegenParameter, Schema schema, String name, Set<String> imports, String bodyParameterName) {
boolean useModel = true;
if (StringUtils.isBlank(name)) {
useModel = false;
} else {
if (ModelUtils.isFreeFormObject(schema)) {
useModel = ModelUtils.shouldGenerateFreeFormObjectModel(name, this);
} else if (ModelUtils.isMapSchema(schema)) {
useModel = ModelUtils.shouldGenerateMapModel(schema);
} else if (ModelUtils.isArraySchema(schema)) {
useModel = ModelUtils.shouldGenerateArrayModel(schema);
}
}
if (useModel) {
if (StringUtils.isNotBlank(name) && !(ModelUtils.isFreeFormObject(schema) && !ModelUtils.shouldGenerateFreeFormObjectModel(name, this))) {
this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, true);
} else {
Schema inner = ModelUtils.getAdditionalProperties(schema);

View File

@@ -517,13 +517,16 @@ public class DefaultGenerator implements Generator {
continue;
}
} else if (ModelUtils.isMapSchema(schema)) { // check to see if it's a "map" model
if (!ModelUtils.shouldGenerateMapModel(schema)) {
// A composed schema (allOf, oneOf, anyOf) is considered a Map schema if the additionalproperties attribute is set
// for that composed schema. However, in the case of a composed schema, the properties are defined or referenced
// in the inner schemas, and the outer schema does not have properties.
if (!ModelUtils.isGenerateAliasAsModel(schema) && !ModelUtils.isComposedSchema(schema) && (schema.getProperties() == null || schema.getProperties().isEmpty())) {
// schema without property, i.e. alias to map
LOGGER.info("Model {} not generated since it's an alias to map (without property) and `generateAliasAsModel` is set to false (default)", name);
continue;
}
} else if (ModelUtils.isArraySchema(schema)) { // check to see if it's an "array" model
if (!ModelUtils.shouldGenerateArrayModel(schema)) {
if (!ModelUtils.isGenerateAliasAsModel(schema) && (schema.getProperties() == null || schema.getProperties().isEmpty())) {
// schema without property, i.e. alias to array
LOGGER.info("Model {} not generated since it's an alias to array (without property) and `generateAliasAsModel` is set to false (default)", name);
continue;
@@ -1492,36 +1495,31 @@ public class DefaultGenerator implements Generator {
final List<SecurityRequirement> globalSecurities = openAPI.getSecurity();
for (Tag tag : tags) {
try {
if (operation.getExtensions() != null && Boolean.TRUE.equals(operation.getExtensions().get("x-internal"))) {
// skip operation if x-internal sets to true
LOGGER.info("Operation ({} {} - {}) not generated since x-internal is set to true",
httpMethod, resourcePath, operation.getOperationId());
CodegenOperation codegenOperation = config.fromOperation(resourcePath, httpMethod, operation, path.getServers());
codegenOperation.tags = new ArrayList<>(tags);
config.addOperationToGroup(config.sanitizeTag(tag.getName()), resourcePath, operation, codegenOperation, operations);
List<SecurityRequirement> securities = operation.getSecurity();
if (securities != null && securities.isEmpty()) {
continue;
}
Map<String, SecurityScheme> authMethods = getAuthMethods(securities, securitySchemes);
if (authMethods != null && !authMethods.isEmpty()) {
List<CodegenSecurity> fullAuthMethods = config.fromSecurity(authMethods);
codegenOperation.authMethods = filterAuthMethods(fullAuthMethods, securities);
codegenOperation.hasAuthMethods = true;
} else {
CodegenOperation codegenOperation = config.fromOperation(resourcePath, httpMethod, operation, path.getServers());
codegenOperation.tags = new ArrayList<>(tags);
config.addOperationToGroup(config.sanitizeTag(tag.getName()), resourcePath, operation, codegenOperation, operations);
List<SecurityRequirement> securities = operation.getSecurity();
if (securities != null && securities.isEmpty()) {
continue;
}
Map<String, SecurityScheme> authMethods = getAuthMethods(securities, securitySchemes);
authMethods = getAuthMethods(globalSecurities, securitySchemes);
if (authMethods != null && !authMethods.isEmpty()) {
List<CodegenSecurity> fullAuthMethods = config.fromSecurity(authMethods);
codegenOperation.authMethods = filterAuthMethods(fullAuthMethods, securities);
codegenOperation.authMethods = filterAuthMethods(fullAuthMethods, globalSecurities);
codegenOperation.hasAuthMethods = true;
} else {
authMethods = getAuthMethods(globalSecurities, securitySchemes);
if (authMethods != null && !authMethods.isEmpty()) {
List<CodegenSecurity> fullAuthMethods = config.fromSecurity(authMethods);
codegenOperation.authMethods = filterAuthMethods(fullAuthMethods, globalSecurities);
codegenOperation.hasAuthMethods = true;
}
}
}
} catch (Exception ex) {
String msg = "Could not process operation:\n" //
+ " Tag: " + tag + "\n"//
@@ -1532,6 +1530,7 @@ public class DefaultGenerator implements Generator {
throw new RuntimeException(msg, ex);
}
}
}
private static String generateParameterId(Parameter parameter) {

View File

@@ -612,8 +612,8 @@ public class InlineModelResolver {
Schema innerModel = modelFromProperty(openAPI, component, innerModelName);
// Recurse to create $refs for inner models
gatherInlineModels(innerModel, innerModelName);
String existing = matchGenerated(innerModel);
if (!skipAllOfInlineSchemas) {
String existing = matchGenerated(innerModel);
if (existing == null) {
innerModelName = addSchemas(innerModelName, innerModel);
Schema schema = new Schema().$ref(innerModelName);

View File

@@ -96,11 +96,6 @@ public class OpenAPINormalizer {
// when set to true, normalize OpenAPI 3.1 spec to make it work with the generator
final String NORMALIZE_31SPEC = "NORMALIZE_31SPEC";
// when set to true, remove x-internal: true from models, operations
final String REMOVE_X_INTERNAL = "REMOVE_X_INTERNAL";
final String X_INTERNAL = "x-internal";
boolean removeXInternal;
// ============= end of rules =============
/**
@@ -130,7 +125,6 @@ public class OpenAPINormalizer {
ruleNames.add(ADD_UNSIGNED_TO_INTEGER_WITH_INVALID_MAX_VALUE);
ruleNames.add(REFACTOR_ALLOF_WITH_PROPERTIES_ONLY);
ruleNames.add(NORMALIZE_31SPEC);
ruleNames.add(REMOVE_X_INTERNAL);
// rules that are default to true
rules.put(SIMPLIFY_ONEOF_ANYOF, true);
@@ -230,6 +224,7 @@ public class OpenAPINormalizer {
normalizeParameters(path.getParameters());
for (Operation operation : operations) {
normalizeOperation(operation);
normalizeRequestBody(operation);
normalizeParameters(operation.getParameters());
@@ -244,8 +239,6 @@ public class OpenAPINormalizer {
* @param operation Operation
*/
private void normalizeOperation(Operation operation) {
processRemoveXInternalFromOperation(operation);
processKeepOnlyFirstTagInOperation(operation);
processSetTagsForAllOperations(operation);
@@ -379,15 +372,8 @@ public class OpenAPINormalizer {
if (schema == null) {
LOGGER.warn("{} not fount found in openapi/components/schemas.", schemaName);
} else {
// remove x-internal if needed
if (schema.getExtensions() != null && getRule(REMOVE_X_INTERNAL)) {
if (Boolean.parseBoolean(String.valueOf(schema.getExtensions().get(X_INTERNAL)))) {
schema.getExtensions().remove(X_INTERNAL);
}
}
// normalize the schemas
schemas.put(schemaName, normalizeSchema(schema, new HashSet<>()));
Schema result = normalizeSchema(schema, new HashSet<>());
schemas.put(schemaName, result);
}
}
}
@@ -619,26 +605,6 @@ public class OpenAPINormalizer {
}
}
/**
* Keep only first tag in the operation if the operation has more than
* one tag.
*
* @param operation Operation
*/
private void processRemoveXInternalFromOperation(Operation operation) {
if (!getRule(REMOVE_X_INTERNAL)) {
return;
}
if (operation.getExtensions() == null) {
return;
}
if (Boolean.parseBoolean(String.valueOf(operation.getExtensions().get("x-internal")))) {
operation.getExtensions().remove(X_INTERNAL);
}
}
/**
* Keep only first tag in the operation if the operation has more than
* one tag.
@@ -772,15 +738,11 @@ public class OpenAPINormalizer {
*
* @param schema Schema
*/
public boolean isNullTypeSchema(Schema schema) {
private boolean isNullTypeSchema(Schema schema) {
if (schema == null) {
return true;
}
if (ModelUtils.hasAllOf(schema) || ModelUtils.hasOneOf(schema) || ModelUtils.hasAnyOf(schema)) {
return false;
}
if (schema.getTypes() != null && !schema.getTypes().isEmpty()) {
// 3.1 spec
if (schema.getTypes().size() ==1) { // 1 type only
@@ -791,7 +753,7 @@ public class OpenAPINormalizer {
}
}
if (!(schema instanceof JsonSchema) && (schema.getType() == null || schema.getType().equals("null")) && schema.get$ref() == null) {
if ((schema.getType() == null || schema.getType().equals("null")) && schema.get$ref() == null) {
return true;
}

View File

@@ -75,7 +75,6 @@ public class CodegenConfigurator {
private Map<String, String> parameterNameMappings = new HashMap<>();
private Map<String, String> modelNameMappings = new HashMap<>();
private Map<String, String> enumNameMappings = new HashMap<>();
private Map<String, String> operationIdNameMappings = new HashMap<>();
private Map<String, String> openapiNormalizer = new HashMap<>();
private Set<String> languageSpecificPrimitives = new HashSet<>();
private Set<String> openapiGeneratorIgnoreList = new HashSet<>();
@@ -142,9 +141,6 @@ public class CodegenConfigurator {
if(generatorSettings.getEnumNameMappings() != null) {
configurator.enumNameMappings.putAll(generatorSettings.getEnumNameMappings());
}
if(generatorSettings.getOperationIdNameMappings() != null) {
configurator.operationIdNameMappings.putAll(generatorSettings.getOperationIdNameMappings());
}
if(generatorSettings.getOpenAPINormalizer() != null) {
configurator.openapiNormalizer.putAll(generatorSettings.getOpenAPINormalizer());
}
@@ -262,12 +258,6 @@ public class CodegenConfigurator {
return this;
}
public CodegenConfigurator addOperationIdNameMapping(String key, String value) {
this.operationIdNameMappings.put(key, value);
generatorSettingsBuilder.withOperationIdNameMapping(key, value);
return this;
}
public CodegenConfigurator addOpenAPINormalizer(String key, String value) {
this.openapiNormalizer.put(key, value);
generatorSettingsBuilder.withOpenAPINormalizer(key, value);
@@ -476,12 +466,6 @@ public class CodegenConfigurator {
return this;
}
public CodegenConfigurator setOperationIdNameMappings(Map<String, String> operationIdNameMappings) {
this.operationIdNameMappings = operationIdNameMappings;
generatorSettingsBuilder.withOperationIdNameMappings(operationIdNameMappings);
return this;
}
public CodegenConfigurator setOpenAPINormalizer(Map<String, String> openapiNormalizer) {
this.openapiNormalizer = openapiNormalizer;
generatorSettingsBuilder.withOpenAPINormalizer(openapiNormalizer);
@@ -778,7 +762,6 @@ public class CodegenConfigurator {
config.parameterNameMapping().putAll(generatorSettings.getParameterNameMappings());
config.modelNameMapping().putAll(generatorSettings.getModelNameMappings());
config.enumNameMapping().putAll(generatorSettings.getEnumNameMappings());
config.operationIdNameMapping().putAll(generatorSettings.getOperationIdNameMappings());
config.openapiNormalizer().putAll(generatorSettings.getOpenAPINormalizer());
config.languageSpecificPrimitives().addAll(generatorSettings.getLanguageSpecificPrimitives());
config.openapiGeneratorIgnoreList().addAll(generatorSettings.getOpenAPIGeneratorIgnoreList());

View File

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

View File

@@ -748,11 +748,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
}
for (CodegenProperty cp : codegenProperties) {
if (!addedTimeImport && ("time.Time".equals(cp.dataType) || (cp.items != null && "time.Time".equals(cp.items.complexType)))) {
if (!addedTimeImport && ("time.Time".equals(cp.dataType) || (cp.items != null && "time.Time".equals(cp.items.dataType)))) {
imports.add(createMapping("import", "time"));
addedTimeImport = true;
}
if (!addedOSImport && ("*os.File".equals(cp.dataType) ||
(cp.items != null && "*os.File".equals(cp.items.dataType)))) {
imports.add(createMapping("import", "os"));

View File

@@ -53,7 +53,6 @@ import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -90,7 +89,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
public static final String CAMEL_CASE_DOLLAR_SIGN = "camelCaseDollarSign";
public static final String USE_ONE_OF_INTERFACES = "useOneOfInterfaces";
public static final String LOMBOK = "lombok";
public static final String DEFAULT_TEST_FOLDER = "${project.build.directory}/generated-test-sources/openapi";
protected String dateLibrary = "java8";
@@ -129,7 +128,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
protected String parentVersion = "";
protected boolean parentOverridden = false;
protected List<String> additionalModelTypeAnnotations = new LinkedList<>();
protected Map<String, Boolean> lombokAnnotations = null;
protected List<String> additionalOneOfTypeAnnotations = new LinkedList<>();
protected List<String> additionalEnumTypeAnnotations = new LinkedList<>();
protected boolean openApiNullable = true;
@@ -1003,21 +1001,21 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
if (items.getMinimum() != null && items.getMaximum() != null) {
return String.format(Locale.ROOT, "@DecimalMin(value = \"%s\", inclusive = %s) @DecimalMax(value = \"%s\", inclusive = %s)",
items.getMinimum(),
!Optional.ofNullable(items.getExclusiveMinimum()).orElse(Boolean.FALSE),
Optional.ofNullable(items.getExclusiveMinimum()).orElse(Boolean.FALSE),
items.getMaximum(),
!Optional.ofNullable(items.getExclusiveMaximum()).orElse(Boolean.FALSE));
Optional.ofNullable(items.getExclusiveMaximum()).orElse(Boolean.FALSE));
}
if (items.getMinimum() != null) {
return String.format(Locale.ROOT, "@DecimalMin( value = \"%s\", inclusive = %s)",
items.getMinimum(),
!Optional.ofNullable(items.getExclusiveMinimum()).orElse(Boolean.FALSE));
Optional.ofNullable(items.getExclusiveMinimum()).orElse(Boolean.FALSE));
}
if (items.getMaximum() != null) {
return String.format(Locale.ROOT, "@DecimalMax( value = \"%s\", inclusive = %s)",
items.getMaximum(),
!Optional.ofNullable(items.getExclusiveMaximum()).orElse(Boolean.FALSE));
Optional.ofNullable(items.getExclusiveMaximum()).orElse(Boolean.FALSE));
}
return "";
@@ -1289,9 +1287,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return localDate.toString();
}
if (ModelUtils.isArraySchema(schema)) {
// swagger-parser parses the default value differently depending on whether it's in a referenced file or not.
// cf. https://github.com/swagger-api/swagger-parser/issues/1958
// ArrayList if in the referenced file, ArrayNode if not.
if (defaultValue instanceof ArrayNode) {
ArrayNode array = (ArrayNode) defaultValue;
return StreamSupport.stream(array.spliterator(), false)
@@ -1300,11 +1295,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
.map(item -> StringUtils.removeStart(item, "\""))
.map(item -> StringUtils.removeEnd(item, "\""))
.collect(Collectors.joining(","));
} else if (defaultValue instanceof ArrayList) {
ArrayList<?> array = (ArrayList<?>) defaultValue;
return array.stream()
.map(Object::toString)
.collect(Collectors.joining(","));
}
}
// escape quotes
@@ -1687,22 +1677,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
}
}
// parse lombok additional model type annotations
Map<String, Boolean> lombokOptions = new HashMap<>();
String regexp = "@lombok.(\\w+\\.)*(?<ClassName>\\w+)(\\(.*?\\))?";
Pattern pattern = Pattern.compile(regexp);
for (String annotation : additionalModelTypeAnnotations) {
Matcher matcher = pattern.matcher(annotation);
if (matcher.find()) {
String className = matcher.group("ClassName");
lombokOptions.put(className, true);
}
}
if (!lombokOptions.isEmpty()) {
lombokAnnotations = lombokOptions;
writePropertyBack(LOMBOK, lombokOptions);
}
return postProcessModelsEnum(objs);
}

View File

@@ -937,7 +937,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
if (!model.allOf.isEmpty()) { // allOf
for (CodegenProperty cp : model.allVars) {
if (!cp.isPrimitiveType || cp.isModel) {
if (cp.isArray || cp.isMap){ // if array or map
if (cp.isArray){ // if array
modelImports.add(cp.items.dataType);
}else{ // if model
modelImports.add(cp.getDataType());
@@ -1244,11 +1244,11 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
if (!StringUtils.isEmpty(operation.returnType)) {
// Not interested in the result, only in the update of the imports
getPydanticType(
operation.returnProperty,
operation.returnProperty,
modelImports,
exampleImports,
exampleImports,
postponedModelImports,
postponedExampleImports,
postponedExampleImports,
null
);
}
@@ -1271,7 +1271,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
}
operation.vendorExtensions.put("x-py-example-import", imports);
}
// Remove constant params from allParams list and add to constantParams
handleConstantParams(operation);
}

View File

@@ -889,7 +889,7 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
if (!model.allOf.isEmpty()) { // allOf
for (CodegenProperty cp : model.allVars) {
if (!cp.isPrimitiveType || cp.isModel) {
if (cp.isArray || cp.isMap){ // if array or map
if (cp.isArray){ // if array
modelImports.add(cp.items.dataType);
}else{ // if model
modelImports.add(cp.dataType);

View File

@@ -129,9 +129,6 @@ public abstract class CppQtAbstractCodegen extends AbstractCppCodegen implements
systemIncludes.add("QDate");
systemIncludes.add("QDateTime");
systemIncludes.add("QByteArray");
reservedWords.add("signals");
reservedWords.add("slots");
}
@Override

View File

@@ -120,9 +120,6 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
typeMapping.put("AnyType", "QJsonValue");
importMapping.put(PREFIX + "HttpFileElement", "#include \"" + PREFIX + "HttpFileElement.h\"");
importMapping.put("QJsonValue", "#include <QJsonValue>");
reservedWords.add("valid");
reservedWords.add("set");
}
@Override

View File

@@ -500,9 +500,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
}
if (model.hasRequired) {
if (!model.isAdditionalPropertiesTrue &&
(model.oneOf == null || model.oneOf.isEmpty()) &&
(model.anyOf == null || model.anyOf.isEmpty())) {
if (!model.isAdditionalPropertiesTrue) {
imports.add(createMapping("import", "bytes"));
}

View File

@@ -203,10 +203,11 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")
.doNotOverwrite());
}
supportingFiles.add(new SupportingFile("RestApplication.mustache",
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestApplication.java")
if (!interfaceOnly) {
supportingFiles.add(new SupportingFile("RestApplication.mustache",
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestApplication.java")
.doNotOverwrite());
}
if(StringUtils.isNotEmpty(openApiSpecFileLocation)) {
int index = openApiSpecFileLocation.lastIndexOf('/');

View File

@@ -99,12 +99,6 @@ public class PhpDataTransferClientCodegen extends AbstractPhpCodegen {
// remove these from primitive types to make the output works
languageSpecificPrimitives.remove("\\DateTime");
languageSpecificPrimitives.remove("\\SplFileObject");
// fix date and date-time mapping to support both DateTime and DateTimeImmutable
typeMapping.put("date", "\\DateTimeInterface");
typeMapping.put("Date", "\\DateTimeInterface");
typeMapping.put("DateTime", "\\DateTimeInterface");
// TODO provide proper support for "file" string format
typeMapping.put("file", "string");
apiTemplateFiles.clear();
apiTestTemplateFiles.clear();
@@ -114,7 +108,7 @@ public class PhpDataTransferClientCodegen extends AbstractPhpCodegen {
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, "1.0.0");
//Register custom CLI options
addSwitch(OPT_MODERN, "use modern language features (generated code will require PHP 8.1)", useModernSyntax);
addSwitch(OPT_MODERN, "use modern language features (generated code will require PHP 8.0)", useModernSyntax);
}
@Override
@@ -159,26 +153,13 @@ public class PhpDataTransferClientCodegen extends AbstractPhpCodegen {
return super.toApiName(toModelName(name));
}
@Override
public String toRegularExpression(String pattern) {
String result = super.toRegularExpression(pattern);
if ((result != null) && (!useModernSyntax)) {
//Doctrine Annotations have different string escape rules compared to PHP code
result = result
.replace("\\\\", "\\")
.replace("\\\"", "\"\"")
;
}
return result;
}
@Override
public String getTypeDeclaration(Schema p) {
String result;
Map<String, Object> extensions = p.getExtensions();
if ((extensions != null) && extensions.containsKey(VEN_CONTAINER_DATA_TYPE)) {
result = (String) extensions.get(VEN_CONTAINER_DATA_TYPE);
} else if (ModelUtils.isArraySchema(p) || ModelUtils.isMapSchema(p)) {
} else if (useModernSyntax && (ModelUtils.isArraySchema(p) || ModelUtils.isMapSchema(p))) {
result = "array";
} else {
result = super.getTypeDeclaration(p);

View File

@@ -582,6 +582,28 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
p.dataType = "super::" + p.dataType;
}
}*/
// {{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}
for (CodegenParameter p : operation.allParams) {
String paramDataType = p.dataType;
if (p.isString || p.isUuid) {
paramDataType = "&str";
}
if (p.isEnumRef || p.isModel) {
paramDataType = "crate::models::" + p.dataType;
}
//if (p.isArray) {
// paramDataType = "Vec<" + paramDataType + ">";
//}
if (!p.required || p.isNullable) {
paramDataType = "Option<" + paramDataType + ">";
}
p.vendorExtensions.put("x-rust-data-type", paramDataType);
}
}
return objs;

View File

@@ -61,7 +61,6 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
public static final String PROVIDED_IN = "providedIn";
public static final String ENFORCE_GENERIC_MODULE_WITH_PROVIDERS = "enforceGenericModuleWithProviders";
public static final String HTTP_CONTEXT_IN_OPTIONS = "httpContextInOptions";
public static final String HTTP_TRANSFER_CACHE_IN_OPTIONS = "httpTransferCacheInOptions";
public static final String API_MODULE_PREFIX = "apiModulePrefix";
public static final String CONFIGURATION_PREFIX = "configurationPrefix";
public static final String SERVICE_SUFFIX = "serviceSuffix";
@@ -73,7 +72,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
public static final String STRING_ENUMS_DESC = "Generate string enums instead of objects for enum values.";
public static final String QUERY_PARAM_OBJECT_FORMAT = "queryParamObjectFormat";
protected String ngVersion = "17.0.0";
protected String ngVersion = "16.1.2";
protected String npmRepository = null;
private boolean useSingleRequestParameter = false;
protected String serviceSuffix = "Service";
@@ -153,7 +152,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
@Override
public String getHelp() {
return "Generates a TypeScript Angular (9.x - 17.x) client library.";
return "Generates a TypeScript Angular (9.x - 16.x) client library.";
}
@Override
@@ -227,10 +226,6 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
additionalProperties.put(HTTP_CONTEXT_IN_OPTIONS, true);
}
if (ngVersion.atLeast("17.0.0")) {
additionalProperties.put(HTTP_TRANSFER_CACHE_IN_OPTIONS, true);
}
additionalProperties.put(NG_VERSION, ngVersion);
if (additionalProperties.containsKey(API_MODULE_PREFIX)) {
@@ -288,9 +283,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
// Set the typescript version compatible to the Angular version
// based on https://angular.io/guide/versions#actively-supported-versions
if (ngVersion.atLeast("17.0.0")) {
additionalProperties.put("tsVersion", ">=4.9.3 <5.3.0");
} else if (ngVersion.atLeast("16.1.0")) {
if (ngVersion.atLeast("16.1.0")) {
additionalProperties.put("tsVersion", ">=4.9.3 <5.2.0");
} else if (ngVersion.atLeast("16.0.0")) {
additionalProperties.put("tsVersion", ">=4.9.3 <5.1.0");
@@ -313,9 +306,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
}
// Set the rxJS version compatible to the Angular version
if (ngVersion.atLeast("17.0.0")) {
additionalProperties.put("rxjsVersion", "7.4.0");
} else if (ngVersion.atLeast("16.0.0")) {
if (ngVersion.atLeast("16.0.0")) {
additionalProperties.put("rxjsVersion", "7.4.0");
} else if (ngVersion.atLeast("15.0.0")) {
additionalProperties.put("rxjsVersion", "7.5.5");
@@ -332,11 +323,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
supportingFiles.add(new SupportingFile("ng-package.mustache", getIndexDirectory(), "ng-package.json"));
// Specific ng-packagr configuration
if (ngVersion.atLeast("17.0.0")) {
additionalProperties.put("ngPackagrVersion", "17.0.3");
// tsTickle is not required and there is no available version compatible with
// versions of TypeScript compatible with Angular 17.
} else if (ngVersion.atLeast("16.0.0")) {
if (ngVersion.atLeast("16.0.0")) {
additionalProperties.put("ngPackagrVersion", "16.0.0");
// tsTickle is not required and there is no available version compatible with
// versions of TypeScript compatible with Angular 16.
@@ -365,9 +352,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
}
// set zone.js version
if (ngVersion.atLeast("17.0.0")) {
additionalProperties.put("zonejsVersion", "0.14.0");
} else if (ngVersion.atLeast("16.0.0")) {
if (ngVersion.atLeast("16.0.0")) {
additionalProperties.put("zonejsVersion", "0.13.0");
} else if (ngVersion.atLeast("15.0.0")) {
additionalProperties.put("zonejsVersion", "0.11.5");

View File

@@ -226,11 +226,6 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
for (ModelMap mo : models) {
CodegenModel cm = mo.getModel();
// Type is already any
if (cm.getAdditionalPropertiesIsAnyType() && "any".equals(cm.getAdditionalPropertiesType())) {
cm.setAdditionalPropertiesIsAnyType(false);
}
// Deduce the model file name in kebab case
cm.classFilename = cm.classname.replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(Locale.ROOT);

View File

@@ -884,17 +884,6 @@ public class ModelUtils {
return unaliasedSchema.get$ref() != null;
}
public static boolean shouldGenerateMapModel(Schema schema) {
// A composed schema (allOf, oneOf, anyOf) is considered a Map schema if the additionalproperties attribute is set
// for that composed schema. However, in the case of a composed schema, the properties are defined or referenced
// in the inner schemas, and the outer schema does not have properties.
return ModelUtils.isGenerateAliasAsModel(schema) || ModelUtils.isComposedSchema(schema) || !(schema.getProperties() == null || schema.getProperties().isEmpty());
}
public static boolean shouldGenerateArrayModel(Schema schema) {
return ModelUtils.isGenerateAliasAsModel(schema) || !(schema.getProperties() == null || schema.getProperties().isEmpty());
}
/**
* If a Schema contains a reference to another Schema with '$ref', returns the referenced Schema if it is found or the actual Schema in the other cases.
*

View File

@@ -7,8 +7,6 @@ import java.util.List;
{{>generatedAnnotation}}
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -260,20 +260,11 @@
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind-version}</version>
</dependency>
{{^useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
{{/useJakartaEe}}
{{#useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
{{/useJakartaEe}}
{{#withXml}}
<!-- XML processing: Jackson -->

View File

@@ -14,8 +14,6 @@ import java.util.TreeMap;
*/
{{>generatedAnnotation}}
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -14,8 +14,6 @@ import java.util.TreeMap;
*/
{{>generatedAnnotation}}
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -27,9 +27,9 @@ public class JSON {
public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING)

View File

@@ -6,8 +6,6 @@ import java.net.http.HttpHeaders;
{{>generatedAnnotation}}
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
private static final long serialVersionUID = 1L;
private int code = 0;
private HttpHeaders responseHeaders = null;
private String responseBody = null;

View File

@@ -16,8 +16,6 @@ import java.util.TreeMap;
@SuppressWarnings("serial")
{{>generatedAnnotation}}
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -534,12 +534,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
else if (entry.getValue() instanceof Character)
obj.addProperty(entry.getKey(), (Character) entry.getValue());
else {
JsonElement jsonElement = gson.toJsonTree(entry.getValue());
if (jsonElement.isJsonArray()) {
obj.add(entry.getKey(), jsonElement.getAsJsonArray());
} else {
obj.add(entry.getKey(), jsonElement.getAsJsonObject());
}
obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
}
}
}

View File

@@ -261,20 +261,11 @@
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind-version}</version>
</dependency>
{{^useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
{{/useJakartaEe}}
{{#useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
{{/useJakartaEe}}
{{#openApiNullable}}
<dependency>
<groupId>org.openapitools</groupId>
@@ -313,23 +304,6 @@
<version>${jodatime-version}</version>
</dependency>
{{/joda}}
{{#useBeanValidation}}
<!-- Bean Validation API support -->
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/useBeanValidation}}
{{#performBeanValidation}}
<!-- Bean Validation Impl. used to perform BeanValidation -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator-version}</version>
</dependency>
{{/performBeanValidation}}
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
@@ -373,12 +347,6 @@
{{#joda}}
<jodatime-version>2.9.9</jodatime-version>
{{/joda}}
{{#useBeanValidation}}
<beanvalidation-version>2.0.2</beanvalidation-version>
{{/useBeanValidation}}
{{#performBeanValidation}}
<hibernate-validator-version>5.4.3.Final</hibernate-validator-version>
{{/performBeanValidation}}
<junit-version>4.13.2</junit-version>
</properties>
</project>

View File

@@ -8,8 +8,6 @@ import io.vertx.core.MultiMap;
{{>generatedAnnotation}}
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
private static final long serialVersionUID = 1L;
private int code = 0;
private MultiMap responseHeaders = null;
private String responseBody = null;

View File

@@ -265,20 +265,11 @@
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind-version}</version>
</dependency>
{{^useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
{{/useJakartaEe}}
{{#useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
{{/useJakartaEe}}
{{#withXml}}
<!-- XML processing: Jackson -->

View File

@@ -3,10 +3,5 @@ import {{javaxPackage}}.xml.bind.annotation.XmlType;
import {{javaxPackage}}.xml.bind.annotation.XmlEnum;
import {{javaxPackage}}.xml.bind.annotation.XmlEnumValue;
{{/withXml}}
{{#jackson}}
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonProperty;
{{/jackson}}
{{>enumClass}}

View File

@@ -174,22 +174,12 @@ for this project used jakarta.validation-api -->
<version>${cxf-version}</version>
<scope>compile</scope>
</dependency>
{{^useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson-jaxrs-version}</version>
<scope>compile</scope>
</dependency>
{{/useJakartaEe}}
{{#useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
<version>${jackson-jaxrs-version}</version>
<scope>compile</scope>
</dependency>
{{/useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>

View File

@@ -189,22 +189,12 @@ for this project used jakarta.validation-api -->
<version>${cxf-version}</version>
<scope>compile</scope>
</dependency>
{{^useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson-jaxrs-version}</version>
<scope>compile</scope>
</dependency>
{{/useJakartaEe}}
{{#useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
<version>${jackson-jaxrs-version}</version>
<scope>compile</scope>
</dependency>
{{/useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>

View File

@@ -11,7 +11,6 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
{{#imports}}import {{import}};
@@ -80,11 +79,7 @@ public class {{classname}} {
@ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}", content =
@Content(schema = @Schema(implementation = {{{baseType}}}.class))),
{{/responses}}
}{{#hasAuthMethods}},security = {
{{#authMethods}}
@SecurityRequirement(name = "{{name}}"{{#scopes.0}}, scopes={ {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} }{{/scopes.0}}){{^-last}},{{/-last}}
{{/authMethods}}
}{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} })
}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} })
public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}}@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.{{nickname}}({{#allParams}}{{#isFormParam}}{{#isFile}}{{paramName}}Bodypart{{/isFile}}{{/isFormParam}}{{^isFile}}{{paramName}}{{/isFile}}{{^isFormParam}}{{#isFile}}{{paramName}}{{/isFile}}{{/isFormParam}}, {{/allParams}}securityContext);

View File

@@ -20,9 +20,6 @@ import java.util.List;
{{#useBeanValidation}}import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;{{/useBeanValidation}}
/**
* Represents a collection of functions to interact with the API endpoints.
*/
@Path("{{commonPath}}"){{#useSwaggerAnnotations}}
@Api(description = "the {{{baseName}}} API"){{/useSwaggerAnnotations}}{{#hasConsumes}}
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
@@ -35,4 +32,4 @@ public {{#interfaceOnly}}interface{{/interfaceOnly}}{{^interfaceOnly}}class{{/in
{{#interfaceOnly}}{{>apiInterface}}{{/interfaceOnly}}{{^interfaceOnly}}{{>apiMethod}}{{/interfaceOnly}}
{{/operation}}
}
{{/operations}}
{{/operations}}

View File

@@ -1,13 +1,3 @@
/**
* {{{notes}}}
*
{{#allParams}}
* @param {{paramName}} {{description}}
{{/allParams}}
{{#responses}}
* @return {{{message}}}
{{/responses}}
*/
@{{httpMethod}}{{#subresourceOperation}}
@Path("{{{path}}}"){{/subresourceOperation}}{{#hasConsumes}}
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}

View File

@@ -79,20 +79,11 @@
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-version}</version>
</dependency>
{{^useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
{{/useJakartaEe}}
{{#useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
{{/useJakartaEe}}
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>

View File

@@ -5,11 +5,6 @@
{{#gson}}
{{#allowableValues}}
{{#enumVars}}
{{#enumDescription}}
/**
* {{.}}
*/
{{/enumDescription}}
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
{{{name}}}({{{value}}}){{^-last}},
{{/-last}}{{#-last}};{{/-last}}
@@ -19,11 +14,6 @@
{{^gson}}
{{#allowableValues}}
{{#enumVars}}
{{#enumDescription}}
/**
* {{.}}
*/
{{/enumDescription}}
{{{name}}}({{{value}}}){{^-last}},
{{/-last}}{{#-last}};{{/-last}}
{{/enumVars}}

View File

@@ -11,22 +11,12 @@ import com.fasterxml.jackson.annotation.JsonValue;
public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
{{#gson}}
{{#allowableValues}}{{#enumVars}}
{{#enumDescription}}
/**
* {{.}}
*/
{{/enumDescription}}
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
{{{name}}}({{{value}}}){{^-last}},
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
{{/gson}}
{{^gson}}
{{#allowableValues}}{{#enumVars}}
{{#enumDescription}}
/**
* {{.}}
*/
{{/enumDescription}}
{{{name}}}({{{value}}}){{^-last}},
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
{{/gson}}

View File

@@ -62,19 +62,11 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
{{#classifier}}
<configuration>
{{#classifier}}
<classifier>{{{classifier}}}</classifier>
{{/classifier}}
{{#lombok}}
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
{{/lombok}}
</configuration>
{{/classifier}}
</plugin>
{{#apiFirst}}
<plugin>
@@ -225,13 +217,6 @@
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
{{/hateoas}}
{{#lombok}}
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
{{/lombok}}
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>

View File

@@ -55,19 +55,11 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
{{#classifier}}
<configuration>
<classifier>{{{classifier}}}</classifier>
{{/classifier}}
{{#lombok}}
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
{{/lombok}}
</configuration>
{{/classifier}}
</plugin>
{{#apiFirst}}
<plugin>
@@ -235,13 +227,6 @@
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
{{/hateoas}}
{{#lombok}}
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
{{/lombok}}
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>

View File

@@ -130,13 +130,6 @@
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
{{/hateoas}}
{{#lombok}}
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
{{/lombok}}
{{#useBeanValidation}}
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@@ -146,13 +146,6 @@
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
{{/hateoas}}
{{#lombok}}
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
{{/lombok}}
{{#useBeanValidation}}
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@@ -89,13 +89,6 @@
<version>0.2.6</version>
</dependency>
{{/openApiNullable}}
{{#lombok}}
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
{{/lombok}}
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

View File

@@ -51,14 +51,6 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
{{#gson}}
@SerializedName("{{baseName}}")
{{/gson}}
{{#lombok}}
{{#required}}
@lombok.NonNull
{{/required}}
{{#isPassword}}
@lombok.ToString.Exclude
{{/isPassword}}
{{/lombok}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
@@ -89,17 +81,13 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
{{/openApiNullable}}
{{/isContainer}}
{{/vars}}
{{^lombok.Data}}
{{^lombok.RequiredArgsConstructor}}
{{#generatedConstructorWithRequiredArgs}}
{{#hasRequired}}
{{^lombok.NoArgsConstructor}}
public {{classname}}() {
super();
}
{{/lombok.NoArgsConstructor}}
/**
* Constructor with only required parameters
*/
@@ -120,10 +108,7 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
}
{{/hasRequired}}
{{/generatedConstructorWithRequiredArgs}}
{{/lombok.RequiredArgsConstructor}}
{{/lombok.Data}}
{{#vars}}
{{^lombok.Data}}
{{! begin feature: fluent setter methods }}
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
@@ -173,7 +158,6 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
{{/isMap}}
{{! end feature: fluent setter methods }}
{{! begin feature: getter and setter }}
{{^lombok.Getter}}
/**
{{#description}}
@@ -220,9 +204,7 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
public {{>nullableDataTypeBeanValidation}} {{getter}}() {
return {{name}};
}
{{/lombok.Getter}}
{{^lombok.Setter}}
{{#deprecated}}
/**
* @deprecated
@@ -237,15 +219,11 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
public void {{setter}}({{>nullableDataType}} {{name}}) {
this.{{name}} = {{name}};
}
{{/lombok.Setter}}
{{/lombok.Data}}
{{! end feature: getter and setter }}
{{/vars}}
{{>additionalProperties}}
{{^lombok.Data}}
{{#parentVars}}
{{^lombok.Setter}}
{{! begin feature: fluent setter methods for inherited properties }}
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
super.{{name}}({{name}});
@@ -265,10 +243,8 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
return this;
}
{{/isMap}}
{{/lombok.Setter}}
{{! end feature: fluent setter methods for inherited properties }}
{{/parentVars}}
{{^lombok.EqualsAndHashCode}}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -300,9 +276,7 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
{{/lombok.EqualsAndHashCode}}
{{^lombok.ToString}}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -327,6 +301,4 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
}
return o.toString().replace("\n", "\n ");
}
{{/lombok.ToString}}
{{/lombok.Data}}
}

View File

@@ -64,7 +64,7 @@ class {{classname}} {{#parent}}{{^parentModel}}{{#vendorExtensions.x-is-array}}e
{{#-first}}
// check to make sure all required properties are present in the JSON string
for (const property of {{classname}}.RequiredProperties) {
if (!data.hasOwnProperty(property)) {
if (!data[property]) {
throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
}
}

View File

@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.5)
project({{{packageName}}})
set(CMAKE_AUTOMOC ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Network Gui)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Network Gui)
include(GNUInstallDirs)

View File

@@ -197,30 +197,6 @@ inline FString CollectionToUrlString_multi(const TArray<T>& Collection, const TC
return Output;
}
template <typename T>
inline FString CollectionToUrlString_multi(const TSet<T>& Collection, const TCHAR* BaseName)
{
FString Output;
if (Collection.Num() == 0)
{
return Output;
}
int32 Index = 0;
for (typename TSet<T>::TConstIterator Iter = Collection.CreateConstIterator(); Iter; ++Iter)
{
if (Index == 0)
{
Output += FString::Format(TEXT("{0}={1}"), { FStringFormatArg(BaseName), ToUrlString(*Iter) });
Index++;
continue;
}
Output += FString::Format(TEXT("&{0}={1}"), { FStringFormatArg(BaseName), ToUrlString(*Iter) });
}
return Output;
}
//////////////////////////////////////////////////////////////////////////
inline void WriteJsonValue(JsonWriter& Writer, const TSharedPtr<FJsonValue>& Value)

View File

@@ -397,7 +397,7 @@ namespace {{packageName}}.{{apiPackage}}
{{/isArray}}
{{/isFile}}
{{^isFile}}
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.{{#isPrimitiveType}}ParameterToString{{/isPrimitiveType}}{{^isPrimitiveType}}Serialize{{/isPrimitiveType}}({{paramName}})); // form parameter
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
{{/isFile}}
}
{{/required}}
@@ -647,7 +647,7 @@ namespace {{packageName}}.{{apiPackage}}
{{/isArray}}
{{/isFile}}
{{^isFile}}
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.{{#isPrimitiveType}}ParameterToString{{/isPrimitiveType}}{{^isPrimitiveType}}Serialize{{/isPrimitiveType}}({{paramName}})); // form parameter
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
{{/isFile}}
{{/required}}
{{^required}}
@@ -669,7 +669,7 @@ namespace {{packageName}}.{{apiPackage}}
{{/isArray}}
{{/isFile}}
{{^isFile}}
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.{{#isPrimitiveType}}ParameterToString{{/isPrimitiveType}}{{^isPrimitiveType}}Serialize{{/isPrimitiveType}}({{paramName}})); // form parameter
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
{{/isFile}}
}
{{/required}}

View File

@@ -21,11 +21,7 @@ type Route struct {
// NewRouter returns a new router.
func NewRouter(handleFunctions ApiHandleFunctions) *gin.Engine {
return NewRouterWithGinEngine(gin.Default(), handleFunctions)
}
// NewRouter add routes to existing gin engine.
func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine {
router := gin.Default()
for _, route := range getRoutes(handleFunctions) {
if route.HandlerFunc == nil {
route.HandlerFunc = DefaultHandleFunc

View File

@@ -311,7 +311,7 @@ func NewNullableTime(val *time.Time) *NullableTime {
}
func (v NullableTime) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
return v.value.MarshalJSON()
}
func (v *NullableTime) UnmarshalJSON(src []byte) error {

View File

@@ -19,8 +19,6 @@ public class RestConfiguration extends RouteBuilder {
.component("{{camelRestComponent}}")
.bindingMode(RestBindingMode.{{camelRestBindingMode}}){{#camelDataformatProperties}}
.dataFormatProperty("{{key}}", "{{value}}"){{/camelDataformatProperties}}
.clientRequestValidation({{camelRestClientRequestValidation}})
.apiProperty("api.title", "{{appName}}")
.apiProperty("api.version", "{{appVersion}}");
.clientRequestValidation({{camelRestClientRequestValidation}});
}
}
}

View File

@@ -61,20 +61,11 @@
<artifactId>jackson-datatype-joda</artifactId>
<version>${jackson-version}</version>
</dependency>
{{^useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson-version}</version>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
{{/useJakartaEe}}
{{#useJakartaEe}}
<dependency>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
{{/useJakartaEe}}
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>

View File

@@ -44,17 +44,7 @@ class ApiClient extends OAGAC\AbstractApiClient
$request = $this->addCookies($request, $parameters);
{{/cookieParams.0}}
{{#bodyParam}}
{{#isDate}}
$request = $this->addBody($request, $requestMediaType, $requestContent, ($this->contentStrategies)('Date', []));
{{/isDate}}
{{#isDateTime}}
$request = $this->addBody($request, $requestMediaType, $requestContent, ($this->contentStrategies)('DateTime', []));
{{/isDateTime}}
{{^isDate}}
{{^isDateTime}}
$request = $this->addBody($request, $requestMediaType, $requestContent);
{{/isDateTime}}
{{/isDate}}
{{/bodyParam}}
{{#hasProduces}}
$request = $this->addAcceptHeader($request, $responseMediaType);
@@ -78,8 +68,6 @@ class ApiClient extends OAGAC\AbstractApiClient
{
$response = $this->{{operationId}}Raw({{>api_arg_call}});
$responseContent = null;
$contentStrategy = null;
$contentValidator = null;
switch ($response->getStatusCode())
{
{{#responses}}
@@ -87,35 +75,25 @@ class ApiClient extends OAGAC\AbstractApiClient
{{#message}}
/* {{&message}} */
{{/message}}
{{#isArray}}
$responseContent = new {{dataType}}();
{{/isArray}}
{{#isMap}}
$responseContent = new {{dataType}}();
{{/isMap}}
{{#isDate}}
$contentStrategy = ($this->contentStrategies)('Date', []);
$contentValidator = ($this->contentValidators)('Date', []);
{{/isDate}}
{{#isDateTime}}
$contentStrategy = ($this->contentStrategies)('DateTime', []);
$contentValidator = ($this->contentValidators)('DateTime', []);
{{/isDateTime}}
{{^isDate}}
{{^isDateTime}}
{{^isArray}}
{{^isMap}}
{{#isModel}}
$responseContent = new {{dataType}}();
{{/isModel}}
{{^isModel}}
{{#isArray}}
$responseContent = new {{dataType}}();
{{/isArray}}
{{/isModel}}
{{^isModel}}
{{^isArray}}
{{#isMap}}
$responseContent = new {{dataType}}();
{{/isMap}}
{{/isArray}}
{{/isDateTime}}
{{/isDate}}
{{/isModel}}
break;
{{/responses}}
}
$this->parseBody($response, $responseContent, $contentStrategy, $contentValidator);
$this->parseBody($response, $responseContent);
return [$responseContent, $response->getHeaders(), $response->getStatusCode(), $response->getReasonPhrase()];
}

View File

@@ -3,20 +3,18 @@ declare(strict_types=1);
namespace {{invokerPackage}};
use Articus\PluginManager as PM;
use Articus\DataTransfer as DT;
use Interop\Container\ContainerInterface;
use OpenAPIGenerator\APIClient as OAGAC;
use Psr\Container\ContainerInterface;
class ApiClientFactory implements PM\ServiceFactoryInterface
class ApiClientFactory extends DT\ConfigAwareFactory
{
use PM\ConfigAwareFactoryTrait;
public function __construct(string $configKey = ApiClient::class)
{
$this->configKey = $configKey;
parent::__construct($configKey);
}
public function __invoke(ContainerInterface $container, $requestedName, array $options = null): ApiClient
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$config = new OAGAC\ApiClientOptions(\array_merge($this->getServiceConfig($container), $options ?? []));
return new ApiClient(
@@ -26,9 +24,7 @@ class ApiClientFactory implements PM\ServiceFactoryInterface
$container->get($config->httpClientServiceName),
$container->get($config->securityProviderFactoryServiceName),
$container->get($config->bodyCoderFactoryServiceName),
$container->get($config->bodyCoderFactoryServiceName),
$container->get($config->contentStrategyFactoryServiceName),
$container->get($config->contentValidatorFactoryServiceName)
$container->get($config->bodyCoderFactoryServiceName)
);
}
}

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