Compare commits

..

25 Commits

Author SHA1 Message Date
William Cheng
663ae41ad3 Merge branch 'patch-1' of https://github.com/aronkankel/openapi-generator into aronkankel-patch-1 2024-01-29 19:39:22 +08:00
Paul Horton
5055ebade9 fix: ensure models that have variables that contain a complexType of time.Time import the time module (#17452)
* fix: handle variables that have items that contain a complexType of `time.Time` properly

Signed-off-by: Paul Horton <phorton@sonatype.com>

* chore: trigger new CI runs

Signed-off-by: Paul Horton <phorton@sonatype.com>

* test: added test change an regenerated samples

Signed-off-by: Paul Horton <phorton@sonatype.com>

* resolved merge issues with upstream main

Signed-off-by: Paul Horton <phorton@sonatype.com>

* regenerated samples

Signed-off-by: Paul Horton <phorton@sonatype.com>

---------

Signed-off-by: Paul Horton <phorton@sonatype.com>
2024-01-28 11:36:05 +08:00
dmbakker
9952776e9c [java] fix Use jackson-jakarta-rs-json-provider when useJakartaEe is true (#17600)
* fix #17590 - use jackson-jakarta-rs-json-provider instead of jackson-jaxrs-json-provider in pom when useJakartaEe is true

* fix #17590 - fix indentation

* fix #17590 - updated samples

* fix #17590 - fixed groupid

---------

Co-authored-by: in376bak <dennis.bakker@duo.nl>
2024-01-28 00:38:18 +08:00
Tobias
8f441689f7 [JavaSpring] Add Javadoc to enum (x-enum-descriptions) (#14123)
refs #1693
2024-01-27 23:49:11 +08:00
Antoine Reilles
17473a035b make sure the imports are present for enum, if using jackson (#15123) 2024-01-27 23:29:18 +08:00
dabdirb
66a6af5ca4 add lombok model support on spring (#17622)
* add lombok model support on spring

* use regex to adapt annotation with parenthesis

* add ut case

* add samples

* add samples

* fix github workflow

* fix github workflow
2024-01-27 10:45:44 +08:00
Jesenko Mehmedbasic
a092bbd83b [BUG] [Java] Remove deprecation and serial warnings in ApiException.java and JSON.java (#17716)
* Add serialVersionUID to Java apiException.mustache templates

* Use 'enable()' and 'disable()' methods to handle object mapper features in JSON.mustache for the "native" Java generator instead of the deprecated 'configure()'

* Update samples
2024-01-27 10:42:27 +08:00
Jesenko Mehmedbasic
0a0428b89c Add JavaDoc to api and apiInterface templates for the JavaJaxRS spec generator (#17705)
* Add javadoc to api and apiInterface templates for JavaJaxRS/spec.

* Updated samples with javadoc change.
2024-01-27 10:40:37 +08:00
roseatromero
d152f4d995 [cpp-ue4] Fix generated code not compiling when using unique array items (#17684)
* Add CollectionToUrlString for TSet

Added a template for converting collection to url string parameters for associative container

* Add generated samples

* Add TSet template

* Fix iterator
2024-01-27 10:32:40 +08:00
dependabot[bot]
aa15ef9ab9 Bump eskatos/gradle-command-action from 2 to 3 (#17719)
Bumps [eskatos/gradle-command-action](https://github.com/eskatos/gradle-command-action) from 2 to 3.
- [Release notes](https://github.com/eskatos/gradle-command-action/releases)
- [Commits](https://github.com/eskatos/gradle-command-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: eskatos/gradle-command-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-27 10:02:40 +08:00
dependabot[bot]
ad73e115d9 Bump gradle/gradle-build-action from 2 to 3 (#17720)
Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 2 to 3.
- [Release notes](https://github.com/gradle/gradle-build-action/releases)
- [Commits](https://github.com/gradle/gradle-build-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: gradle/gradle-build-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-27 10:02:18 +08:00
Aron
ef94ee7a9f Merge pull request #1 from aronkankel/master
Fix for generated files
2024-01-26 16:50:45 +01:00
Aron
212dfb899b Merge branch 'OpenAPITools:master' into master 2024-01-26 16:44:17 +01:00
Aron
fe2ca3abb2 Merge branch 'OpenAPITools:master' into patch-1 2024-01-26 16:36:17 +01:00
Aron
9e1271fa83 FakeApi.cs generated based on new mustache
https://github.com/OpenAPITools/openapi-generator/issues/17699
2024-01-26 16:33:37 +01:00
Aron
159c86cafa FakeApi.cs generated based on new mustache
https://github.com/OpenAPITools/openapi-generator/issues/17699
2024-01-26 16:32:16 +01:00
Aron
0ab8c2c769 FakeApi.cs generated based on new mustache
https://github.com/OpenAPITools/openapi-generator/issues/17699
2024-01-26 16:30:50 +01:00
Aron
c6fbbfc2cb FakeApi.cs generated based on new mustache
https://github.com/OpenAPITools/openapi-generator/issues/17699
2024-01-26 16:29:16 +01:00
Aron
1bbd7c0f2f FakeApi.cs generated based on new mustache
https://github.com/OpenAPITools/openapi-generator/issues/17699
2024-01-26 16:27:30 +01:00
Aron
3aac4a8685 FakeApi.cs generated based on new mustache
https://github.com/OpenAPITools/openapi-generator/issues/17699
2024-01-26 16:25:58 +01:00
Aron
bb4b5034d3 MultipartApi.cs generated with new mustache
https://github.com/OpenAPITools/openapi-generator/issues/17699
2024-01-26 16:22:34 +01:00
Laith Hussein
a7439e456e feat(typescript-angular): add support for v17 of angular (#17685)
- Add support for `transferCache` property in request options

Refs: [#17301]

Co-authored-by: Laith Hussein <laith.hussein@beno.com>
2024-01-26 09:21:48 +01:00
William Cheng
96eb4a499a Add SSS Twitter to bronze sponsor (#17698)
* add SSS Twitter to the sponsor

* update url
2024-01-25 00:52:50 +08:00
Aron
592968e28e FormParameters correct handling for "isPrimitiveType"
https://github.com/OpenAPITools/openapi-generator/issues/17699
2024-01-24 17:51:19 +01:00
Tjeerd Verhagen
aaaf1e14c8 Fixes #17645 When interfaceOnly is true, RestApplication will be generated as well (#17646)
This class with the optional OpenAPIDefinition annotations is now generated always.
And no longer only when the interfaceOnly is set to false (default).
2024-01-24 21:37:10 +08:00
231 changed files with 12915 additions and 11085 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@v2
uses: eskatos/gradle-command-action@v3
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@v2
uses: eskatos/gradle-command-action@v3
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@v2
uses: eskatos/gradle-command-action@v3
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@v2
uses: eskatos/gradle-command-action@v3
with:
gradle-version: ${{ env.GRADLE_VERSION }}
build-root-directory: ${{ matrix.sample }}

View File

@@ -7,6 +7,8 @@ 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)
@@ -17,6 +19,9 @@ 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,6 +57,7 @@ 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

@@ -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@v2
uses: gradle/gradle-build-action@v3
- name: Gradle tests
run: |
gradle -b modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle buildGoSdk --stacktrace

View File

@@ -69,6 +69,7 @@ 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,6 +65,7 @@ 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)
#### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS, Checkly for sponsoring the API monitoring and Gradle for sponsoring Develocity
@@ -79,7 +80,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 - 16.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 - 17.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/) |

View File

@@ -0,0 +1,9 @@
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

@@ -0,0 +1,11 @@
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

@@ -0,0 +1,7 @@
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

@@ -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 - 16.x) client library. | |
| helpTxt | Generates a TypeScript Angular (9.x - 17.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)| |16.1.2|
|ngVersion|The version of Angular. (At least 9.0.0)| |17.0.0|
|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

@@ -748,10 +748,11 @@ 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.dataType)))) {
if (!addedTimeImport && ("time.Time".equals(cp.dataType) || (cp.items != null && "time.Time".equals(cp.items.complexType)))) {
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,6 +53,7 @@ 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;
@@ -89,7 +90,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";
@@ -128,6 +129,7 @@ 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;
@@ -1677,6 +1679,22 @@ 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

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

View File

@@ -582,28 +582,6 @@ 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,6 +61,7 @@ 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";
@@ -72,7 +73,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 = "16.1.2";
protected String ngVersion = "17.0.0";
protected String npmRepository = null;
private boolean useSingleRequestParameter = false;
protected String serviceSuffix = "Service";
@@ -152,7 +153,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
@Override
public String getHelp() {
return "Generates a TypeScript Angular (9.x - 16.x) client library.";
return "Generates a TypeScript Angular (9.x - 17.x) client library.";
}
@Override
@@ -226,6 +227,10 @@ 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)) {
@@ -283,7 +288,9 @@ 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("16.1.0")) {
if (ngVersion.atLeast("17.0.0")) {
additionalProperties.put("tsVersion", ">=4.9.3 <5.3.0");
} else 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");
@@ -306,7 +313,9 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
}
// Set the rxJS version compatible to the Angular version
if (ngVersion.atLeast("16.0.0")) {
if (ngVersion.atLeast("17.0.0")) {
additionalProperties.put("rxjsVersion", "7.4.0");
} else 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");
@@ -323,7 +332,11 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
supportingFiles.add(new SupportingFile("ng-package.mustache", getIndexDirectory(), "ng-package.json"));
// Specific ng-packagr configuration
if (ngVersion.atLeast("16.0.0")) {
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")) {
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.
@@ -352,7 +365,9 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
}
// set zone.js version
if (ngVersion.atLeast("16.0.0")) {
if (ngVersion.atLeast("17.0.0")) {
additionalProperties.put("zonejsVersion", "0.14.0");
} else 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

@@ -7,6 +7,8 @@ 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,11 +260,20 @@
<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,6 +14,8 @@ 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,6 +14,8 @@ 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)
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING)

View File

@@ -6,6 +6,8 @@ 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,6 +16,8 @@ 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

@@ -261,11 +261,20 @@
<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>

View File

@@ -8,6 +8,8 @@ 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,11 +265,20 @@
<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,5 +3,10 @@ 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,12 +174,22 @@ 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,12 +189,22 @@ 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

@@ -20,6 +20,9 @@ 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}}
@@ -32,4 +35,4 @@ public {{#interfaceOnly}}interface{{/interfaceOnly}}{{^interfaceOnly}}class{{/in
{{#interfaceOnly}}{{>apiInterface}}{{/interfaceOnly}}{{^interfaceOnly}}{{>apiMethod}}{{/interfaceOnly}}
{{/operation}}
}
{{/operations}}
{{/operations}}

View File

@@ -1,3 +1,13 @@
/**
* {{{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,11 +79,20 @@
<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,6 +5,11 @@
{{#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}}
@@ -14,6 +19,11 @@
{{^gson}}
{{#allowableValues}}
{{#enumVars}}
{{#enumDescription}}
/**
* {{.}}
*/
{{/enumDescription}}
{{{name}}}({{{value}}}){{^-last}},
{{/-last}}{{#-last}};{{/-last}}
{{/enumVars}}

View File

@@ -11,12 +11,22 @@ 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,11 +62,19 @@
<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>
@@ -217,6 +225,13 @@
<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,11 +55,19 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
{{#classifier}}
<configuration>
{{#classifier}}
<classifier>{{{classifier}}}</classifier>
</configuration>
{{/classifier}}
{{#lombok}}
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
{{/lombok}}
</configuration>
</plugin>
{{#apiFirst}}
<plugin>
@@ -227,6 +235,13 @@
<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,6 +130,13 @@
<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,6 +146,13 @@
<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,6 +89,13 @@
<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,6 +51,14 @@ 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}}
@@ -81,13 +89,17 @@ 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
*/
@@ -108,7 +120,10 @@ 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}}) {
@@ -158,6 +173,7 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
{{/isMap}}
{{! end feature: fluent setter methods }}
{{! begin feature: getter and setter }}
{{^lombok.Getter}}
/**
{{#description}}
@@ -204,7 +220,9 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
public {{>nullableDataTypeBeanValidation}} {{getter}}() {
return {{name}};
}
{{/lombok.Getter}}
{{^lombok.Setter}}
{{#deprecated}}
/**
* @deprecated
@@ -219,11 +237,15 @@ 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}});
@@ -243,8 +265,10 @@ 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) {
@@ -276,7 +300,9 @@ 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();
@@ -301,4 +327,6 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
}
return o.toString().replace("\n", "\n ");
}
{{/lombok.ToString}}
{{/lombok.Data}}
}

View File

@@ -197,6 +197,30 @@ 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.ParameterToString({{paramName}})); // form parameter
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.{{#isPrimitiveType}}ParameterToString{{/isPrimitiveType}}{{^isPrimitiveType}}Serialize{{/isPrimitiveType}}({{paramName}})); // form parameter
{{/isFile}}
}
{{/required}}
@@ -647,7 +647,7 @@ namespace {{packageName}}.{{apiPackage}}
{{/isArray}}
{{/isFile}}
{{^isFile}}
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.{{#isPrimitiveType}}ParameterToString{{/isPrimitiveType}}{{^isPrimitiveType}}Serialize{{/isPrimitiveType}}({{paramName}})); // form parameter
{{/isFile}}
{{/required}}
{{^required}}
@@ -669,7 +669,7 @@ namespace {{packageName}}.{{apiPackage}}
{{/isArray}}
{{/isFile}}
{{^isFile}}
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter
localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.{{#isPrimitiveType}}ParameterToString{{/isPrimitiveType}}{{^isPrimitiveType}}Serialize{{/isPrimitiveType}}({{paramName}})); // form parameter
{{/isFile}}
}
{{/required}}

View File

@@ -61,11 +61,20 @@
<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

@@ -90,7 +90,7 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration:
{{/vendorExtensions.x-group-parameters}}
{{^vendorExtensions.x-group-parameters}}
pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: &configuration::Configuration, {{#allParams}}{{{paramName}}}: {{{vendorExtensions.x-rust-data-type}}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>> {
pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: &configuration::Configuration, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}{{#isBodyParam}}crate::models::{{/isBodyParam}}{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>> {
let local_var_configuration = configuration;
{{/vendorExtensions.x-group-parameters}}

View File

@@ -173,10 +173,10 @@ export class {{classname}} {
* @deprecated
{{/isDeprecated}}
*/
public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: {{#produces}}'{{mediaType}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}}): Observable<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>;
public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: {{#produces}}'{{mediaType}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}}): Observable<HttpResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: {{#produces}}'{{mediaType}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}}): Observable<HttpEvent<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: {{#produces}}'{{mediaType}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}}): Observable<any> {
public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: {{#produces}}'{{mediaType}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}{{#httpTransferCacheInOptions}}, transferCache?: boolean{{/httpTransferCacheInOptions}}}): Observable<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>;
public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: {{#produces}}'{{mediaType}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}{{#httpTransferCacheInOptions}}, transferCache?: boolean{{/httpTransferCacheInOptions}}}): Observable<HttpResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: {{#produces}}'{{mediaType}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}{{#httpTransferCacheInOptions}}, transferCache?: boolean{{/httpTransferCacheInOptions}}}): Observable<HttpEvent<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: {{#produces}}'{{mediaType}}'{{^-last}} | {{/-last}}{{/produces}}{{^produces}}undefined{{/produces}},{{#httpContextInOptions}} context?: HttpContext{{/httpContextInOptions}}{{#httpTransferCacheInOptions}}, transferCache?: boolean{{/httpTransferCacheInOptions}}}): Observable<any> {
{{#allParams}}
{{#useSingleRequestParameter}}
const {{paramName}} = requestParameters.{{paramName}};
@@ -283,6 +283,13 @@ export class {{classname}} {
localVarHttpContext = new HttpContext();
}
{{/httpContextInOptions}}
{{#httpTransferCacheInOptions}}
let localVarTransferCache: boolean | undefined = options && options.transferCache;
if (localVarTransferCache === undefined) {
localVarTransferCache = true;
}
{{/httpTransferCacheInOptions}}
{{#bodyParam}}
{{- duplicated below, don't forget to change}}
@@ -395,6 +402,9 @@ export class {{classname}} {
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
{{#httpTransferCacheInOptions}}
transferCache: localVarTransferCache,
{{/httpTransferCacheInOptions}}
reportProgress: reportProgress
}
);

View File

@@ -4427,4 +4427,48 @@ public class SpringCodegenTest {
.hasParameter("race").toConstructor()
;
}
@Test
public void testLombokAnnotations() throws IOException {
final Map<String, Object> additionalProperties = new HashMap<>();
additionalProperties.put(AbstractJavaCodegen.ADDITIONAL_MODEL_TYPE_ANNOTATIONS, "@lombok.Data;@lombok.NoArgsConstructor;@lombok.AllArgsConstructor");
Map<String, File> output = generateFromContract("src/test/resources/3_0/petstore.yaml", SPRING_BOOT, additionalProperties);
JavaFileAssert.assertThat(output.get("Pet.java"))
.assertNoConstructor()
.assertNoMethod("toString")
.assertNoMethod("hashCode")
.assertNoMethod("equals")
.assertNoMethod("getId")
.assertNoMethod("setId")
.assertNoMethod("getName")
.assertNoMethod("setName")
;
additionalProperties.put(AbstractJavaCodegen.ADDITIONAL_MODEL_TYPE_ANNOTATIONS, "@lombok.ToString");
output = generateFromContract("src/test/resources/3_0/petstore.yaml", SPRING_BOOT, additionalProperties);
JavaFileAssert.assertThat(output.get("Pet.java"))
.assertConstructor().toFileAssert()
.assertNoMethod("toString")
.assertMethod("hashCode")
.toFileAssert()
.assertMethod("equals")
.toFileAssert()
.assertMethod("getId")
.toFileAssert()
.assertMethod("setId")
.toFileAssert()
.assertMethod("getName")
.toFileAssert()
.assertMethod("setName")
;
additionalProperties.put(AbstractJavaCodegen.ADDITIONAL_MODEL_TYPE_ANNOTATIONS, "@lombok.Getter;@lombok.Setter");
output = generateFromContract("src/test/resources/3_0/petstore.yaml", SPRING_BOOT, additionalProperties);
JavaFileAssert.assertThat(output.get("Pet.java"))
.assertConstructor().toFileAssert()
.assertMethod("toString")
.toFileAssert()
.assertMethod("hashCode")
.toFileAssert()
.assertMethod("equals")
;
}
}

View File

@@ -1335,11 +1335,22 @@ components:
type: http
scheme: signature
schemas:
MapWithDateTime:
type: object
additionalProperties:
items:
format: date-time
type: string
type: array
Foo:
type: object
required:
- bar
properties:
bar:
$ref: '#/components/schemas/Bar'
map:
$ref: '#/components/schemas/MapWithDateTime'
Bar:
type: string
default: bar

View File

@@ -18,6 +18,8 @@ import java.util.List;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -17,6 +17,8 @@ import java.net.http.HttpHeaders;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private HttpHeaders responseHeaders = null;
private String responseBody = null;

View File

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

View File

@@ -23,6 +23,8 @@ import java.util.List;
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -18,6 +18,8 @@ import java.util.List;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -517,12 +517,12 @@ namespace Org.OpenAPITools.Api
localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.Serialize(status)); // form parameter
if (marker != null)
{
localVarRequestOptions.FormParameters.Add("marker", Org.OpenAPITools.Client.ClientUtils.ParameterToString(marker)); // form parameter
localVarRequestOptions.FormParameters.Add("marker", Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter
}
localVarRequestOptions.FileParameters.Add("file", file);
if (statusArray != null)
{
localVarRequestOptions.FormParameters.Add("statusArray", Org.OpenAPITools.Client.ClientUtils.ParameterToString(statusArray)); // form parameter
localVarRequestOptions.FormParameters.Add("statusArray", Org.OpenAPITools.Client.ClientUtils.Serialize(statusArray)); // form parameter
}
localVarRequestOptions.Operation = "MultipartApi.MultipartMixed";
@@ -607,15 +607,15 @@ namespace Org.OpenAPITools.Api
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter
localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.Serialize(status)); // form parameter
if (marker != null)
{
localVarRequestOptions.FormParameters.Add("marker", Org.OpenAPITools.Client.ClientUtils.ParameterToString(marker)); // form parameter
localVarRequestOptions.FormParameters.Add("marker", Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter
}
localVarRequestOptions.FileParameters.Add("file", file);
if (statusArray != null)
{
localVarRequestOptions.FormParameters.Add("statusArray", Org.OpenAPITools.Client.ClientUtils.ParameterToString(statusArray)); // form parameter
localVarRequestOptions.FormParameters.Add("statusArray", Org.OpenAPITools.Client.ClientUtils.Serialize(statusArray)); // form parameter
}
localVarRequestOptions.Operation = "MultipartApi.MultipartMixed";

View File

@@ -23,6 +23,8 @@ import java.util.List;
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -23,6 +23,8 @@ import java.util.List;
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -95,10 +95,10 @@ export class PetService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getPets(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<PetWithMappedDiscriminatorModel>>;
public getPets(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<PetWithMappedDiscriminatorModel>>>;
public getPets(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<PetWithMappedDiscriminatorModel>>>;
public getPets(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
public getPets(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<PetWithMappedDiscriminatorModel>>;
public getPets(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<PetWithMappedDiscriminatorModel>>>;
public getPets(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<PetWithMappedDiscriminatorModel>>>;
public getPets(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarHeaders = this.defaultHeaders;
@@ -119,6 +119,11 @@ export class PetService {
localVarHttpContext = new HttpContext();
}
let localVarTransferCache: boolean | undefined = options && options.transferCache;
if (localVarTransferCache === undefined) {
localVarTransferCache = true;
}
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
@@ -139,6 +144,7 @@ export class PetService {
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
}
);

View File

@@ -95,10 +95,10 @@ export class PetService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getPets(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<PetWithMappedDiscriminatorModel>>;
public getPets(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<PetWithMappedDiscriminatorModel>>>;
public getPets(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<PetWithMappedDiscriminatorModel>>>;
public getPets(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
public getPets(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<PetWithMappedDiscriminatorModel>>;
public getPets(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<PetWithMappedDiscriminatorModel>>>;
public getPets(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<PetWithMappedDiscriminatorModel>>>;
public getPets(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarHeaders = this.defaultHeaders;
@@ -119,6 +119,11 @@ export class PetService {
localVarHttpContext = new HttpContext();
}
let localVarTransferCache: boolean | undefined = options && options.transferCache;
if (localVarTransferCache === undefined) {
localVarTransferCache = true;
}
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
@@ -139,6 +144,7 @@ export class PetService {
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
}
);

File diff suppressed because it is too large Load Diff

View File

@@ -6,19 +6,19 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^16.1.2",
"@angular/common": "^16.1.2",
"@angular/compiler": "^16.1.2",
"@angular/core": "^16.1.2",
"@angular/platform-browser": "^16.1.2",
"@angular/platform-browser-dynamic": "^16.1.2",
"@angular/animations": "^17.0.0",
"@angular/common": "^17.0.0",
"@angular/compiler": "^17.0.0",
"@angular/core": "^17.0.0",
"@angular/platform-browser": "^17.0.0",
"@angular/platform-browser-dynamic": "^17.0.0",
"rxjs": "^7.8.1",
"tslib": "^2.5.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.1.1",
"@angular/cli": "^16.1.1",
"@angular/compiler-cli": "^16.1.2",
"typescript": "^5.1.3"
"@angular-devkit/build-angular": "^17.0.0",
"@angular/cli": "^17.0.0",
"@angular/compiler-cli": "^17.0.0",
"typescript": "^5.3.0"
}
}

View File

@@ -206,6 +206,30 @@ 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

@@ -2858,7 +2858,7 @@ namespace Org.OpenAPITools.Api
}
if (enumFormStringArray != null)
{
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter
}
if (enumFormString != null)
{
@@ -2969,7 +2969,7 @@ namespace Org.OpenAPITools.Api
}
if (enumFormStringArray != null)
{
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter
}
if (enumFormString != null)
{

View File

@@ -2858,7 +2858,7 @@ namespace Org.OpenAPITools.Api
}
if (enumFormStringArray != null)
{
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter
}
if (enumFormString != null)
{
@@ -2969,7 +2969,7 @@ namespace Org.OpenAPITools.Api
}
if (enumFormStringArray != null)
{
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter
}
if (enumFormString != null)
{

View File

@@ -2858,7 +2858,7 @@ namespace Org.OpenAPITools.Api
}
if (enumFormStringArray != null)
{
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter
}
if (enumFormString != null)
{
@@ -2969,7 +2969,7 @@ namespace Org.OpenAPITools.Api
}
if (enumFormStringArray != null)
{
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter
}
if (enumFormString != null)
{

View File

@@ -2858,7 +2858,7 @@ namespace Org.OpenAPITools.Api
}
if (enumFormStringArray != null)
{
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter
}
if (enumFormString != null)
{
@@ -2969,7 +2969,7 @@ namespace Org.OpenAPITools.Api
}
if (enumFormStringArray != null)
{
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter
}
if (enumFormString != null)
{

View File

@@ -2858,7 +2858,7 @@ namespace Org.OpenAPITools.Api
}
if (enumFormStringArray != null)
{
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter
}
if (enumFormString != null)
{
@@ -2969,7 +2969,7 @@ namespace Org.OpenAPITools.Api
}
if (enumFormStringArray != null)
{
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter
}
if (enumFormString != null)
{

View File

@@ -2858,7 +2858,7 @@ namespace Org.OpenAPITools.Api
}
if (enumFormStringArray != null)
{
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter
}
if (enumFormString != null)
{
@@ -2969,7 +2969,7 @@ namespace Org.OpenAPITools.Api
}
if (enumFormStringArray != null)
{
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter
localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter
}
if (enumFormString != null)
{

View File

@@ -7,7 +7,7 @@ go 1.13
require (
github.com/OpenAPITools/openapi-generator/samples/client/petstore/go/go-petstore v0.0.0-00010101000000-000000000000
github.com/go-openapi/swag v0.22.3
github.com/stretchr/testify v1.8.1
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.2.0
github.com/stretchr/testify v1.8.4
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.16.0
)

File diff suppressed because it is too large Load Diff

View File

@@ -18,6 +18,8 @@ import java.util.List;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -21,6 +21,8 @@ import java.util.List;
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -21,6 +21,8 @@ import java.util.List;
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -21,6 +21,8 @@ import java.util.List;
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -17,6 +17,8 @@ import java.net.http.HttpHeaders;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private HttpHeaders responseHeaders = null;
private String responseBody = null;

View File

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

View File

@@ -17,6 +17,8 @@ import java.net.http.HttpHeaders;
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private HttpHeaders responseHeaders = null;
private String responseBody = null;

View File

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

View File

@@ -17,6 +17,8 @@ import java.net.http.HttpHeaders;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private HttpHeaders responseHeaders = null;
private String responseBody = null;

View File

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

View File

@@ -23,6 +23,8 @@ import java.util.List;
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -23,6 +23,8 @@ import java.util.List;
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -23,6 +23,8 @@ import java.util.List;
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -23,6 +23,8 @@ import java.util.List;
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -23,6 +23,8 @@ import java.util.List;
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -23,6 +23,8 @@ import java.util.List;
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -23,6 +23,8 @@ import java.util.List;
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -23,6 +23,8 @@ import java.util.List;
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -23,6 +23,8 @@ import java.util.List;
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -18,6 +18,8 @@ import java.util.List;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;

View File

@@ -235,8 +235,8 @@
<version>${jackson-databind-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>

View File

@@ -19,6 +19,8 @@ import io.vertx.core.MultiMap;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private MultiMap responseHeaders = null;
private String responseBody = null;

View File

@@ -19,6 +19,8 @@ import io.vertx.core.MultiMap;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private MultiMap responseHeaders = null;
private String responseBody = null;

View File

@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -0,0 +1,20 @@
.gitignore
README.md
api.module.ts
api/api.ts
api/pet.service.ts
api/store.service.ts
api/user.service.ts
configuration.ts
encoder.ts
git_push.sh
index.ts
model/apiResponse.ts
model/category.ts
model/models.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
param.ts
variables.ts

View File

@@ -0,0 +1,226 @@
## @
### Building
To install the required dependencies and to build the typescript sources run:
```
npm install
npm run build
```
### publishing
First build the package then run ```npm publish dist``` (don't forget to specify the `dist` folder!)
### consuming
Navigate to the folder of your consuming project and run one of next commands.
_published:_
```
npm install @ --save
```
_without publishing (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
```
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
_using `npm link`:_
In PATH_TO_GENERATED_PACKAGE/dist:
```
npm link
```
In your project:
```
npm link
```
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
Published packages are not effected by this issue.
#### General usage
In your Angular project:
```
// without configuring providers
import { ApiModule } from '';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
ApiModule,
// make sure to import the HttpClientModule in the AppModule only,
// see https://github.com/angular/angular/issues/20575
HttpClientModule
],
declarations: [ AppComponent ],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
```
// configuring providers
import { ApiModule, Configuration, ConfigurationParameters } from '';
export function apiConfigFactory (): Configuration {
const params: ConfigurationParameters = {
// set configuration parameters here.
}
return new Configuration(params);
}
@NgModule({
imports: [ ApiModule.forRoot(apiConfigFactory) ],
declarations: [ AppComponent ],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '';
@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
```
import { DefaultApi } from '';
export class AppComponent {
constructor(private apiGateway: DefaultApi) { }
}
```
Note: The ApiModule is restricted to being instantiated once app wide.
This is to ensure that all services are treated as singletons.
#### Using multiple OpenAPI files / APIs / ApiModules
In order to use multiple `ApiModules` generated from different OpenAPI files,
you can create an alias name when importing the modules
in order to avoid naming conflicts:
```
import { ApiModule } from 'my-api-path';
import { ApiModule as OtherApiModule } from 'my-other-api-path';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
ApiModule,
OtherApiModule,
// make sure to import the HttpClientModule in the AppModule only,
// see https://github.com/angular/angular/issues/20575
HttpClientModule
]
})
export class AppModule {
}
```
### Set service base path
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
```
import { BASE_PATH } from '';
bootstrap(AppComponent, [
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
]);
```
or
```
import { BASE_PATH } from '';
@NgModule({
imports: [],
declarations: [ AppComponent ],
providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
#### Using @angular/cli
First extend your `src/environments/*.ts` files by adding the corresponding base path:
```
export const environment = {
production: false,
API_BASE_PATH: 'http://127.0.0.1:8080'
};
```
In the src/app/app.module.ts:
```
import { BASE_PATH } from '';
import { environment } from '../environments/environment';
@NgModule({
declarations: [
AppComponent
],
imports: [ ],
providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
bootstrap: [ AppComponent ]
})
export class AppModule { }
```
### Customizing path parameter encoding
Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple'
and Dates for format 'date-time' are encoded correctly.
Other styles (e.g. "matrix") are not that easy to encode
and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]).
To implement your own parameter encoding (or call another library),
pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object
(see [General Usage](#general-usage) above).
Example value for use in your Configuration-Provider:
```typescript
new Configuration({
encodeParam: (param: Param) => myFancyParamEncoder(param),
})
```
[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander

View File

@@ -0,0 +1,30 @@
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
import { Configuration } from './configuration';
import { HttpClient } from '@angular/common/http';
@NgModule({
imports: [],
declarations: [],
exports: [],
providers: []
})
export class ApiModule {
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<ApiModule> {
return {
ngModule: ApiModule,
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
};
}
constructor( @Optional() @SkipSelf() parentModule: ApiModule,
@Optional() http: HttpClient) {
if (parentModule) {
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
}
if (!http) {
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
'See also https://github.com/angular/angular/issues/20575');
}
}
}

View File

@@ -0,0 +1,7 @@
export * from './pet.service';
import { PetService } from './pet.service';
export * from './store.service';
import { StoreService } from './store.service';
export * from './user.service';
import { UserService } from './user.service';
export const APIS = [PetService, StoreService, UserService];

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