Compare commits

..

11 Commits

Author SHA1 Message Date
William Cheng
e7b5ef9628 add api, model tests 2024-07-07 22:48:43 +08:00
William Cheng
f2d6a78883 add typescript-wright generator 2024-06-30 16:46:31 +08:00
Rodrigo de Almeida - RMA3
21d3cfe924 Fix Issue 18224 - Load x-field-extra-annotation in the operation parameter (#18967)
* fix issue 18959

* fix issue 18224

* fix issue 18224

* fix spaces

---------

Co-authored-by: Rodrigo Maciel de Almeida <rodrigo.almeida@wefin.com.br>
2024-06-30 16:27:14 +08:00
loicconan
fb17e5699d [PHP-SYMFONY] Debug Symfony version 7, enums ref, array of enums $ref and date assert (#19008)
* [PHP-SYMFONY] Debug for Symfony 7 support & debug enum ref & debug array enum ref & debug date assert

* [PHP-SYMFONY] Debug for Symfony 7 support & debug enum ref & debug array enum ref & debug date assert

* [PHP-SYMFONY] Debug for Symfony 7 support & debug enum ref & debug array enum ref & debug date assert
2024-06-30 10:11:26 +08:00
ksn-partisia
fa2b5750ce [Bug] [Java] Remove raw type compilation warnings when generating using jersey2 or jersey3 (#19033)
* Add type annotations to raw types for jersey2 and jersey3 templates

* Update samples

* Add type parameters to anyof_model.mustache and oneof_model.mustache

---------

Co-authored-by: Kasper S. Nielsen <kasper.s.nielsen@secata.com>
2024-06-30 10:06:12 +08:00
Cameron Koegel
53f1094765 [Python] Allow Overriding Accept Header (#19025)
* [Python] Allow Overriding Accept Header

* generate samples

* add tests
2024-06-28 19:27:10 +08:00
Val Packett
44e9ff58bd [android][volley] Remove unused robolectric test dependency (#19022)
Causes failures like:
Configuration `:debugUnitTestRuntimeClasspath` contains AndroidX dependencies, but the `android.useAndroidX` property is not enabled, which may cause runtime issues.
2024-06-27 09:51:56 +08:00
Val Packett
9c26848f11 [kotlin-client] Generate safe ?. access for optional enums (#18982) (#19023)
Fixes #18982
2024-06-26 15:53:56 +01:00
William Cheng
0c4bfe3ffe Add tests for anyof with discriminator (#19021)
* add tests for anyof with discriminator

* remove test

* update samples
2024-06-26 16:00:58 +08:00
qbuzzdaan
6b9d95be89 Tries to fix #18975 by changing how the deserializer interacts with its parent class (#18976)
* [JAVA] Fix for #18975, ensure static block of parent deser class loads

* Add sample spec with type with anyOf
2024-06-26 15:22:20 +08:00
Cameron Koegel
0d05ee35f0 [Python] Add Flag to Allow Ignoring Operation Servers (#18981)
* [Python] Add Flag to Allow Ignoring Operation Servers

* generate samples

* add tests
2024-06-26 15:08:13 +08:00
322 changed files with 11385 additions and 1854 deletions

View File

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

View File

@@ -512,7 +512,6 @@ OpenAPI Normalizer transforms the input OpenAPI doc/spec (which may not perfectl
- SIMPLIFY_ONEOF_ANYOF
- SIMPLIFY_BOOLEAN_ENUM
- REFACTOR_ALLOF_WITH_PROPERTIES_ONLY
(One can use `DISABLE_ALL=true` to disable all the rules)

View File

@@ -74,6 +74,7 @@ The following generators are available:
* [typescript-jquery](generators/typescript-jquery.md)
* [typescript-nestjs (experimental)](generators/typescript-nestjs.md)
* [typescript-node](generators/typescript-node.md)
* [typescript-playwright](generators/typescript-playwright.md)
* [typescript-redux-query](generators/typescript-redux-query.md)
* [typescript-rxjs](generators/typescript-rxjs.md)
* [xojo-client](generators/xojo-client.md)

View File

@@ -80,7 +80,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -120,7 +120,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
|x-spring-paginated|Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters|OPERATION|false
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null

View File

@@ -77,7 +77,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|x-webclient-blocking|Specifies if method for specific operation should be blocking or non-blocking(ex: return `Mono<T>/Flux<T>` or `return T/List<T>/Set<T>` & execute `.block()` inside generated method)|OPERATION|false

View File

@@ -80,7 +80,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -82,7 +82,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -103,7 +103,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -102,7 +102,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -114,7 +114,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|x-webclient-blocking|Specifies if method for specific operation should be blocking or non-blocking(ex: return `Mono<T>/Flux<T>` or `return T/List<T>/Set<T>` & execute `.block()` inside generated method)|OPERATION|false

View File

@@ -88,7 +88,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -89,7 +89,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -92,7 +92,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -82,7 +82,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -82,7 +82,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -85,7 +85,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -82,7 +82,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -114,7 +114,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|x-webclient-blocking|Specifies if method for specific operation should be blocking or non-blocking(ex: return `Mono<T>/Flux<T>` or `return T/List<T>/Set<T>` & execute `.block()` inside generated method)|OPERATION|false

View File

@@ -96,7 +96,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -87,7 +87,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -110,7 +110,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -105,7 +105,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -88,7 +88,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -89,7 +89,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -88,7 +88,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -96,7 +96,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
## IMPORT MAPPING

View File

@@ -113,7 +113,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
|x-spring-paginated|Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters|OPERATION|false
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null

View File

@@ -0,0 +1,303 @@
---
title: Documentation for the typescript-playwright Generator
---
## METADATA
| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | typescript-playwright | pass this to the generate command after -g |
| generator stability | STABLE | |
| generator type | CLIENT | |
| generator language | Typescript | |
| generator default templating engine | mustache | |
| helpTxt | Generates end-to-end tests using Playwright for TypeScript. | |
## 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.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
|enumPropertyNamingReplaceSpecialChar|Set to true to replace '-' and '+' symbols with 'minus_' and 'plus_' in enum of type string| |false|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|fileNaming|Naming convention for the output files: 'PascalCase', 'camelCase', 'kebab-case'.| |PascalCase|
|importFileExtension|File extension to use with relative imports. Set it to '.js' or '.mjs' when using [ESM](https://nodejs.org/api/esm.html).| ||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|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|
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|paramNaming|Naming convention for parameters: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|prefixParameterInterfaces|Setting this property to true will generate parameter interface declarations prefixed with API class name to avoid name conflicts.| |false|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sagasAndRecords|Setting this property to true will generate additional files for use with redux-saga and immutablejs.| |false|
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|stringEnums|Generate string enums instead of objects for enum values.| |false|
|supportsES6|Generate code that conforms to ES6.| |false|
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |true|
|useSquareBracketsInArrayNames|Setting this property to true will add brackets to array attribute names, e.g. my_values[].| |false|
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|withoutRuntimeChecks|Setting this property to true will remove any runtime checks on the request and response payloads. Payloads will be casted to their expected types.| |false|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|Array|
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Array</li>
<li>Boolean</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>File</li>
<li>Float</li>
<li>Integer</li>
<li>Long</li>
<li>Map</li>
<li>Object</li>
<li>ReadonlyArray</li>
<li>Set</li>
<li>String</li>
<li>any</li>
<li>boolean</li>
<li>number</li>
<li>object</li>
<li>string</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>ApiResponse</li>
<li>BASE_PATH</li>
<li>BaseAPI</li>
<li>BlobApiResponse</li>
<li>COLLECTION_FORMATS</li>
<li>Configuration</li>
<li>ConfigurationParameters</li>
<li>FetchAPI</li>
<li>FetchParams</li>
<li>HTTPBody</li>
<li>HTTPHeaders</li>
<li>HTTPMethod</li>
<li>HTTPQuery</li>
<li>Index</li>
<li>JSONApiResponse</li>
<li>Middleware</li>
<li>ModelPropertyNaming</li>
<li>RequestContext</li>
<li>RequestOpts</li>
<li>RequiredError</li>
<li>ResponseContext</li>
<li>ResponseTransformer</li>
<li>TextApiResponse</li>
<li>VoidApiResponse</li>
<li>abstract</li>
<li>await</li>
<li>boolean</li>
<li>break</li>
<li>byte</li>
<li>case</li>
<li>catch</li>
<li>char</li>
<li>class</li>
<li>configuration</li>
<li>const</li>
<li>continue</li>
<li>debugger</li>
<li>default</li>
<li>delete</li>
<li>do</li>
<li>double</li>
<li>else</li>
<li>enum</li>
<li>exists</li>
<li>export</li>
<li>extends</li>
<li>false</li>
<li>final</li>
<li>finally</li>
<li>float</li>
<li>for</li>
<li>formParams</li>
<li>function</li>
<li>goto</li>
<li>headerParams</li>
<li>if</li>
<li>implements</li>
<li>import</li>
<li>in</li>
<li>instanceof</li>
<li>int</li>
<li>interface</li>
<li>let</li>
<li>long</li>
<li>native</li>
<li>new</li>
<li>null</li>
<li>package</li>
<li>private</li>
<li>protected</li>
<li>public</li>
<li>queryParameters</li>
<li>requestOptions</li>
<li>return</li>
<li>short</li>
<li>static</li>
<li>super</li>
<li>switch</li>
<li>synchronized</li>
<li>this</li>
<li>throw</li>
<li>transient</li>
<li>true</li>
<li>try</li>
<li>typeof</li>
<li>useFormData</li>
<li>var</li>
<li>varLocalDeferred</li>
<li>varLocalPath</li>
<li>void</li>
<li>volatile</li>
<li>while</li>
<li>with</li>
<li>yield</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✓|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Uuid|✗|
|Array|✓|OAS2,OAS3
|Null|✗|OAS3
|AnyType|✗|OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✓|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✗|OAS3
|allOf|✗|OAS2,OAS3
|anyOf|✗|OAS3
|oneOf|✗|OAS3
|not|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✓|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
|SignatureAuth|✗|OAS3
|AWSV4Signature|✗|ToolingExtension
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -160,7 +160,6 @@ public class OpenAPINormalizer {
// rules that are default to true
rules.put(SIMPLIFY_ONEOF_ANYOF, true);
rules.put(SIMPLIFY_BOOLEAN_ENUM, true);
rules.put(REFACTOR_ALLOF_WITH_PROPERTIES_ONLY, true); // default to true since v7.7.0
processRules(inputRules);

View File

@@ -19,7 +19,7 @@ import java.util.List;
X_ACCEPTS("x-accepts", ExtensionLevel.OPERATION, "Specify custom value for 'Accept' header for operation", null),
X_CONTENT_TYPE("x-content-type", ExtensionLevel.OPERATION, "Specify custom value for 'Content-Type' header for operation", null),
X_CLASS_EXTRA_ANNOTATION("x-class-extra-annotation", ExtensionLevel.MODEL, "List of custom annotations to be added to model", null),
X_FIELD_EXTRA_ANNOTATION("x-field-extra-annotation", ExtensionLevel.FIELD, "List of custom annotations to be added to property", null),
X_FIELD_EXTRA_ANNOTATION("x-field-extra-annotation", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "List of custom annotations to be added to property", null),
X_OPERATION_EXTRA_ANNOTATION("x-operation-extra-annotation", ExtensionLevel.OPERATION, "List of custom annotations to be added to operation", null),
X_VERSION_PARAM("x-version-param", ExtensionLevel.OPERATION_PARAMETER, "Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false", null),
X_PATTERN_MESSAGE("x-pattern-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable", null),

View File

@@ -240,18 +240,24 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
@SuppressWarnings("squid:S5164")
protected static final ThreadLocal<SimpleDateFormat> SNAPSHOT_SUFFIX_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyyMMddHHmm", Locale.ROOT));
@Getter protected MODEL_PROPERTY_NAMING_TYPE modelPropertyNaming = MODEL_PROPERTY_NAMING_TYPE.original;
@Getter
protected MODEL_PROPERTY_NAMING_TYPE modelPropertyNaming = MODEL_PROPERTY_NAMING_TYPE.original;
protected ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = ENUM_PROPERTY_NAMING_TYPE.PascalCase;
@Getter protected PARAM_NAMING_TYPE paramNaming = PARAM_NAMING_TYPE.camelCase;
@Getter
protected PARAM_NAMING_TYPE paramNaming = PARAM_NAMING_TYPE.camelCase;
protected boolean enumPropertyNamingReplaceSpecialChar = false;
@Getter @Setter
@Getter
@Setter
protected Boolean supportsES6 = false;
@Getter @Setter
@Getter
@Setter
protected Boolean nullSafeAdditionalProps = false;
protected HashSet<String> languageGenericTypes;
@Getter @Setter
@Getter
@Setter
protected String npmName = null;
@Getter @Setter
@Getter
@Setter
protected String npmVersion = "1.0.0";
protected String enumSuffix = "Enum";
@@ -1151,4 +1157,4 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
public GeneratorLanguage generatorLanguage() {
return GeneratorLanguage.TYPESCRIPT;
}
}
}

View File

@@ -35,7 +35,7 @@ public abstract class AbstractOpenApiSchema {
*
* @return an instance of the actual schema/object
*/
public abstract Map<String, GenericType> getSchemas();
public abstract Map<String, GenericType<?>> getSchemas();
/**
* Get the actual instance

View File

@@ -824,9 +824,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return formatDate((Date) param);
} {{#jsr310}}else if (param instanceof OffsetDateTime) {
return formatOffsetDateTime((OffsetDateTime) param);
} {{/jsr310}}else if (param instanceof Collection) {
} {{/jsr310}}else if (param instanceof Collection<?>) {
StringBuilder b = new StringBuilder();
for(Object o : (Collection)param) {
for(Object o : (Collection<?>)param) {
if(b.length() > 0) {
b.append(',');
}
@@ -852,9 +852,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
// preconditions
if (name == null || name.isEmpty() || value == null) return params;
Collection valueCollection;
if (value instanceof Collection) {
valueCollection = (Collection) value;
Collection<?> valueCollection;
if (value instanceof Collection<?>) {
valueCollection = (Collection<?>) value;
} else {
params.add(new Pair(name, parameterToString(value)));
return params;

View File

@@ -191,9 +191,9 @@ public class JSON implements ContextResolver<ObjectMapper> {
visitedClasses.add(modelClass);
// Traverse the oneOf/anyOf composed schemas.
Map<String, GenericType> descendants = modelDescendants.get(modelClass);
Map<String, GenericType<?>> descendants = modelDescendants.get(modelClass);
if (descendants != null) {
for (GenericType childType : descendants.values()) {
for (GenericType<?> childType : descendants.values()) {
if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) {
return true;
}
@@ -210,7 +210,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
/**
* A map of oneOf/anyOf descendants for each model class.
*/
private static Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<>();
private static Map<Class<?>, Map<String, GenericType<?>>> modelDescendants = new HashMap<>();
/**
* Register a model class discriminator.
@@ -230,7 +230,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
* @param modelClass the model class
* @param descendants a map of oneOf/anyOf descendants.
*/
public static void registerDescendants(Class<?> modelClass, Map<String, GenericType> descendants) {
public static void registerDescendants(Class<?> modelClass, Map<String, GenericType<?>> descendants) {
modelDescendants.put(modelClass, descendants);
}

View File

@@ -57,7 +57,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
Object deserialized = null;
{{#discriminator}}
Class<?> cls = JSON.getClassForElement(tree, {{classname}}.class);
Class<?> cls = JSON.getClassForElement(tree, new {{classname}}().getClass());
if (cls != null) {
// When the OAS schema includes a discriminator, use the discriminator value to
// discriminate the anyOf schemas.
@@ -99,7 +99,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
}
// store a list of schema names defined in anyOf
public static final Map<String, GenericType> schemas = new HashMap<>();
public static final Map<String, GenericType<?>> schemas = new HashMap<>();
public {{classname}}() {
super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
@@ -144,7 +144,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
}
@Override
public Map<String, GenericType> getSchemas() {
public Map<String, GenericType<?>> getSchemas() {
return {{classname}}.schemas;
}

View File

@@ -169,7 +169,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
}
// store a list of schema names defined in oneOf
public static final Map<String, GenericType> schemas = new HashMap<>();
public static final Map<String, GenericType<?>> schemas = new HashMap<>();
public {{classname}}() {
super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
@@ -218,7 +218,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
}
@Override
public Map<String, GenericType> getSchemas() {
public Map<String, GenericType<?>> getSchemas() {
return {{classname}}.schemas;
}

View File

@@ -35,7 +35,7 @@ public abstract class AbstractOpenApiSchema {
*
* @return an instance of the actual schema/object
*/
public abstract Map<String, GenericType> getSchemas();
public abstract Map<String, GenericType<?>> getSchemas();
/**
* Get the actual instance

View File

@@ -824,9 +824,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
return formatDate((Date) param);
} {{#jsr310}}else if (param instanceof OffsetDateTime) {
return formatOffsetDateTime((OffsetDateTime) param);
} {{/jsr310}}else if (param instanceof Collection) {
} {{/jsr310}}else if (param instanceof Collection<?>) {
StringBuilder b = new StringBuilder();
for(Object o : (Collection)param) {
for(Object o : (Collection<?>)param) {
if(b.length() > 0) {
b.append(',');
}
@@ -852,9 +852,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
// preconditions
if (name == null || name.isEmpty() || value == null) return params;
Collection valueCollection;
if (value instanceof Collection) {
valueCollection = (Collection) value;
Collection<?> valueCollection;
if (value instanceof Collection<?>) {
valueCollection = (Collection<?>) value;
} else {
params.add(new Pair(name, parameterToString(value)));
return params;

View File

@@ -191,9 +191,9 @@ public class JSON implements ContextResolver<ObjectMapper> {
visitedClasses.add(modelClass);
// Traverse the oneOf/anyOf composed schemas.
Map<String, GenericType> descendants = modelDescendants.get(modelClass);
Map<String, GenericType<?>> descendants = modelDescendants.get(modelClass);
if (descendants != null) {
for (GenericType childType : descendants.values()) {
for (GenericType<?> childType : descendants.values()) {
if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) {
return true;
}
@@ -210,7 +210,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
/**
* A map of oneOf/anyOf descendants for each model class.
*/
private static Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<>();
private static Map<Class<?>, Map<String, GenericType<?>>> modelDescendants = new HashMap<>();
/**
* Register a model class discriminator.
@@ -230,7 +230,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
* @param modelClass the model class
* @param descendants a map of oneOf/anyOf descendants.
*/
public static void registerDescendants(Class<?> modelClass, Map<String, GenericType> descendants) {
public static void registerDescendants(Class<?> modelClass, Map<String, GenericType<?>> descendants) {
modelDescendants.put(modelClass, descendants);
}

View File

@@ -57,7 +57,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
Object deserialized = null;
{{#discriminator}}
Class<?> cls = JSON.getClassForElement(tree, {{classname}}.class);
Class<?> cls = JSON.getClassForElement(tree, new {{classname}}().getClass());
if (cls != null) {
// When the OAS schema includes a discriminator, use the discriminator value to
// discriminate the anyOf schemas.
@@ -99,7 +99,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
}
// store a list of schema names defined in anyOf
public static final Map<String, GenericType> schemas = new HashMap<>();
public static final Map<String, GenericType<?>> schemas = new HashMap<>();
public {{classname}}() {
super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
@@ -144,7 +144,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
}
@Override
public Map<String, GenericType> getSchemas() {
public Map<String, GenericType<?>> getSchemas() {
return {{classname}}.schemas;
}

View File

@@ -169,7 +169,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
}
// store a list of schema names defined in oneOf
public static final Map<String, GenericType> schemas = new HashMap<>();
public static final Map<String, GenericType<?>> schemas = new HashMap<>();
public {{classname}}() {
super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
@@ -218,7 +218,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
}
@Override
public Map<String, GenericType> getSchemas() {
public Map<String, GenericType<?>> getSchemas() {
return {{classname}}.schemas;
}

View File

@@ -54,7 +54,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
Object deserialized = null;
{{#discriminator}}
Class<?> cls = JSON.getClassForElement(tree, {{classname}}.class);
Class<?> cls = JSON.getClassForElement(tree, new {{classname}}().getClass());
if (cls != null) {
// When the OAS schema includes a discriminator, use the discriminator value to
// discriminate the anyOf schemas.

View File

@@ -1 +1 @@
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>optionalDataType}} {{paramName}}{{/isHeaderParam}}
{{#isHeaderParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{vendorExtensions.x-field-extra-annotation}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>optionalDataType}} {{paramName}}{{/isHeaderParam}}

View File

@@ -1 +1 @@
{{#isPathParam}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>optionalDataType}} {{paramName}}{{/isPathParam}}
{{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{vendorExtensions.x-field-extra-annotation}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>optionalDataType}} {{paramName}}{{/isPathParam}}

View File

@@ -1 +1 @@
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}}{{#useBeanValidation}} @Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = {{#isMap}}""{{/isMap}}{{^isMap}}"{{baseName}}"{{/isMap}}{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/isModel}}{{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>optionalDataType}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{vendorExtensions.x-field-extra-annotation}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}}{{#useBeanValidation}} @Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = {{#isMap}}""{{/isMap}}{{^isMap}}"{{baseName}}"{{/isMap}}{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/isModel}}{{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>optionalDataType}} {{paramName}}{{/isQueryParam}}

View File

@@ -146,6 +146,7 @@ org.openapitools.codegen.languages.TypeScriptNestjsClientCodegen
org.openapitools.codegen.languages.TypeScriptNodeClientCodegen
org.openapitools.codegen.languages.TypeScriptReduxQueryClientCodegen
org.openapitools.codegen.languages.TypeScriptRxjsClientCodegen
org.openapitools.codegen.languages.TypeScriptPlaywrightClientCodegen
org.openapitools.codegen.languages.WsdlSchemaCodegen
org.openapitools.codegen.languages.XojoClientCodegen
org.openapitools.codegen.languages.ZapierClientCodegen

View File

@@ -58,8 +58,6 @@ ext {
httpmime_version = "4.5.14"
volley_version = "1.2.1"
junit_version = "4.13.2"
robolectric_version = "4.5.1"
concurrent_unit_version = "0.4.6"
}
dependencies {
@@ -73,8 +71,6 @@ dependencies {
}
implementation "com.android.volley:volley:${volley_version}"
testImplementation "junit:junit:$junit_version"
testImplementation "org.robolectric:robolectric:${robolectric_version}"
testImplementation "net.jodah:concurrentunit:${concurrent_unit_version}"
}
publishing {

View File

@@ -190,7 +190,7 @@ import {{packageName}}.infrastructure.toMultiValue
}}{{#bodyParams}}{{{paramName}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{!
}}{{^hasFormParams}}null{{/hasFormParams}}{{!
}}{{#hasFormParams}}mapOf({{#formParams}}
"{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{!
"{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{!
}}{{/formParams}}){{/hasFormParams}}{{!
}}{{/hasBodyParam}}
val localVariableQuery: MultiValueMap = {{^hasQueryParams}}mutableMapOf()
@@ -225,7 +225,7 @@ import {{packageName}}.infrastructure.toMultiValue
return RequestConfig(
method = RequestMethod.{{httpMethod}},
path = "{{path}}"{{#pathParams}}.replace("{"+"{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}},
path = "{{path}}"{{#pathParams}}.replace("{"+"{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}},
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}},

View File

@@ -92,7 +92,7 @@ import {{packageName}}.infrastructure.*
}}{{#bodyParams}}{{{paramName}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{!
}}{{^hasFormParams}}null{{/hasFormParams}}{{!
}}{{#hasFormParams}}mapOf({{#formParams}}
"{{{baseName}}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{!
"{{{baseName}}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{!
}}{{/formParams}}){{/hasFormParams}}{{!
}}{{/hasBodyParam}}
val localVariableQuery = {{^hasQueryParams}}mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
@@ -127,7 +127,7 @@ import {{packageName}}.infrastructure.*
val params = mutableMapOf<String, Any>(
{{#pathParams}}
"{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}.value{{/isEnum}}{{/isContainer}},
"{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}},
{{/pathParams}}
)

View File

@@ -94,7 +94,7 @@ import {{packageName}}.infrastructure.*
}}{{#bodyParams}}{{{paramName}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{!
}}{{^hasFormParams}}null{{/hasFormParams}}{{!
}}{{#hasFormParams}}mapOf({{#formParams}}
"{{{baseName}}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{!
"{{{baseName}}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{!
}}{{/formParams}}){{/hasFormParams}}{{!
}}{{/hasBodyParam}}
val localVariableQuery = {{^hasQueryParams}}mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
@@ -129,7 +129,7 @@ import {{packageName}}.infrastructure.*
val params = mutableMapOf<String, Any>(
{{#pathParams}}
"{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}.value{{/isEnum}}{{/isContainer}},
"{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}},
{{/pathParams}}
)

View File

@@ -136,7 +136,7 @@ import {{packageName}}.infrastructure.*
{{/isDeprecated}}
fun {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : Future<ApiResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>> {
val vertxClient = WebClient.create(vertx)
val request = vertxClient.requestAbs(HttpMethod.{{httpMethod}}, UriTemplate.of("$basePath{{path}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}}))
val request = vertxClient.requestAbs(HttpMethod.{{httpMethod}}, UriTemplate.of("$basePath{{path}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}}))
{{#hasFormParams}}request.putHeader("Content-Type", {{^consumes}}"multipart/form-data"{{/consumes}}{{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}){{/hasFormParams}}
{{#headerParams}}{{{paramName}}}{{^required}}?{{/required}}.apply { request.putHeader("{{baseName}}", {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}})}{{/headerParams}}
@@ -150,7 +150,7 @@ import {{packageName}}.infrastructure.*
{{#hasFormParams}}
val form = io.vertx.core.MultiMap.caseInsensitiveMultiMap();
{{#formParams}}
{{{paramName}}}{{^required}}?{{/required}}.let { form.add("{{{baseName}}}", {{{paramName}}}{{#isEnum}}.value{{/isEnum}}{{^isString}}.toString(){{/isString}}) }
{{{paramName}}}{{^required}}?{{/required}}.let { form.add("{{{baseName}}}", {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}{{^isString}}.toString(){{/isString}}) }
{{/formParams}}
{{/hasFormParams}}

View File

@@ -28,6 +28,7 @@
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"doctrine/annotations": "^2.0",
"symfony/validator": "^6.4|^7.0",
"jms/serializer-bundle": "^5.4",
"symfony/framework-bundle": "^6.4|^7.0"

View File

@@ -30,6 +30,20 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}
return $this->{{name}};
}
/**
* Sets {{name}}.
*
* @param {{{vendorExtensions.x-comment-type}}} ${{name}}{{#description}} {{{.}}}{{/description}}
*
* @return $this
*/
public function {{setter}}({{#vendorExtensions.x-parameter-type}}{{vendorExtensions.x-parameter-type}} {{/vendorExtensions.x-parameter-type}}${{name}}{{^required}} = null{{/required}}): self
{
$this->{{name}} = ${{name}};
return $this;
}
{{#isEnumRef}}
/**
* Gets {{name}} for serialization.
@@ -40,6 +54,24 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}
{
return $this->{{name}}?->value ? (string) $this->{{name}}->value : null;
}
/**
* Sets {{name}}.
*
* @param string|{{{vendorExtensions.x-comment-type}}} ${{name}}{{#description}} {{{.}}}{{/description}}
*
* @return $this
*/
public function setDeserialized{{nameInPascalCase}}(string|{{#vendorExtensions.x-comment-type}}{{vendorExtensions.x-comment-type}} {{/vendorExtensions.x-comment-type}}${{name}}{{^required}} = null{{/required}}): self
{
if (is_string(${{name}})) {
${{name}} = {{baseType}}::tryFrom(${{name}});
}
$this->{{name}} = ${{name}};
return $this;
}
{{/isEnumRef}}
{{#isContainer}}
@@ -53,26 +85,36 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}
public function getSerialized{{nameInPascalCase}}(): array
{
return array_map(
static fn ($value) => (string) $value->value,
$this->test ?? []
static fn ($value) => $value?->value ? (string) $value->value : null,
$this->{{name}} ?? []
);
}
/**
* Sets {{name}}.
*
* @param {{^required}}?{{/required}}array ${{name}}{{#description}} {{{.}}}{{/description}}
*
* @return $this
*/
public function setDeserialized{{nameInPascalCase}}({{^required}}?{{/required}}array ${{name}}{{^required}} = []{{/required}}): self
{
$this->{{name}} = array_map(
static function ($value) {
if (is_string($value)) {
$value = {{baseType}}::tryFrom($value);
}
return $value;
},
${{name}} ?? []
);
return $this;
}
{{/isEnumRef}}
{{/items}}
{{/isContainer}}
/**
* Sets {{name}}.
*
* @param {{{vendorExtensions.x-comment-type}}} ${{name}}{{#description}} {{{.}}}{{/description}}
*
* @return $this
*/
public function {{setter}}({{#vendorExtensions.x-parameter-type}}{{vendorExtensions.x-parameter-type}} {{/vendorExtensions.x-parameter-type}}${{name}}{{^required}} = null{{/required}}): self
{
$this->{{name}} = ${{name}};
return $this;
}
{{/vars}}
}

View File

@@ -5,30 +5,7 @@
{{/description}}
* @var {{{vendorExtensions.x-comment-type}}}
* @SerializedName("{{baseName}}")
{{#required}}
* @Assert\NotNull()
{{^isPrimitiveType}}
* @Assert\Valid()
{{/isPrimitiveType}}
{{/required}}
{{#isEnum}}
{{#isContainer}}
* @Assert\All({
{{#items}}
* @Assert\Choice({ {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}} })
{{/items}}
* })
{{/isContainer}}
{{^isContainer}}
* @Assert\Choice({ {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}} })
{{/isContainer}}
{{/isEnum}}
{{#isContainer}}
* @Assert\All({
{{#items}}
* @Assert\Type("{{dataType}}")
{{/items}}
* })
{{#isMap}}
{{#items}}
* @Type("array<string, {{dataType}}>")
@@ -37,7 +14,7 @@
{{^isMap}}
{{#items}}
{{#isEnumRef}}
* @Accessor(getter="getSerialized{{nameInPascalCase}}")
* @Accessor(getter="getSerialized{{nameInPascalCase}}", setter="setDeserialized{{nameInPascalCase}}")
* @Type("array<string>")
{{/isEnumRef}}
{{^isEnumRef}}
@@ -48,66 +25,95 @@
{{/isContainer}}
{{^isContainer}}
{{#isDate}}
* @Assert\Type("\Date")
* @Type("DateTime<'Y-m-d'>")
{{/isDate}}
{{#isDateTime}}
* @Assert\Type("\DateTime"))
* @Type("DateTime")
{{/isDateTime}}
{{#isEnumRef}}
* @Accessor(getter="getSerialized{{nameInPascalCase}}")
* @Type("string")
* @Accessor(getter="getSerialized{{nameInPascalCase}}", setter="setDeserialized{{nameInPascalCase}}")
* @Type("string")
{{/isEnumRef}}
{{^isDate}}
{{^isDateTime}}
{{^isEnumRef}}
* @Assert\Type("{{dataType}}")
* @Type("{{dataType}}")
{{/isEnumRef}}
{{/isDateTime}}
{{/isDate}}
{{/isContainer}}
*/
{{#required}}
#[Assert\NotNull]
{{^isPrimitiveType}}
#[Assert\Valid]
{{/isPrimitiveType}}
{{/required}}
{{#isEnum}}
{{#isContainer}}
#[Assert\All([
{{#items}}
new Assert\Choice([{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]),
{{/items}}
])]
{{/isContainer}}
{{^isContainer}}
#[Assert\Choice([{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}])]
{{/isContainer}}
{{/isEnum}}
{{#isContainer}}
#[Assert\All([
{{#items}}
new Assert\Type("{{dataType}}"),
{{/items}}
])]
{{/isContainer}}
{{^isContainer}}
{{#isDate}}
#[Assert\Type("\DateTime")]
{{/isDate}}
{{#isDateTime}}
#[Assert\Type("\DateTime")]
{{/isDateTime}}
{{^isDate}}
{{^isDateTime}}
{{^isEnumRef}}
#[Assert\Type("{{dataType}}")]
{{/isEnumRef}}
{{/isDateTime}}
{{/isDate}}
{{/isContainer}}
{{#hasValidation}}
{{#maxLength}}
* @Assert\Length(
* max = {{.}}
* )
#[Assert\Length(max: {{.}})]
{{/maxLength}}
{{#minLength}}
* @Assert\Length(
* min = {{.}}
* )
#[Assert\Length(min: {{.}})]
{{/minLength}}
{{#minimum}}
{{#exclusiveMinimum}}
* @Assert\GreaterThan({{minimum}})
#[Assert\GreaterThan({{minimum}})]
{{/exclusiveMinimum}}
{{^exclusiveMinimum}}
* @Assert\GreaterThanOrEqual({{minimum}})
#[Assert\GreaterThanOrEqual({{minimum}})]
{{/exclusiveMinimum}}
{{/minimum}}
{{#maximum}}
{{#exclusiveMaximum}}
* @Assert\LessThan({{maximum}})
#[Assert\LessThan({{maximum}})]
{{/exclusiveMaximum}}
{{^exclusiveMaximum}}
* @Assert\LessThanOrEqual({{maximum}})
#[Assert\LessThanOrEqual({{maximum}})]
{{/exclusiveMaximum}}
{{/maximum}}
{{#pattern}}
* @Assert\Regex("/{{.}}/")
#[Assert\Regex("/{{.}}/")]
{{/pattern}}
{{#maxItems}}
* @Assert\Count(
* max = {{.}}
* )
#[Assert\Count(max: {{.}})]
{{/maxItems}}
{{#minItems}}
* @Assert\Count(
* min = {{.}}
* )
#[Assert\Count(min: {{.}})]
{{/minItems}}
{{/hasValidation}}
*/
protected {{{vendorExtensions.x-parameter-type}}} ${{name}} = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}};

View File

@@ -101,12 +101,16 @@ class JmsSerializer implements SerializerInterface
case '\DateTime':
return is_null($data) ? null :new DateTime($data);
default:
if (is_null($data)) {
return null;
}
if (!class_exists($type)) {
throw new RuntimeException(sprintf("Type %s is unsupported", $type));
}
$reflectionClass = new \ReflectionClass($type);
if (!$reflectionClass->implementsInterface('\BackedENum')) {
if (!$reflectionClass->implementsInterface('\BackedEnum')) {
throw new RuntimeException(sprintf("Type %s is unsupported", $type));
}

View File

@@ -186,11 +186,12 @@ class {{classname}}:
{{#hasProduces}}
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[{{#produces}}
'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[{{#produces}}
'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}
]
)
{{/hasProduces}}
{{#hasConsumes}}

View File

@@ -232,7 +232,7 @@ class ApiClient:
body = self.sanitize_for_serialization(body)
# request url
if _host is None:
if _host is None or self.configuration.ignore_operation_servers:
url = self.configuration.host + resource_path
else:
# use server/host defined in path or operation instead

View File

@@ -24,6 +24,9 @@ class Configuration:
"""This class contains various settings of the API client.
:param host: Base url.
:param ignore_operation_servers
Boolean to ignore operation servers for the API client.
Config will use `host` as the base url regardless of the operation servers.
:param api_key: Dict to store API key(s).
Each entry in the dict specifies an API key.
The dict key is the name of the security scheme in the OAS specification.
@@ -148,6 +151,7 @@ conf = {{{packageName}}}.Configuration(
{{/hasHttpSignatureMethods}}
server_index=None, server_variables=None,
server_operation_index=None, server_operation_variables=None,
ignore_operation_servers=False,
ssl_ca_cert=None,
retries=None,
*,
@@ -166,6 +170,9 @@ conf = {{{packageName}}}.Configuration(
self.server_operation_variables = server_operation_variables or {}
"""Default server variables
"""
self.ignore_operation_servers = ignore_operation_servers
"""Ignore operation servers
"""
self.temp_folder_path = None
"""Temp file folder for downloading files
"""

View File

@@ -0,0 +1,26 @@
import {Map, Record, RecordOf} from 'immutable';
import {
{{#models}}
{{#model}}
{{#isEntity}}
{{classname}}RecordEntity,
{{/isEntity}}
{{/model}}
{{/models}}
} from "./models/index{{importFileExtension}}"
export const ApiEntitiesRecordProps = {
recType: "ApiEntitiesRecord" as "ApiEntitiesRecord",
{{#models}}
{{#model}}
{{#isEntity}}
{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}: ({{classname}}RecordEntity(), Map<string, {{classname}}RecordEntity>()),
{{/isEntity}}
{{/model}}
{{/models}}
};
export type ApiEntitiesRecordPropsType = typeof ApiEntitiesRecordProps;
export const ApiEntitiesRecord = Record(ApiEntitiesRecordProps, ApiEntitiesRecordProps.recType);
export type ApiEntitiesRecord = RecordOf<ApiEntitiesRecordPropsType>;

View File

@@ -0,0 +1,21 @@
import {ApiEntitiesRecord} from "./ApiEntitiesRecord{{importFileExtension}}";
import {ReducerBuilder} from "redux-ts-simple";
import {normalizedEntities} from "./runtimeSagasAndRecords{{importFileExtension}}";
export const ApiEntitiesReducer = new ReducerBuilder(ApiEntitiesRecord())
.on(normalizedEntities, (state, action): ApiEntitiesRecord => {
const {entities} = action.payload;
return state.withMutations(mutableState => {
for (const entityKey in entities) {
const entityMap = entities[entityKey];
const currentEntityMap = mutableState.get(entityKey as any);
if (currentEntityMap) {
let mergedEntityMap = currentEntityMap.mergeDeep(entityMap);
if (!mergedEntityMap.equals(currentEntityMap)) {
mutableState.set(entityKey as any, mergedEntityMap);
}
}
}
});
})
.build();

View File

@@ -0,0 +1,5 @@
export let getApiEntitiesState: (state: any) => any = (state: any) => state.app.apiEntities;
export function setApiEntitiesStateGetter(getter: (state: any) => any) { // Use this to customize the location where you have placed your ApiEntitiesRecord in your project.
getApiEntitiesState = getter;
}

View File

@@ -0,0 +1,46 @@
## {{npmName}}@{{npmVersion}}
This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments:
Environment
* Node.js
* Webpack
* Browserify
Language level
* ES5 - you must have a Promises/A+ library installed
* ES6
Module system
* CommonJS
* ES6 module system
It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html))
### Building
To build and compile the typescript sources to javascript use:
```
npm install
npm run build
```
### Publishing
First build the package then run `npm publish`
### Consuming
navigate to the folder of your consuming project and run one of the following commands.
_published:_
```
npm install {{npmName}}@{{npmVersion}} --save
```
_unPublished (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE --save
```

View File

@@ -0,0 +1,19 @@
import {all, fork} from "redux-saga/effects";
import {
{{#apiInfo}}
{{#apis}}
{{#lambda.camelcase}}{{classFilename}}{{/lambda.camelcase}}AllSagas,
{{/apis}}
{{/apiInfo}}
} from "./index{{importFileExtension}}";
export function *allApiSagas() {
yield all([
{{#apiInfo}}
{{#apis}}
fork({{#lambda.camelcase}}{{classFilename}}{{/lambda.camelcase}}AllSagas),
{{/apis}}
{{/apiInfo}}
]);
}

View File

@@ -0,0 +1,446 @@
/* tslint:disable */
/* eslint-disable */
{{>licenseInfo}}
import * as runtime from '../runtime{{importFileExtension}}';
{{#imports.0}}
import type {
{{#imports}}
{{className}},
{{/imports}}
} from '../models/index{{importFileExtension}}';
{{^withoutRuntimeChecks}}
import {
{{#imports}}
{{className}}FromJSON,
{{className}}ToJSON,
{{/imports}}
} from '../models/index{{importFileExtension}}';
{{/withoutRuntimeChecks}}
{{/imports.0}}
{{#operations}}
{{#operation}}
{{#allParams.0}}
export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request {
{{#allParams}}
{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{#hasReadOnly}}Omit<{{{dataType}}}, {{#readOnlyVars}}'{{baseName}}'{{^-last}}|{{/-last}}{{/readOnlyVars}}>{{/hasReadOnly}}{{^hasReadOnly}}{{{dataType}}}{{/hasReadOnly}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}};
{{/allParams}}
}
{{/allParams.0}}
{{/operation}}
{{/operations}}
{{#withInterfaces}}
{{#operations}}
/**
* {{classname}} - interface
* {{#lambda.indented_1}}{{{unescapedDescription}}}{{/lambda.indented_1}}
* @export
* @interface {{classname}}Interface
*/
export interface {{classname}}Interface {
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
* @throws {RequiredError}
* @memberof {{classname}}Interface
*/
{{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{{{returnType}}}{{^returnType}}void{{/returnType}}>>;
/**
{{#notes}}
* {{&notes}}
{{/notes}}
{{#summary}}
* {{&summary}}
{{/summary}}
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
{{^useSingleRequestParameter}}
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}>;
{{/useSingleRequestParameter}}
{{#useSingleRequestParameter}}
{{nickname}}({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}>;
{{/useSingleRequestParameter}}
{{/operation}}
}
{{/operations}}
{{/withInterfaces}}
{{#operations}}
/**
* {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}}
*/
{{#withInterfaces}}
export class {{classname}} extends runtime.BaseAPI implements {{classname}}Interface {
{{/withInterfaces}}
{{^withInterfaces}}
export class {{classname}} extends runtime.BaseAPI {
{{/withInterfaces}}
{{#operation}}
/**
{{#notes}}
* {{&notes}}
{{/notes}}
{{#summary}}
* {{&summary}}
{{/summary}}
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
async {{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
{{#allParams}}
{{#required}}
if (requestParameters['{{paramName}}'] == null) {
throw new runtime.RequiredError(
'{{paramName}}',
'Required parameter "{{paramName}}" was null or undefined when calling {{nickname}}().'
);
}
{{/required}}
{{/allParams}}
const queryParameters: any = {};
{{#queryParams}}
{{#isArray}}
if (requestParameters['{{paramName}}'] != null) {
{{#isCollectionFormatMulti}}
queryParameters['{{baseName}}'] = requestParameters['{{paramName}}'];
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
queryParameters['{{baseName}}'] = {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters['{{paramName}}']{{#uniqueItems}}){{/uniqueItems}}!.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]);
{{/isCollectionFormatMulti}}
}
{{/isArray}}
{{^isArray}}
if (requestParameters['{{paramName}}'] != null) {
{{#isDateTimeType}}
queryParameters['{{baseName}}'] = (requestParameters['{{paramName}}'] as any).toISOString();
{{/isDateTimeType}}
{{^isDateTimeType}}
{{#isDateType}}
queryParameters['{{baseName}}'] = (requestParameters['{{paramName}}'] as any).toISOString().substring(0,10);
{{/isDateType}}
{{^isDateType}}
queryParameters['{{baseName}}'] = requestParameters['{{paramName}}'];
{{/isDateType}}
{{/isDateTimeType}}
}
{{/isArray}}
{{/queryParams}}
const headerParameters: runtime.HTTPHeaders = {};
{{#bodyParam}}
{{^consumes}}
headerParameters['Content-Type'] = 'application/json';
{{/consumes}}
{{#consumes.0}}
headerParameters['Content-Type'] = '{{{mediaType}}}';
{{/consumes.0}}
{{/bodyParam}}
{{#headerParams}}
{{#isArray}}
if (requestParameters['{{paramName}}'] != null) {
headerParameters['{{baseName}}'] = {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters['{{paramName}}']{{#uniqueItems}}){{/uniqueItems}}!.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]);
}
{{/isArray}}
{{^isArray}}
if (requestParameters['{{paramName}}'] != null) {
headerParameters['{{baseName}}'] = String(requestParameters['{{paramName}}']);
}
{{/isArray}}
{{/headerParams}}
{{#authMethods}}
{{#isBasic}}
{{#isBasicBasic}}
if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) {
headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password);
}
{{/isBasicBasic}}
{{#isBasicBearer}}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
{{/isBasicBearer}}
{{/isBasic}}
{{#isApiKey}}
{{#isKeyInHeader}}
if (this.configuration && this.configuration.apiKey) {
headerParameters["{{keyParamName}}"] = await this.configuration.apiKey("{{keyParamName}}"); // {{name}} authentication
}
{{/isKeyInHeader}}
{{#isKeyInQuery}}
if (this.configuration && this.configuration.apiKey) {
queryParameters["{{keyParamName}}"] = await this.configuration.apiKey("{{keyParamName}}"); // {{name}} authentication
}
{{/isKeyInQuery}}
{{/isApiKey}}
{{#isOAuth}}
if (this.configuration && this.configuration.accessToken) {
// oauth required
headerParameters["Authorization"] = await this.configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]);
}
{{/isOAuth}}
{{/authMethods}}
{{#hasFormParams}}
const consumes: runtime.Consume[] = [
{{#consumes}}
{ contentType: '{{{mediaType}}}' },
{{/consumes}}
];
// @ts-ignore: canConsumeForm may be unused
const canConsumeForm = runtime.canConsumeForm(consumes);
let formParams: { append(param: string, value: any): any };
let useForm = false;
{{#formParams}}
{{#isFile}}
// use FormData to transmit files using content-type "multipart/form-data"
useForm = canConsumeForm;
{{/isFile}}
{{/formParams}}
if (useForm) {
formParams = new FormData();
} else {
formParams = new URLSearchParams();
}
{{#formParams}}
{{#isArray}}
if (requestParameters['{{paramName}}'] != null) {
{{#isCollectionFormatMulti}}
requestParameters['{{paramName}}'].forEach((element) => {
formParams.append('{{baseName}}{{#useSquareBracketsInArrayNames}}[]{{/useSquareBracketsInArrayNames}}', element as any);
})
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
formParams.append('{{baseName}}{{#useSquareBracketsInArrayNames}}[]{{/useSquareBracketsInArrayNames}}', {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters['{{paramName}}']{{#uniqueItems}}){{/uniqueItems}}!.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]));
{{/isCollectionFormatMulti}}
}
{{/isArray}}
{{^isArray}}
if (requestParameters['{{paramName}}'] != null) {
{{#isPrimitiveType}}
formParams.append('{{baseName}}', requestParameters['{{paramName}}'] as any);
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{^withoutRuntimeChecks}}
formParams.append('{{baseName}}', new Blob([JSON.stringify({{{dataType}}}ToJSON(requestParameters['{{paramName}}']))], { type: "application/json", }));
{{/withoutRuntimeChecks}}{{#withoutRuntimeChecks}}
formParams.append('{{baseName}}', new Blob([JSON.stringify(requestParameters['{{paramName}}'])], { type: "application/json", }));
{{/withoutRuntimeChecks}}
{{/isPrimitiveType}}
}
{{/isArray}}
{{/formParams}}
{{/hasFormParams}}
const response = await this.request({
path: `{{{path}}}`{{#pathParams}}.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String(requestParameters['{{paramName}}']))){{/pathParams}},
method: '{{httpMethod}}',
headers: headerParameters,
query: queryParameters,
{{#hasBodyParam}}
{{#bodyParam}}
{{#isContainer}}
{{^withoutRuntimeChecks}}
body: requestParameters['{{paramName}}']{{#isArray}}{{#items}}{{^isPrimitiveType}}!.map({{datatype}}ToJSON){{/isPrimitiveType}}{{/items}}{{/isArray}},
{{/withoutRuntimeChecks}}
{{#withoutRuntimeChecks}}
body: requestParameters['{{paramName}}'],
{{/withoutRuntimeChecks}}
{{/isContainer}}
{{^isContainer}}
{{^isPrimitiveType}}
{{^withoutRuntimeChecks}}
body: {{dataType}}ToJSON(requestParameters['{{paramName}}']),
{{/withoutRuntimeChecks}}
{{#withoutRuntimeChecks}}
body: requestParameters['{{paramName}}'],
{{/withoutRuntimeChecks}}
{{/isPrimitiveType}}
{{#isPrimitiveType}}
body: requestParameters['{{paramName}}'] as any,
{{/isPrimitiveType}}
{{/isContainer}}
{{/bodyParam}}
{{/hasBodyParam}}
{{#hasFormParams}}
body: formParams,
{{/hasFormParams}}
}, initOverrides);
{{#returnType}}
{{#isResponseFile}}
return new runtime.BlobApiResponse(response);
{{/isResponseFile}}
{{^isResponseFile}}
{{#returnTypeIsPrimitive}}
{{#isMap}}
return new runtime.JSONApiResponse<any>(response);
{{/isMap}}
{{#isArray}}
return new runtime.JSONApiResponse<any>(response);
{{/isArray}}
{{#returnSimpleType}}
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse<{{returnType}}>(response);
} else {
return new runtime.TextApiResponse(response) as any;
}
{{/returnSimpleType}}
{{/returnTypeIsPrimitive}}
{{^returnTypeIsPrimitive}}
{{#isArray}}
return new runtime.JSONApiResponse(response{{^withoutRuntimeChecks}}, (jsonValue) => {{#uniqueItems}}new Set({{/uniqueItems}}jsonValue.map({{returnBaseType}}FromJSON){{/withoutRuntimeChecks}}){{#uniqueItems}}){{/uniqueItems}};
{{/isArray}}
{{^isArray}}
{{#isMap}}
return new runtime.JSONApiResponse(response{{^withoutRuntimeChecks}}, (jsonValue) => runtime.mapValues(jsonValue, {{returnBaseType}}FromJSON){{/withoutRuntimeChecks}});
{{/isMap}}
{{^isMap}}
return new runtime.JSONApiResponse(response{{^withoutRuntimeChecks}}, (jsonValue) => {{returnBaseType}}FromJSON(jsonValue){{/withoutRuntimeChecks}});
{{/isMap}}
{{/isArray}}
{{/returnTypeIsPrimitive}}
{{/isResponseFile}}
{{/returnType}}
{{^returnType}}
return new runtime.VoidApiResponse(response);
{{/returnType}}
}
/**
{{#notes}}
* {{&notes}}
{{/notes}}
{{#summary}}
* {{&summary}}
{{/summary}}
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
{{^useSingleRequestParameter}}
async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{#returnType}}{{#isResponseOptional}} | null | undefined {{/isResponseOptional}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
{{#returnType}}
const response = await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }, {{/allParams.0}}initOverrides);
{{#isResponseOptional}}
switch (response.raw.status) {
{{#responses}}
{{#is2xx}}
case {{code}}:
return {{#dataType}}await response.value(){{/dataType}}{{^dataType}}null{{/dataType}};
{{/is2xx}}
{{/responses}}
default:
return await response.value();
}
{{/isResponseOptional}}
{{^isResponseOptional}}
return await response.value();
{{/isResponseOptional}}
{{/returnType}}
{{^returnType}}
await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }, {{/allParams.0}}initOverrides);
{{/returnType}}
}
{{/useSingleRequestParameter}}
{{#useSingleRequestParameter}}
async {{nickname}}({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{#returnType}}{{#isResponseOptional}} | null | undefined {{/isResponseOptional}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
{{#returnType}}
const response = await this.{{nickname}}Raw({{#allParams.0}}requestParameters, {{/allParams.0}}initOverrides);
{{#isResponseOptional}}
switch (response.raw.status) {
{{#responses}}
{{#is2xx}}
case {{code}}:
return {{#dataType}}await response.value(){{/dataType}}{{^dataType}}null{{/dataType}};
{{/is2xx}}
{{/responses}}
default:
return await response.value();
}
{{/isResponseOptional}}
{{^isResponseOptional}}
return await response.value();
{{/isResponseOptional}}
{{/returnType}}
{{^returnType}}
await this.{{nickname}}Raw({{#allParams.0}}requestParameters, {{/allParams.0}}initOverrides);
{{/returnType}}
}
{{/useSingleRequestParameter}}
{{/operation}}
}
{{/operations}}
{{#hasEnums}}
{{#operations}}
{{#operation}}
{{#allParams}}
{{#isEnum}}
{{#stringEnums}}
/**
* @export
* @enum {string}
*/
export enum {{operationIdCamelCase}}{{enumName}} {
{{#allowableValues}}
{{#enumVars}}
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}
{{/stringEnums}}
{{^stringEnums}}
/**
* @export
*/
export const {{operationIdCamelCase}}{{enumName}} = {
{{#allowableValues}}
{{#enumVars}}
{{{name}}}: {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
} as const;
export type {{operationIdCamelCase}}{{enumName}} = typeof {{operationIdCamelCase}}{{enumName}}[keyof typeof {{operationIdCamelCase}}{{enumName}}];
{{/stringEnums}}
{{/isEnum}}
{{/allParams}}
{{/operation}}
{{/operations}}
{{/hasEnums}}

View File

@@ -0,0 +1,16 @@
/* tslint:disable */
/* eslint-disable */
{{#useSagaAndRecords}}
export * from './SagaApiManager{{importFileExtension}}'
export * from './allSagas{{importFileExtension}}'
{{/useSagaAndRecords}}
{{#apiInfo}}
{{#apis}}
{{#operations}}
export * from './{{ classFilename }}{{importFileExtension}}';
{{#useSagaAndRecords}}
export * from './{{{ classFilename }}}Sagas{{importFileExtension}}';
{{/useSagaAndRecords}}
{{/operations}}
{{/apis}}
{{/apiInfo}}

View File

@@ -0,0 +1,446 @@
/* tslint:disable */
/* eslint-disable */
{{>licenseInfo}}
import * as runtime from '../runtime{{importFileExtension}}';
{{#imports.0}}
import type {
{{#imports}}
{{className}},
{{/imports}}
} from '../models/index{{importFileExtension}}';
{{^withoutRuntimeChecks}}
import {
{{#imports}}
{{className}}FromJSON,
{{className}}ToJSON,
{{/imports}}
} from '../models/index{{importFileExtension}}';
{{/withoutRuntimeChecks}}
{{/imports.0}}
{{#operations}}
{{#operation}}
{{#allParams.0}}
export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request {
{{#allParams}}
{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{#hasReadOnly}}Omit<{{{dataType}}}, {{#readOnlyVars}}'{{baseName}}'{{^-last}}|{{/-last}}{{/readOnlyVars}}>{{/hasReadOnly}}{{^hasReadOnly}}{{{dataType}}}{{/hasReadOnly}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}};
{{/allParams}}
}
{{/allParams.0}}
{{/operation}}
{{/operations}}
{{#withInterfaces}}
{{#operations}}
/**
* {{classname}} - interface
* {{#lambda.indented_1}}{{{unescapedDescription}}}{{/lambda.indented_1}}
* @export
* @interface {{classname}}Interface
*/
export interface {{classname}}Interface {
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
* @throws {RequiredError}
* @memberof {{classname}}Interface
*/
{{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{{{returnType}}}{{^returnType}}void{{/returnType}}>>;
/**
{{#notes}}
* {{&notes}}
{{/notes}}
{{#summary}}
* {{&summary}}
{{/summary}}
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
{{^useSingleRequestParameter}}
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}>;
{{/useSingleRequestParameter}}
{{#useSingleRequestParameter}}
{{nickname}}({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}>;
{{/useSingleRequestParameter}}
{{/operation}}
}
{{/operations}}
{{/withInterfaces}}
{{#operations}}
/**
* {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}}
*/
{{#withInterfaces}}
export class {{classname}} extends runtime.BaseAPI implements {{classname}}Interface {
{{/withInterfaces}}
{{^withInterfaces}}
export class {{classname}} extends runtime.BaseAPI {
{{/withInterfaces}}
{{#operation}}
/**
{{#notes}}
* {{&notes}}
{{/notes}}
{{#summary}}
* {{&summary}}
{{/summary}}
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
async {{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
{{#allParams}}
{{#required}}
if (requestParameters['{{paramName}}'] == null) {
throw new runtime.RequiredError(
'{{paramName}}',
'Required parameter "{{paramName}}" was null or undefined when calling {{nickname}}().'
);
}
{{/required}}
{{/allParams}}
const queryParameters: any = {};
{{#queryParams}}
{{#isArray}}
if (requestParameters['{{paramName}}'] != null) {
{{#isCollectionFormatMulti}}
queryParameters['{{baseName}}'] = requestParameters['{{paramName}}'];
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
queryParameters['{{baseName}}'] = {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters['{{paramName}}']{{#uniqueItems}}){{/uniqueItems}}!.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]);
{{/isCollectionFormatMulti}}
}
{{/isArray}}
{{^isArray}}
if (requestParameters['{{paramName}}'] != null) {
{{#isDateTimeType}}
queryParameters['{{baseName}}'] = (requestParameters['{{paramName}}'] as any).toISOString();
{{/isDateTimeType}}
{{^isDateTimeType}}
{{#isDateType}}
queryParameters['{{baseName}}'] = (requestParameters['{{paramName}}'] as any).toISOString().substring(0,10);
{{/isDateType}}
{{^isDateType}}
queryParameters['{{baseName}}'] = requestParameters['{{paramName}}'];
{{/isDateType}}
{{/isDateTimeType}}
}
{{/isArray}}
{{/queryParams}}
const headerParameters: runtime.HTTPHeaders = {};
{{#bodyParam}}
{{^consumes}}
headerParameters['Content-Type'] = 'application/json';
{{/consumes}}
{{#consumes.0}}
headerParameters['Content-Type'] = '{{{mediaType}}}';
{{/consumes.0}}
{{/bodyParam}}
{{#headerParams}}
{{#isArray}}
if (requestParameters['{{paramName}}'] != null) {
headerParameters['{{baseName}}'] = {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters['{{paramName}}']{{#uniqueItems}}){{/uniqueItems}}!.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]);
}
{{/isArray}}
{{^isArray}}
if (requestParameters['{{paramName}}'] != null) {
headerParameters['{{baseName}}'] = String(requestParameters['{{paramName}}']);
}
{{/isArray}}
{{/headerParams}}
{{#authMethods}}
{{#isBasic}}
{{#isBasicBasic}}
if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) {
headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password);
}
{{/isBasicBasic}}
{{#isBasicBearer}}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
{{/isBasicBearer}}
{{/isBasic}}
{{#isApiKey}}
{{#isKeyInHeader}}
if (this.configuration && this.configuration.apiKey) {
headerParameters["{{keyParamName}}"] = await this.configuration.apiKey("{{keyParamName}}"); // {{name}} authentication
}
{{/isKeyInHeader}}
{{#isKeyInQuery}}
if (this.configuration && this.configuration.apiKey) {
queryParameters["{{keyParamName}}"] = await this.configuration.apiKey("{{keyParamName}}"); // {{name}} authentication
}
{{/isKeyInQuery}}
{{/isApiKey}}
{{#isOAuth}}
if (this.configuration && this.configuration.accessToken) {
// oauth required
headerParameters["Authorization"] = await this.configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]);
}
{{/isOAuth}}
{{/authMethods}}
{{#hasFormParams}}
const consumes: runtime.Consume[] = [
{{#consumes}}
{ contentType: '{{{mediaType}}}' },
{{/consumes}}
];
// @ts-ignore: canConsumeForm may be unused
const canConsumeForm = runtime.canConsumeForm(consumes);
let formParams: { append(param: string, value: any): any };
let useForm = false;
{{#formParams}}
{{#isFile}}
// use FormData to transmit files using content-type "multipart/form-data"
useForm = canConsumeForm;
{{/isFile}}
{{/formParams}}
if (useForm) {
formParams = new FormData();
} else {
formParams = new URLSearchParams();
}
{{#formParams}}
{{#isArray}}
if (requestParameters['{{paramName}}'] != null) {
{{#isCollectionFormatMulti}}
requestParameters['{{paramName}}'].forEach((element) => {
formParams.append('{{baseName}}{{#useSquareBracketsInArrayNames}}[]{{/useSquareBracketsInArrayNames}}', element as any);
})
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
formParams.append('{{baseName}}{{#useSquareBracketsInArrayNames}}[]{{/useSquareBracketsInArrayNames}}', {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters['{{paramName}}']{{#uniqueItems}}){{/uniqueItems}}!.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]));
{{/isCollectionFormatMulti}}
}
{{/isArray}}
{{^isArray}}
if (requestParameters['{{paramName}}'] != null) {
{{#isPrimitiveType}}
formParams.append('{{baseName}}', requestParameters['{{paramName}}'] as any);
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{^withoutRuntimeChecks}}
formParams.append('{{baseName}}', new Blob([JSON.stringify({{{dataType}}}ToJSON(requestParameters['{{paramName}}']))], { type: "application/json", }));
{{/withoutRuntimeChecks}}{{#withoutRuntimeChecks}}
formParams.append('{{baseName}}', new Blob([JSON.stringify(requestParameters['{{paramName}}'])], { type: "application/json", }));
{{/withoutRuntimeChecks}}
{{/isPrimitiveType}}
}
{{/isArray}}
{{/formParams}}
{{/hasFormParams}}
const response = await this.request({
path: `{{{path}}}`{{#pathParams}}.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String(requestParameters['{{paramName}}']))){{/pathParams}},
method: '{{httpMethod}}',
headers: headerParameters,
query: queryParameters,
{{#hasBodyParam}}
{{#bodyParam}}
{{#isContainer}}
{{^withoutRuntimeChecks}}
body: requestParameters['{{paramName}}']{{#isArray}}{{#items}}{{^isPrimitiveType}}!.map({{datatype}}ToJSON){{/isPrimitiveType}}{{/items}}{{/isArray}},
{{/withoutRuntimeChecks}}
{{#withoutRuntimeChecks}}
body: requestParameters['{{paramName}}'],
{{/withoutRuntimeChecks}}
{{/isContainer}}
{{^isContainer}}
{{^isPrimitiveType}}
{{^withoutRuntimeChecks}}
body: {{dataType}}ToJSON(requestParameters['{{paramName}}']),
{{/withoutRuntimeChecks}}
{{#withoutRuntimeChecks}}
body: requestParameters['{{paramName}}'],
{{/withoutRuntimeChecks}}
{{/isPrimitiveType}}
{{#isPrimitiveType}}
body: requestParameters['{{paramName}}'] as any,
{{/isPrimitiveType}}
{{/isContainer}}
{{/bodyParam}}
{{/hasBodyParam}}
{{#hasFormParams}}
body: formParams,
{{/hasFormParams}}
}, initOverrides);
{{#returnType}}
{{#isResponseFile}}
return new runtime.BlobApiResponse(response);
{{/isResponseFile}}
{{^isResponseFile}}
{{#returnTypeIsPrimitive}}
{{#isMap}}
return new runtime.JSONApiResponse<any>(response);
{{/isMap}}
{{#isArray}}
return new runtime.JSONApiResponse<any>(response);
{{/isArray}}
{{#returnSimpleType}}
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse<{{returnType}}>(response);
} else {
return new runtime.TextApiResponse(response) as any;
}
{{/returnSimpleType}}
{{/returnTypeIsPrimitive}}
{{^returnTypeIsPrimitive}}
{{#isArray}}
return new runtime.JSONApiResponse(response{{^withoutRuntimeChecks}}, (jsonValue) => {{#uniqueItems}}new Set({{/uniqueItems}}jsonValue.map({{returnBaseType}}FromJSON){{/withoutRuntimeChecks}}){{#uniqueItems}}){{/uniqueItems}};
{{/isArray}}
{{^isArray}}
{{#isMap}}
return new runtime.JSONApiResponse(response{{^withoutRuntimeChecks}}, (jsonValue) => runtime.mapValues(jsonValue, {{returnBaseType}}FromJSON){{/withoutRuntimeChecks}});
{{/isMap}}
{{^isMap}}
return new runtime.JSONApiResponse(response{{^withoutRuntimeChecks}}, (jsonValue) => {{returnBaseType}}FromJSON(jsonValue){{/withoutRuntimeChecks}});
{{/isMap}}
{{/isArray}}
{{/returnTypeIsPrimitive}}
{{/isResponseFile}}
{{/returnType}}
{{^returnType}}
return new runtime.VoidApiResponse(response);
{{/returnType}}
}
/**
{{#notes}}
* {{&notes}}
{{/notes}}
{{#summary}}
* {{&summary}}
{{/summary}}
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
{{^useSingleRequestParameter}}
async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{#returnType}}{{#isResponseOptional}} | null | undefined {{/isResponseOptional}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
{{#returnType}}
const response = await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }, {{/allParams.0}}initOverrides);
{{#isResponseOptional}}
switch (response.raw.status) {
{{#responses}}
{{#is2xx}}
case {{code}}:
return {{#dataType}}await response.value(){{/dataType}}{{^dataType}}null{{/dataType}};
{{/is2xx}}
{{/responses}}
default:
return await response.value();
}
{{/isResponseOptional}}
{{^isResponseOptional}}
return await response.value();
{{/isResponseOptional}}
{{/returnType}}
{{^returnType}}
await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }, {{/allParams.0}}initOverrides);
{{/returnType}}
}
{{/useSingleRequestParameter}}
{{#useSingleRequestParameter}}
async {{nickname}}({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{#returnType}}{{#isResponseOptional}} | null | undefined {{/isResponseOptional}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
{{#returnType}}
const response = await this.{{nickname}}Raw({{#allParams.0}}requestParameters, {{/allParams.0}}initOverrides);
{{#isResponseOptional}}
switch (response.raw.status) {
{{#responses}}
{{#is2xx}}
case {{code}}:
return {{#dataType}}await response.value(){{/dataType}}{{^dataType}}null{{/dataType}};
{{/is2xx}}
{{/responses}}
default:
return await response.value();
}
{{/isResponseOptional}}
{{^isResponseOptional}}
return await response.value();
{{/isResponseOptional}}
{{/returnType}}
{{^returnType}}
await this.{{nickname}}Raw({{#allParams.0}}requestParameters, {{/allParams.0}}initOverrides);
{{/returnType}}
}
{{/useSingleRequestParameter}}
{{/operation}}
}
{{/operations}}
{{#hasEnums}}
{{#operations}}
{{#operation}}
{{#allParams}}
{{#isEnum}}
{{#stringEnums}}
/**
* @export
* @enum {string}
*/
export enum {{operationIdCamelCase}}{{enumName}} {
{{#allowableValues}}
{{#enumVars}}
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}
{{/stringEnums}}
{{^stringEnums}}
/**
* @export
*/
export const {{operationIdCamelCase}}{{enumName}} = {
{{#allowableValues}}
{{#enumVars}}
{{{name}}}: {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
} as const;
export type {{operationIdCamelCase}}{{enumName}} = typeof {{operationIdCamelCase}}{{enumName}}[keyof typeof {{operationIdCamelCase}}{{enumName}}];
{{/stringEnums}}
{{/isEnum}}
{{/allParams}}
{{/operation}}
{{/operations}}
{{/hasEnums}}

View File

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

View File

@@ -0,0 +1,17 @@
/* tslint:disable */
/* eslint-disable */
export * from './runtime{{importFileExtension}}';
{{#useSagaAndRecords}}
export * from './runtimeSagasAndRecords{{importFileExtension}}';
export * from './ApiEntitiesRecord{{importFileExtension}}';
export * from './ApiEntitiesReducer{{importFileExtension}}';
export * from './ApiEntitiesSelectors{{importFileExtension}}';
{{/useSagaAndRecords}}
{{#apiInfo}}
{{#apis.0}}
export * from './apis/index{{importFileExtension}}';
{{/apis.0}}
{{/apiInfo}}
{{#models.0}}
export * from './models/index{{importFileExtension}}';
{{/models.0}}

View File

@@ -0,0 +1,11 @@
/**
* {{{appName}}}
* {{{appDescription}}}
*
* {{#version}}The version of the OpenAPI document: {{{.}}}{{/version}}
* {{#infoEmail}}Contact: {{{.}}}{{/infoEmail}}
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -0,0 +1,24 @@
{{>modelEnumInterfaces}}
export function instanceOf{{classname}}(value: any): boolean {
for (const key in {{classname}}) {
if (Object.prototype.hasOwnProperty.call({{classname}}, key)) {
if (({{classname}} as Record<string, {{classname}}>)[key] === value) {
return true;
}
}
}
return false;
}
export function {{classname}}FromJSON(json: any): {{classname}} {
return {{classname}}FromJSONTyped(json, false);
}
export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boolean): {{classname}} {
return json as {{classname}};
}
export function {{classname}}ToJSON(value?: {{classname}} | null): any {
return value as any;
}

View File

@@ -0,0 +1,27 @@
{{#stringEnums}}
/**
* {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}}
* @export
* @enum {string}
*/
export enum {{classname}} {
{{#allowableValues}}
{{#enumVars}}
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}
{{/stringEnums}}{{^stringEnums}}
/**
* {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}}
* @export
*/
export const {{classname}} = {
{{#allowableValues}}
{{#enumVars}}
{{{name}}}: {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
} as const;
export type {{classname}} = typeof {{classname}}[keyof typeof {{classname}}];
{{/stringEnums}}

View File

@@ -0,0 +1,160 @@
import { mapValues } from '../runtime{{importFileExtension}}';
{{#hasImports}}
{{#tsImports}}
import type { {{{classname}}} } from './{{filename}}{{importFileExtension}}';
import {
{{classname}}FromJSON,
{{classname}}FromJSONTyped,
{{classname}}ToJSON,
} from './{{filename}}{{importFileExtension}}';
{{/tsImports}}
{{/hasImports}}
{{#discriminator}}
{{#discriminator.mappedModels}}
import { {{modelName}}FromJSONTyped } from './{{modelName}}{{importFileExtension}}';
{{/discriminator.mappedModels}}
{{/discriminator}}
{{>modelGenericInterfaces}}
/**
* Check if a given object implements the {{classname}} interface.
*/
export function instanceOf{{classname}}(value: object): value is {{classname}} {
{{#vars}}
{{#required}}
if (!('{{name}}' in value) || value['{{name}}'] === undefined) return false;
{{/required}}
{{/vars}}
return true;
}
export function {{classname}}FromJSON(json: any): {{classname}} {
return {{classname}}FromJSONTyped(json, false);
}
export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boolean): {{classname}} {
{{#hasVars}}
if (json == null) {
return json;
}
{{#discriminator}}
if (!ignoreDiscriminator) {
{{#discriminator.mappedModels}}
if (json['{{discriminator.propertyBaseName}}'] === '{{mappingName}}') {
return {{modelName}}FromJSONTyped(json, true);
}
{{/discriminator.mappedModels}}
}
{{/discriminator}}
return {
{{#parent}}...{{{.}}}FromJSONTyped(json, ignoreDiscriminator),{{/parent}}
{{#additionalPropertiesType}}
...json,
{{/additionalPropertiesType}}
{{#vars}}
{{#isPrimitiveType}}
{{#isDateType}}
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}({{#required}}{{#isNullable}}json['{{baseName}}'] == null ? null : {{/isNullable}}{{/required}}new Date(json['{{baseName}}'])),
{{/isDateType}}
{{#isDateTimeType}}
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}({{#required}}{{#isNullable}}json['{{baseName}}'] == null ? null : {{/isNullable}}{{/required}}new Date(json['{{baseName}}'])),
{{/isDateTimeType}}
{{^isDateType}}
{{^isDateTimeType}}
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}json['{{baseName}}'],
{{/isDateTimeType}}
{{/isDateType}}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{#isArray}}
{{#uniqueItems}}
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}({{#required}}{{#isNullable}}json['{{baseName}}'] == null ? null : {{/isNullable}}{{/required}}new Set((json['{{baseName}}'] as Array<any>).map({{#items}}{{datatype}}{{/items}}FromJSON))),
{{/uniqueItems}}
{{^uniqueItems}}
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}({{#required}}{{#isNullable}}json['{{baseName}}'] == null ? null : {{/isNullable}}{{/required}}(json['{{baseName}}'] as Array<any>).map({{#items}}{{datatype}}{{/items}}FromJSON)),
{{/uniqueItems}}
{{/isArray}}
{{#isMap}}
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}({{#required}}{{#isNullable}}json['{{baseName}}'] == null ? null : {{/isNullable}}{{/required}}mapValues(json['{{baseName}}'], {{#items}}{{datatype}}{{/items}}FromJSON)),
{{/isMap}}
{{^isArray}}
{{^isMap}}
{{^isFreeFormObject}}
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}{{datatype}}FromJSON(json['{{baseName}}']),
{{/isFreeFormObject}}
{{#isFreeFormObject}}
'{{name}}': {{^required}}json['{{baseName}}'] == null ? undefined : {{/required}}json['{{baseName}}'],
{{/isFreeFormObject}}
{{/isMap}}
{{/isArray}}
{{/isPrimitiveType}}
{{/vars}}
};
{{/hasVars}}
{{^hasVars}}
return json;
{{/hasVars}}
}
export function {{classname}}ToJSON(value?: {{#hasReadOnly}}Omit<{{classname}}, {{#readOnlyVars}}'{{baseName}}'{{^-last}}|{{/-last}}{{/readOnlyVars}}>{{/hasReadOnly}}{{^hasReadOnly}}{{classname}}{{/hasReadOnly}} | null): any {
{{#hasVars}}
if (value == null) {
return value;
}
return {
{{#parent}}...{{{.}}}ToJSON(value),{{/parent}}
{{#additionalPropertiesType}}
...value,
{{/additionalPropertiesType}}
{{#vars}}
{{^isReadOnly}}
{{#isPrimitiveType}}
{{#isDateType}}
'{{baseName}}': {{^required}}value['{{name}}'] == null ? undefined : {{/required}}({{#required}}{{#isNullable}}value['{{name}}'] == null ? null : {{/isNullable}}{{/required}}(value['{{name}}']{{#isNullable}} as any{{/isNullable}}).toISOString().substring(0,10)),
{{/isDateType}}
{{#isDateTimeType}}
'{{baseName}}': {{^required}}value['{{name}}'] == null ? undefined : {{/required}}({{#required}}{{#isNullable}}value['{{name}}'] == null ? null : {{/isNullable}}{{/required}}(value['{{name}}']{{#isNullable}} as any{{/isNullable}}).toISOString()),
{{/isDateTimeType}}
{{#isArray}}
'{{baseName}}': {{#uniqueItems}}{{^required}}value['{{name}}'] == null ? undefined : {{/required}}{{#required}}{{#isNullable}}value['{{name}}'] == null ? null : {{/isNullable}}{{/required}}Array.from(value['{{name}}'] as Set<any>){{/uniqueItems}}{{^uniqueItems}}value['{{name}}']{{/uniqueItems}},
{{/isArray}}
{{^isDateType}}
{{^isDateTimeType}}
{{^isArray}}
'{{baseName}}': value['{{name}}'],
{{/isArray}}
{{/isDateTimeType}}
{{/isDateType}}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{#isArray}}
{{#uniqueItems}}
'{{baseName}}': {{^required}}value['{{name}}'] == null ? undefined : {{/required}}({{#required}}{{#isNullable}}value['{{name}}'] == null ? null : {{/isNullable}}{{/required}}Array.from(value['{{name}}'] as Set<any>).map({{#items}}{{datatype}}{{/items}}ToJSON)),
{{/uniqueItems}}
{{^uniqueItems}}
'{{baseName}}': {{^required}}value['{{name}}'] == null ? undefined : {{/required}}({{#required}}{{#isNullable}}value['{{name}}'] == null ? null : {{/isNullable}}{{/required}}(value['{{name}}'] as Array<any>).map({{#items}}{{datatype}}{{/items}}ToJSON)),
{{/uniqueItems}}
{{/isArray}}
{{#isMap}}
'{{baseName}}': {{^required}}value['{{name}}'] == null ? undefined : {{/required}}({{#required}}{{#isNullable}}value['{{name}}'] == null ? null : {{/isNullable}}{{/required}}mapValues(value['{{name}}'], {{#items}}{{datatype}}{{/items}}ToJSON)),
{{/isMap}}
{{^isArray}}
{{^isMap}}
{{^isFreeFormObject}}
'{{baseName}}': {{datatype}}ToJSON(value['{{name}}']),
{{/isFreeFormObject}}
{{#isFreeFormObject}}
'{{baseName}}': value['{{name}}'],
{{/isFreeFormObject}}
{{/isMap}}
{{/isArray}}
{{/isPrimitiveType}}
{{/isReadOnly}}
{{/vars}}
};
{{/hasVars}}
{{^hasVars}}
return value;
{{/hasVars}}
}

View File

@@ -0,0 +1,50 @@
/**
* {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}}
* @export
* @interface {{classname}}
*/
export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{
{{#additionalPropertiesType}}
[key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}};
{{/additionalPropertiesType}}
{{#vars}}
/**
* {{#lambda.indented_star_4}}{{{unescapedDescription}}}{{/lambda.indented_star_4}}
* @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%>
* @memberof {{classname}}
{{#deprecated}}
* @deprecated
{{/deprecated}}
*/
{{#isReadOnly}}readonly {{/isReadOnly}}{{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}};
{{/vars}}
}{{#hasEnums}}
{{#vars}}
{{#isEnum}}
{{#stringEnums}}
/**
* @export
* @enum {string}
*/
export enum {{classname}}{{enumName}} {
{{#allowableValues}}
{{#enumVars}}
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}
{{/stringEnums}}{{^stringEnums}}
/**
* @export
*/
export const {{classname}}{{enumName}} = {
{{#allowableValues}}
{{#enumVars}}
{{{name}}}: {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
} as const;
export type {{classname}}{{enumName}} = typeof {{classname}}{{enumName}}[keyof typeof {{classname}}{{enumName}}];
{{/stringEnums}}
{{/isEnum}}{{/vars}}{{/hasEnums}}

View File

@@ -0,0 +1,66 @@
{{#hasImports}}
{{#oneOf}}
import type { {{{.}}} } from './{{.}}{{importFileExtension}}';
import {
instanceOf{{{.}}},
{{{.}}}FromJSON,
{{{.}}}FromJSONTyped,
{{{.}}}ToJSON,
} from './{{.}}{{importFileExtension}}';
{{/oneOf}}
{{/hasImports}}
{{>modelOneOfInterfaces}}
export function {{classname}}FromJSON(json: any): {{classname}} {
return {{classname}}FromJSONTyped(json, false);
}
export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boolean): {{classname}} {
if (json == null) {
return json;
}
{{#discriminator}}
switch (json['{{discriminator.propertyBaseName}}']) {
{{#discriminator.mappedModels}}
case '{{mappingName}}':
return Object.assign({}, {{modelName}}FromJSONTyped(json, true), { {{discriminator.propertyName}}: '{{mappingName}}' } as const);
{{/discriminator.mappedModels}}
default:
throw new Error(`No variant of {{classname}} exists with '{{discriminator.propertyName}}=${json['{{discriminator.propertyName}}']}'`);
}
{{/discriminator}}
{{^discriminator}}
{{#oneOf}}
if (instanceOf{{{.}}}(json)) {
return {{{.}}}FromJSONTyped(json, true);
}
{{/oneOf}}
{{/discriminator}}
}
export function {{classname}}ToJSON(value?: {{classname}} | null): any {
if (value == null) {
return value;
}
{{#discriminator}}
switch (value['{{discriminator.propertyName}}']) {
{{#discriminator.mappedModels}}
case '{{mappingName}}':
return {{modelName}}ToJSON(value);
{{/discriminator.mappedModels}}
default:
throw new Error(`No variant of {{classname}} exists with '{{discriminator.propertyName}}=${value['{{discriminator.propertyName}}']}'`);
}
{{/discriminator}}
{{^discriminator}}
{{#oneOf}}
if (instanceOf{{{.}}}(value)) {
return {{{.}}}ToJSON(value as {{{.}}});
}
{{/oneOf}}
return {};
{{/discriminator}}
}

View File

@@ -0,0 +1,6 @@
/**
* @type {{classname}}
* {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}}
* @export
*/
export type {{classname}} = {{#discriminator}}{{#mappedModels}}{ {{discriminator.propertyName}}: '{{mappingName}}' } & {{modelName}}{{^-last}} | {{/-last}}{{/mappedModels}}{{/discriminator}}{{^discriminator}}{{#oneOf}}{{{.}}}{{^-last}} | {{/-last}}{{/oneOf}}{{/discriminator}};

View File

@@ -0,0 +1,3 @@
/* tslint:disable */
/* eslint-disable */
// TODO: add model tests

View File

@@ -0,0 +1,29 @@
/* tslint:disable */
/* eslint-disable */
{{#models}}
{{#model}}
{{^withoutRuntimeChecks}}
export * from './{{{ classFilename }}}{{importFileExtension}}';
{{#useSagaAndRecords}}
{{^isEnum}}
export * from './{{{ classFilename }}}Record{{importFileExtension}}';
{{/isEnum}}
{{/useSagaAndRecords}}
{{/withoutRuntimeChecks}}
{{#withoutRuntimeChecks}}
{{#isEnum}}
{{>modelEnumInterfaces}}
{{/isEnum}}
{{^isEnum}}
{{#oneOf}}
{{#-first}}
{{>modelOneOfInterfaces}}
{{/-first}}
{{/oneOf}}
{{^oneOf}}
{{>modelGenericInterfaces}}
{{/oneOf}}
{{/isEnum}}
{{/withoutRuntimeChecks}}
{{/model}}
{{/models}}

View File

@@ -0,0 +1,20 @@
/* tslint:disable */
/* eslint-disable */
{{>licenseInfo}}
{{#models}}
{{#model}}
{{#isEnum}}
{{>modelEnum}}
{{/isEnum}}
{{^isEnum}}
{{#oneOf}}
{{#-first}}
{{>modelOneOf}}
{{/-first}}
{{/oneOf}}
{{^oneOf}}
{{>modelGeneric}}
{{/oneOf}}
{{/isEnum}}
{{/model}}
{{/models}}

View File

@@ -0,0 +1 @@
README.md

View File

@@ -0,0 +1,40 @@
{
"name": "{{npmName}}",
"version": "{{npmVersion}}",
"description": "OpenAPI client for {{npmName}}",
"author": "OpenAPI-Generator",
"repository": {
"type": "git",
"url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git"
},
{{#packageAsSourceOnlyLibrary}}
"main": "./index.ts",
{{/packageAsSourceOnlyLibrary}}
{{^packageAsSourceOnlyLibrary}}
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
{{#supportsES6}}
"module": "./dist/esm/index.js",
"sideEffects": false,
{{/supportsES6}}
"scripts": {
"build": "tsc{{#supportsES6}} && tsc -p tsconfig.esm.json{{/supportsES6}}"{{^sagasAndRecords}},
"prepare": "npm run build"{{/sagasAndRecords}}
},
{{/packageAsSourceOnlyLibrary}}
"devDependencies": {
{{#sagasAndRecords}}
"immutable": "^4.0.0-rc.12",
"normalizr": "^3.6.1",
"redux-saga": "^1.1.3",
"redux-ts-simple": "^3.2.0",
"reselect": "^4.0.0",
{{/sagasAndRecords}}
"typescript": "^4.0 || ^5.0"
}{{#npmRepository}},{{/npmRepository}}
{{#npmRepository}}
"publishConfig": {
"registry": "{{npmRepository}}"
}
{{/npmRepository}}
}

View File

@@ -0,0 +1,295 @@
import {ApiRecordUtils, knownRecordFactories{{#returnPassthrough}}, appFromJS, NormalizedRecordEntities{{/returnPassthrough}}} from "../runtimeSagasAndRecords{{importFileExtension}}";
import {getApiEntitiesState} from "../ApiEntitiesSelectors{{importFileExtension}}"
import {List, Record, RecordOf, Map} from 'immutable';
import {Schema, schema, NormalizedSchema} from "normalizr";
import {select, call} from "redux-saga/effects";
import {
{{classname}},
{{#vars}}
{{#isEnum}}
{{classname}}{{enumName}},
{{/isEnum}}
{{/vars}}
} from './{{classname}}{{importFileExtension}}';
{{#imports}}
import {
{{{.}}},
} from './{{{.}}}{{importFileExtension}}';
{{/imports}}
{{#modelImports}}
import {
{{{.}}}Record,
{{#lambda.camelcase}}{{.}}{{/lambda.camelcase}}RecordUtils
} from './{{{.}}}Record{{importFileExtension}}';
{{/modelImports}}
export const {{classname}}RecordProps = {
recType: "{{classname}}ApiRecord" as "{{classname}}ApiRecord",
{{#vars}}
{{#isArray}}
{{#items.isModel}}
{{#keepAsJSObject}}
{{name}}: {{#required}}new {{{dataType}}}(){{/required}}{{^required}}null as {{{dataType}}} | null{{/required}},
{{/keepAsJSObject}}
{{^keepAsJSObject}}
{{name}}: ({{{items.dataType}}}Record(), {{#required}}{{{defaultValue}}}{{/required}}{{^required}}null as {{{dataTypeAlternate}}} | null{{/required}}),
{{/keepAsJSObject}}
{{/items.isModel}}
{{^items.isModel}}
{{name}}: {{#required}}{{{defaultValue}}}{{/required}}{{^required}}null as {{{dataTypeAlternate}}} | null{{/required}},
{{/items.isModel}}
{{/isArray}}
{{#isModel}}
{{#keepAsJSObject}}
{{name}}: {{#required}}{} as any as {{{dataType}}}{{/required}}{{^required}}null as {{{dataType}}} | null{{/required}},
{{/keepAsJSObject}}
{{^keepAsJSObject}}
{{name}}: {{#required}}{{{defaultValue}}}{{/required}}{{^required}}({{{defaultValue}}}, null as {{{dataTypeAlternate}}} | null){{/required}},
{{/keepAsJSObject}}
{{/isModel}}
{{^isArray}}
{{^isModel}}
{{name}}: {{#required}}{{{defaultValue}}}{{/required}}{{^required}}null as {{{dataTypeAlternate}}} | null{{/required}},
{{/isModel}}
{{/isArray}}
{{/vars}}
};
export type {{classname}}RecordPropsType = typeof {{classname}}RecordProps;
export const {{classname}}Record = Record({{classname}}RecordProps, {{classname}}RecordProps.recType);
export type {{classname}}Record = RecordOf<{{classname}}RecordPropsType>;
knownRecordFactories.set({{classname}}RecordProps.recType, {{classname}}Record);
{{#isEntity}}
export const {{classname}}RecordEntityProps = {
...{{classname}}RecordProps,
recType: "{{classname}}ApiRecordEntity" as "{{classname}}ApiRecordEntity",
{{#vars}}
{{#isEntity}}
{{^keepAsJSObject}}
{{name}}: {{#required}}"-1"{{/required}}{{^required}}null as string | null{{/required}},
{{/keepAsJSObject}}
{{/isEntity}}
{{#isArray}}
{{#items.isEntity}}
{{^keepAsJSObject}}
{{name}}: {{#required}}List<string>(){{/required}}{{^required}}null as List<string> | null{{/required}},
{{/keepAsJSObject}}
{{/items.isEntity}}
{{/isArray}}
{{/vars}}
};
export type {{classname}}RecordEntityPropsType = typeof {{classname}}RecordEntityProps;
export const {{classname}}RecordEntity = Record({{classname}}RecordEntityProps, {{classname}}RecordEntityProps.recType);
export type {{classname}}RecordEntity = RecordOf<{{classname}}RecordEntityPropsType>;
knownRecordFactories.set({{classname}}RecordEntityProps.recType, {{classname}}RecordEntity);
{{/isEntity}}
class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname}}Record> {
public normalize(apiObject: {{classname}}, asEntity?: boolean): {{classname}} {
(apiObject as any).recType = {{#isEntity}}asEntity ? {{classname}}RecordEntityProps.recType : {{/isEntity}}{{classname}}RecordProps.recType;
{{#vars}}
{{#isUniqueId}}
{{#isArray}}
{{#items.isArray}}
{{^required}}if (apiObject['{{name}}']) { {{/required}}(apiObject as any)['{{name}}'] = apiObject['{{name}}'].map(item => item.map(item2 => item2?.toString()));{{^required}} } {{/required}}
{{/items.isArray}}
{{^items.isArray}}
{{^required}}if (apiObject['{{name}}']) { {{/required}}(apiObject as any)['{{name}}'] = apiObject['{{name}}'].map(item => item?.toString());{{^required}} } {{/required}}
{{/items.isArray}}
{{/isArray}}
{{^isArray}}
{{^required}}if (apiObject['{{name}}']) { {{/required}}(apiObject as any)['{{name}}'] = apiObject['{{name}}'].toString();{{^required}} } {{/required}}
{{/isArray}}
{{/isUniqueId}}
{{^keepAsJSObject}}
{{#isModel}}
{{^required}}if (apiObject['{{name}}']) { {{/required}}{{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.normalize(apiObject['{{name}}']);{{^required}} } {{/required}}
{{/isModel}}
{{#isArray}}
{{#items.isModel}}
{{^required}}if (apiObject['{{name}}']) { {{/required}}{{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.normalizeArray(apiObject['{{name}}']);{{^required}} } {{/required}}
{{/items.isModel}}
{{/isArray}}
{{/keepAsJSObject}}
{{/vars}}
return apiObject;
}
{{#isEntity}}
public getSchema(): Schema {
return new schema.Entity("{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}", {
{{#vars}}
{{#isEntity}}
{{^keepAsJSObject}}
{{name}}: {{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.getSchema(),
{{/keepAsJSObject}}
{{/isEntity}}
{{#isArray}}
{{#items.isEntity}}
{{^keepAsJSObject}}
{{name}}: [{{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.getSchema()],
{{/keepAsJSObject}}
{{/items.isEntity}}
{{/isArray}}
{{/vars}}
});
}
public *toInlined(entityId?: string | null) {
if (!entityId) {return undefined; }
// @ts-ignore
const entity = yield select(apiEntity{{classname}}Selector, {id: entityId});
if (!entity) {return undefined; }
const {
recType,
{{#vars}}
{{#isEntity}}
{{^keepAsJSObject}}
{{name}}: {{name}}_original,
{{/keepAsJSObject}}
{{/isEntity}}
{{#isArray}}
{{#items.isEntity}}
{{^keepAsJSObject}}
{{name}}: {{name}}_original,
{{/keepAsJSObject}}
{{/items.isEntity}}
{{/isArray}}
{{/vars}}
...unchangedProperties
} = entity;
const entityProperties = {
{{#vars}}
{{#isEntity}}
{{^keepAsJSObject}}
// @ts-ignore
{{name}}: {{^required}}entity['{{name}}'] ? {{/required}}yield call({{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.toInlined, entity['{{name}}']){{^required}} : null{{/required}},
{{/keepAsJSObject}}
{{/isEntity}}
{{#isArray}}
{{#items.isEntity}}
{{^keepAsJSObject}}
// @ts-ignore
{{name}}: {{^required}}entity['{{name}}'] ? {{/required}}yield call({{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.toInlinedArray, entity['{{name}}']){{^required}} : null{{/required}},
{{/keepAsJSObject}}
{{/items.isEntity}}
{{/isArray}}
{{/vars}}
}
return {{classname}}Record({
...unchangedProperties,
...entityProperties
});
}
public *toInlinedArray(entityIds: List<string> | null) {
if (!entityIds) {return null; }
let entities = List<{{classname}}Record>();
for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) {
// @ts-ignore
const entity = yield call(this.toInlined, entityIds.get(entityIndex));
if (entity) {
entities.push(entity);
}
}
return entities;
}
{{/isEntity}}
public toApi(record: {{classname}}Record): {{classname}} {
const apiObject = super.toApi(record);
{{#vars}}
{{#isUniqueId}}
{{#isArray}}
{{#items.isArray}}
{{^required}}if (record['{{name}}']) { {{/required}}apiObject['{{name}}'] = {{#isArray}}record['{{name}}'].map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(){{/isArray}};{{^required}} } {{/required}}
{{/items.isArray}}
{{^items.isArray}}
{{^required}}if (record['{{name}}']) { {{/required}}apiObject['{{name}}'] = {{#isArray}}record['{{name}}'].map(item => (item ? parseFloat(item) : null) as number).toArray(){{/isArray}};{{^required}} } {{/required}}
{{/items.isArray}}
{{/isArray}}
{{^isArray}}
{{^required}}if (record['{{name}}']) { {{/required}}apiObject['{{name}}'] = {{^isArray}}parseFloat(record['{{name}}']){{/isArray}};{{^required}} } {{/required}}
{{/isArray}}
{{/isUniqueId}}
{{^keepAsJSObject}}
{{#isModel}}
{{^required}}if (record['{{name}}']) { {{/required}}apiObject['{{name}}'] = {{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.toApi(record['{{name}}']);{{^required}} } {{/required}}
{{/isModel}}
{{#isArray}}
{{#items.isModel}}
{{^required}}if (record['{{name}}']) { {{/required}}apiObject['{{name}}'] = {{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.toApiArray(record['{{name}}']);{{^required}} } {{/required}}
{{/items.isModel}}
{{/isArray}}
{{/keepAsJSObject}}
{{/vars}}
return apiObject;
}
{{#returnPassthrough}}
{{#vars.1}}
public fromApiPassthrough(apiObject: {{classname}}): {{{dataTypeAlternate}}} {
{{#isModel}}
if (!apiObject.{{{returnPassthrough}}}) {return {{{defaultValue}}}; }
const normalizedApiObject = {{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.normalize(apiObject.{{{returnPassthrough}}});
return appFromJS(normalizedApiObject);
{{/isModel}}
{{#isArray}}
{{#items.isModel}}
if (!apiObject.{{{returnPassthrough}}}) {return {{{defaultValue}}}; }
const normalizedApiObject = {{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.normalizeArray(apiObject.{{{returnPassthrough}}});
return appFromJS(normalizedApiObject);
{{/items.isModel}}
{{^items.isModel}}
return appFromJS(apiObject.{{{returnPassthrough}}});
{{/items.isModel}}
{{/isArray}}
{{^isModel}}
{{^isArray}}
return apiObject.{{{returnPassthrough}}}!;
{{/isArray}}
{{/isModel}}
}
public fromApiPassthroughAsEntities(apiObject: {{classname}}): NormalizedRecordEntities {
{{#isEntity}}
if (!apiObject.{{{returnPassthrough}}}) {return {entities: {}, result: List<string>()}; }
return ApiRecordUtils.toNormalizedRecordEntities({{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.normalizeArrayAsEntities([apiObject.{{{returnPassthrough}}}]), true);
{{/isEntity}}
{{#isArray}}
{{#items.isEntity}}
if (!apiObject.{{{returnPassthrough}}}) {return {entities: {}, result: List<string>()}; }
return ApiRecordUtils.toNormalizedRecordEntities({{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.normalizeArrayAsEntities(apiObject.{{{returnPassthrough}}}), true);
{{/items.isEntity}}
{{^items.isEntity}}
console.log("entities revival not supported on this response");
return {entities: {}, result: List<string>()};
{{/items.isEntity}}
{{/isArray}}
{{^isEntity}}
{{^isArray}}
console.log("entities revival not supported on this response");
return {entities: {}, result: List<string>()};
{{/isArray}}
{{/isEntity}}
}
{{/vars.1}}
{{/returnPassthrough}}
}
export const {{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}RecordUtils = new {{classname}}RecordUtils();
{{#isEntity}}
export const apiEntities{{classname}}Selector = (state: any) => getApiEntitiesState(state).{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}} as Map<string, {{classname}}RecordEntity>;
export const apiEntity{{classname}}Selector = (state: any, {id}: {id?: string | null}) => id ? apiEntities{{classname}}Selector(state).get(id) : undefined;
{{/isEntity}}

View File

@@ -0,0 +1,15 @@
{{#models}}
{{#model}}
{{#isEnum}}
// This file is not needed and was generated only because of how codegen is built... Enums do not need to be converted to Records and can be used directly.
{{/isEnum}}
{{^isEnum}}
{{^oneOf}}
/* tslint:disable */
/* eslint-disable */
{{>licenseInfo}}
{{>recordGeneric}}
{{/oneOf}}
{{/isEnum}}
{{/model}}
{{/models}}

View File

@@ -0,0 +1,417 @@
/* tslint:disable */
/* eslint-disable */
{{>licenseInfo}}
export const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");
export interface ConfigurationParameters {
basePath?: string; // override base path
fetchApi?: FetchAPI; // override for fetch implementation
middleware?: Middleware[]; // middleware to apply before/after fetch requests
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
}
export class Configuration {
constructor(private configuration: ConfigurationParameters = {}) {}
set config(configuration: Configuration) {
this.configuration = configuration;
}
get basePath(): string {
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
}
get fetchApi(): FetchAPI | undefined {
return this.configuration.fetchApi;
}
get middleware(): Middleware[] {
return this.configuration.middleware || [];
}
get queryParamsStringify(): (params: HTTPQuery) => string {
return this.configuration.queryParamsStringify || querystring;
}
get username(): string | undefined {
return this.configuration.username;
}
get password(): string | undefined {
return this.configuration.password;
}
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
}
return undefined;
}
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
const accessToken = this.configuration.accessToken;
if (accessToken) {
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
}
return undefined;
}
get headers(): HTTPHeaders | undefined {
return this.configuration.headers;
}
get credentials(): RequestCredentials | undefined {
return this.configuration.credentials;
}
}
export const DefaultConfig = new Configuration();
/**
* This is the base class for all generated API classes.
*/
export class BaseAPI {
private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
private middleware: Middleware[];
constructor(protected configuration = DefaultConfig) {
this.middleware = configuration.middleware;
}
withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]) {
const next = this.clone<T>();
next.middleware = next.middleware.concat(...middlewares);
return next;
}
withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>) {
const middlewares = preMiddlewares.map((pre) => ({ pre }));
return this.withMiddleware<T>(...middlewares);
}
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>) {
const middlewares = postMiddlewares.map((post) => ({ post }));
return this.withMiddleware<T>(...middlewares);
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
protected isJsonMime(mime: string | null | undefined): boolean {
if (!mime) {
return false;
}
return BaseAPI.jsonRegex.test(mime);
}
protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response> {
const { url, init } = await this.createFetchParams(context, initOverrides);
const response = await this.fetchApi(url, init);
if (response && (response.status >= 200 && response.status < 300)) {
return response;
}
throw new ResponseError(response, 'Response returned an error code');
}
private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) {
let url = this.configuration.basePath + context.path;
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
// only add the querystring to the URL if there are query parameters.
// this is done to avoid urls ending with a "?" character which buggy webservers
// do not handle correctly sometimes.
url += '?' + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
const initOverrideFn =
typeof initOverrides === "function"
? initOverrides
: async () => initOverrides;
const initParams = {
method: context.method,
headers,
body: context.body,
credentials: this.configuration.credentials,
};
const overriddenInit: RequestInit = {
...initParams,
...(await initOverrideFn({
init: initParams,
context,
}))
};
let body: any;
if (isFormData(overriddenInit.body)
|| (overriddenInit.body instanceof URLSearchParams)
|| isBlob(overriddenInit.body)) {
body = overriddenInit.body;
} else if (this.isJsonMime(headers['Content-Type'])) {
body = JSON.stringify(overriddenInit.body);
} else {
body = overriddenInit.body;
}
const init: RequestInit = {
...overriddenInit,
body
};
return { url, init };
}
private fetchApi = async (url: string, init: RequestInit) => {
let fetchParams = { url, init };
for (const middleware of this.middleware) {
if (middleware.pre) {
fetchParams = await middleware.pre({
fetch: this.fetchApi,
...fetchParams,
}) || fetchParams;
}
}
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {
for (const middleware of this.middleware) {
if (middleware.onError) {
response = await middleware.onError({
fetch: this.fetchApi,
url: fetchParams.url,
init: fetchParams.init,
error: e,
response: response ? response.clone() : undefined,
}) || response;
}
}
if (response === undefined) {
if (e instanceof Error) {
throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
} else {
throw e;
}
}
}
for (const middleware of this.middleware) {
if (middleware.post) {
response = await middleware.post({
fetch: this.fetchApi,
url: fetchParams.url,
init: fetchParams.init,
response: response.clone(),
}) || response;
}
}
return response;
}
/**
* Create a shallow clone of `this` by constructing a new instance
* and then shallow cloning data members.
*/
private clone<T extends BaseAPI>(this: T): T {
const constructor = this.constructor as any;
const next = new constructor(this.configuration);
next.middleware = this.middleware.slice();
return next;
}
};
function isBlob(value: any): value is Blob {
return typeof Blob !== 'undefined' && value instanceof Blob;
}
function isFormData(value: any): value is FormData {
return typeof FormData !== "undefined" && value instanceof FormData;
}
export class ResponseError extends Error {
override name: "ResponseError" = "ResponseError";
constructor(public response: Response, msg?: string) {
super(msg);
}
}
export class FetchError extends Error {
override name: "FetchError" = "FetchError";
constructor(public cause: Error, msg?: string) {
super(msg);
}
}
export class RequiredError extends Error {
override name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
export type Json = any;
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
export type HTTPHeaders = { [key: string]: string };
export type HTTPQuery = { [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery };
export type HTTPBody = Json | FormData | URLSearchParams;
export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody };
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise<RequestInit>
export interface FetchParams {
url: string;
init: RequestInit;
}
export interface RequestOpts {
path: string;
method: HTTPMethod;
headers: HTTPHeaders;
query?: HTTPQuery;
body?: HTTPBody;
}
export function querystring(params: HTTPQuery, prefix: string = ''): string {
return Object.keys(params)
.map(key => querystringSingleKey(key, params[key], prefix))
.filter(part => part.length > 0)
.join('&');
}
function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery, keyPrefix: string = ''): string {
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
if (value instanceof Array) {
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
.join(`&${encodeURIComponent(fullKey)}=`);
return `${encodeURIComponent(fullKey)}=${multiValue}`;
}
if (value instanceof Set) {
const valueAsArray = Array.from(value);
return querystringSingleKey(key, valueAsArray, keyPrefix);
}
if (value instanceof Date) {
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
}
if (value instanceof Object) {
return querystring(value as HTTPQuery, fullKey);
}
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
}
{{^withoutRuntimeChecks}}
export function mapValues(data: any, fn: (item: any) => any) {
return Object.keys(data).reduce(
(acc, key) => ({ ...acc, [key]: fn(data[key]) }),
{}
);
}
{{/withoutRuntimeChecks}}
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if ('multipart/form-data' === consume.contentType) {
return true;
}
}
return false;
}
export interface Consume {
contentType: string;
}
export interface RequestContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
}
export interface ResponseContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
response: Response;
}
export interface ErrorContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
error: unknown;
response?: Response;
}
export interface Middleware {
pre?(context: RequestContext): Promise<FetchParams | void>;
post?(context: ResponseContext): Promise<Response | void>;
onError?(context: ErrorContext): Promise<Response | void>;
}
export interface ApiResponse<T> {
raw: Response;
value(): Promise<T>;
}
export interface ResponseTransformer<T> {
(json: any): T;
}
export class JSONApiResponse<T> {
constructor(public raw: Response, private transformer: ResponseTransformer<T> = (jsonValue: any) => jsonValue) {}
async value(): Promise<T> {
return this.transformer(await this.raw.json());
}
}
export class VoidApiResponse {
constructor(public raw: Response) {}
async value(): Promise<void> {
return undefined;
}
}
export class BlobApiResponse {
constructor(public raw: Response) {}
async value(): Promise<Blob> {
return await this.raw.blob();
};
}
export class TextApiResponse {
constructor(public raw: Response) {}
async value(): Promise<string> {
return await this.raw.text();
};
}

View File

@@ -0,0 +1,120 @@
/* tslint:disable */
/* eslint-disable */
import {fromJS as originalFromJS, isIndexed, List, Map as ImmMap, RecordOf} from 'immutable';
import {normalize, NormalizedSchema, schema, Schema} from "normalizr";
import {ActionDefinition, createAction} from "redux-ts-simple";
export const knownRecordFactories = new Map<string, any>();
export const knownIndexedSetByKey: (string | number)[] = [];
export function appFromJS(any: any): any {
return originalFromJS(any, (key, value) => {
if (isIndexed(value)) {
return knownIndexedSetByKey.indexOf(key) !== -1 ? value.toSet() : value.toList();
} // we're reviving an array -> it's a List
const MatchingType = knownRecordFactories.get(value.get('recType')) as { new(input?: any): any }; // check if we know a Record with this type
if (MatchingType) {
return new MatchingType(value);
}
return value.toMap(); // no matching Record type found -> it's a plain old Map
});
}
export type NormalizedRecordEntity = NormalizedSchema<{ [key: string]: Map<string, RecordOf<any>> }, string>;
export type NormalizedRecordEntities = NormalizedSchema<{ [key: string]: Map<string, RecordOf<any>> }, List<string>>;
export abstract class ApiRecordUtils<TAPI, TREC extends RecordOf<any>> {
public abstract normalize(apiObject: TAPI, asEntity?: boolean): any;
public getSchema(): Schema {
console.log("Entity mode not supported on this record.");
return new schema.Entity("entityNotSupported");
}
public normalizeArray(apiObjectArray: TAPI[], asEntity?: boolean): TAPI[] {
apiObjectArray.forEach(apiObject => this.normalize(apiObject, asEntity));
return apiObjectArray;
}
public normalizeAsEntities(apiObject: TAPI): NormalizedSchema<any, any> {
const normalized = this.normalize(apiObject, true);
return normalize(normalized, this.getSchema());
}
public normalizeArrayAsEntities(apiObject: TAPI[]): NormalizedSchema<any, any> {
const normalized = this.normalizeArray(apiObject, true);
return normalize(normalized, new schema.Array(this.getSchema()));
}
public fromApi(apiObject: TAPI): TREC {
return appFromJS(this.normalize(apiObject));
}
public fromApiArray(apiObjectArray: TAPI[]): List<TREC> {
this.normalizeArray(apiObjectArray);
return appFromJS(apiObjectArray);
}
public fromApiAsEntities(apiObject: TAPI): NormalizedRecordEntity {
return ApiRecordUtils.toNormalizedRecordEntities(this.normalizeAsEntities(apiObject), false);
}
public fromApiArrayAsEntities(apiObject: TAPI[]): NormalizedRecordEntities {
return ApiRecordUtils.toNormalizedRecordEntities(this.normalizeArrayAsEntities(apiObject), true);
}
public toApi(record: TREC): TAPI {
const apiObject = record.toJS();
delete apiObject.recType;
return apiObject;
}
public toApiArray(records: List<TREC>): TAPI[] {
return records.map(record => this.toApi(record)).toArray();
}
public static toNormalizedRecordEntities(normalizedAsEntities: any, forArray: boolean) {
const entities = normalizedAsEntities.entities;
for (const entityKey of Object.keys(entities)) {
entities[entityKey] = appFromJS(entities[entityKey]);
}
normalizedAsEntities.result = appFromJS(normalizedAsEntities.result || (forArray ? "" : []));
return normalizedAsEntities;
}
}
export const allApiActionFailures: SagaActionDefinition<any>[] = [];
export interface BaseEntitySupportPayloadApiAction {
toInlined?: boolean;
toEntities?: boolean;
markErrorsAsHandled?: boolean;
}
export interface BasePayloadApiAction {
markErrorsAsHandled?: boolean;
}
export interface SagaActionDefinition<TPayload> extends ActionDefinition<TPayload> {
toString: () => string;
}
export function createSagaAction<TPayload>(type: string, options?: { doNotAutoRegisterFailure?: boolean, namespace?: string }): SagaActionDefinition<TPayload> {
const {doNotAutoRegisterFailure, namespace} = options || {} as any;
let actionDefinition = createAction<TPayload>(namespace ? `${namespace}-${type}` : type);
(actionDefinition as any).toString = () => actionDefinition.type;
if (type.endsWith("Failure") && !doNotAutoRegisterFailure) {
allApiActionFailures.push(actionDefinition);
}
return actionDefinition;
}
export let apiCall: <Ctx, Fn extends (this: Ctx, ...args: any[]) => any>(context: Ctx, fn: Fn, ...args: Parameters<Fn>) => Generator<any, any, any>;
export function setApiCall(apiCallFc: <Ctx, Fn extends (this: Ctx, ...args: any[]) => any>(context: Ctx, fn: Fn, ...args: Parameters<Fn>) => Generator<any, any, any>) {
console.log("init apiCall");
apiCall = apiCallFc;
}
export const normalizedEntities = createSagaAction<NormalizedRecordEntities>("normalizedEntities");

View File

@@ -0,0 +1,28 @@
import {
Configuration,
ConfigurationParameters,
} from "../index{{importFileExtension}}";
import {
{{#apiInfo}}
{{#apis}}
{{classFilename}},
{{/apis}}
{{/apiInfo}}
} from "./index{{importFileExtension}}";
export class Api {
{{#apiInfo}}
{{#apis}}
public static {{#lambda.camelcase}}{{classFilename}}{{/lambda.camelcase}}: {{classFilename}};
{{/apis}}
{{/apiInfo}}
public static init(apiBaseConfig: ConfigurationParameters) {
{{#apiInfo}}
{{#apis}}
Api.{{#lambda.camelcase}}{{classFilename}}{{/lambda.camelcase}} = new {{classFilename}}(new Configuration(apiBaseConfig));
{{/apis}}
{{/apiInfo}}
}
}

View File

@@ -0,0 +1,244 @@
/* tslint:disable */
/* eslint-disable */
{{>licenseInfo}}
import {Api} from './index{{importFileExtension}}';
import {List} from 'immutable';
import {all, fork, put, takeLatest} from "redux-saga/effects";
import {apiCall, createSagaAction as originalCreateSagaAction, BaseEntitySupportPayloadApiAction, BasePayloadApiAction, NormalizedRecordEntities, normalizedEntities} from "../runtimeSagasAndRecords{{importFileExtension}}";
import {Action} from "redux-ts-simple";
{{#imports.0}}
import {
{{#imports}}
{{className}},
{{className}}Record,
{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}RecordUtils,
{{/imports}}
{{#passthroughImports}}
{{.}},
{{/passthroughImports}}
} from '../models/index{{importFileExtension}}';
{{/imports.0}}
{{#hasEnums}}
{{#operations}}
{{#operation}}
{{#allParams}}
{{#isEnum}}
import {
{{operationIdCamelCase}}{{enumName}},
} from './{{classname}}{{importFileExtension}}';
{{/isEnum}}
{{/allParams}}
{{/operation}}
{{/operations}}
{{/hasEnums}}
const createSagaAction = <T>(type: string) => originalCreateSagaAction<T>(type, {namespace: "api_{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}"});
export const {{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}SagaMap = new Map<string, () => Generator<any, any, any>>([
{{#operations}}
{{#operation}}
["{{nickname}}", {{nickname}}Saga],
{{/operation}}
{{/operations}}
]
);
export function *{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}AllSagas() {
yield all([...{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}SagaMap.values()].map(actionSaga => fork(actionSaga)));
}
{{#operations}}
{{#operation}}
//region {{nickname}}
{{#returnTypeSupportsEntities}}
export interface Payload{{#lambda.titlecase}}{{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}{{/lambda.titlecase}} extends {{#allParams.0}}Payload{{#lambda.titlecase}}{{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}{{/lambda.titlecase}}Request, {{/allParams.0}}BaseEntitySupportPayloadApiAction {
}
{{/returnTypeSupportsEntities}}
{{^returnTypeSupportsEntities}}
export interface Payload{{#lambda.titlecase}}{{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}{{/lambda.titlecase}} extends {{#allParams.0}}Payload{{#lambda.titlecase}}{{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}{{/lambda.titlecase}}Request, {{/allParams.0}}BasePayloadApiAction {
}
{{/returnTypeSupportsEntities}}
{{#allParams.0}}
export interface Payload{{#lambda.titlecase}}{{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}{{/lambda.titlecase}}Request {
{{#allParams}}
{{paramName}}{{^required}}?{{/required}}: {{{dataTypeAlternate}}};
{{/allParams}}
}
{{/allParams.0}}
export const {{nickname}}Request = createSagaAction<{{#allParams.0}}Payload{{#lambda.titlecase}}{{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}{{/lambda.titlecase}}Request{{/allParams.0}}{{^allParams.0}}void{{/allParams.0}}>("{{nickname}}Request");
{{#returnType}}
export const {{nickname}}Success = createSagaAction<{{#hasReturnPassthroughVoid}}void{{/hasReturnPassthroughVoid}}{{^hasReturnPassthroughVoid}}{{{returnTypeAlternate}}}{{/hasReturnPassthroughVoid}}>("{{nickname}}Success");
{{#returnTypeSupportsEntities}}
export const {{nickname}}Success_Entities = createSagaAction<NormalizedRecordEntities>("{{nickname}}Success_Entities");
{{/returnTypeSupportsEntities}}
{{/returnType}}
{{^returnType}}
export const {{nickname}}Success = createSagaAction<void>("{{nickname}}Success");
{{/returnType}}
export const {{nickname}}Failure = createSagaAction<{error: any, requestPayload: Payload{{#lambda.titlecase}}{{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}{{/lambda.titlecase}}}>("{{nickname}}Failure");
export const {{nickname}} = createSagaAction<Payload{{#lambda.titlecase}}{{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}{{/lambda.titlecase}}>("{{nickname}}");
export function *{{nickname}}Saga() {
yield takeLatest({{nickname}}, {{nickname}}SagaImp);
}
export function *{{nickname}}SagaImp(_action_: Action<Payload{{#lambda.titlecase}}{{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}{{/lambda.titlecase}}>) {
const {markErrorsAsHandled, ..._payloadRest_} = _action_.payload;
try {
{{#returnTypeSupportsEntities}}
const {toEntities, toInlined = !toEntities, ...requestPayload} = _payloadRest_;
{{/returnTypeSupportsEntities}}
{{#allParams.0}}
const {
{{#allParams}}
{{paramName}},
{{/allParams}}
} = _payloadRest_;
{{/allParams.0}}
yield put({{nickname}}Request({{#allParams.0}}{{#returnTypeSupportsEntities}}requestPayload{{/returnTypeSupportsEntities}}{{^returnTypeSupportsEntities}}_action_.payload{{/returnTypeSupportsEntities}}{{/allParams.0}}));
const response{{#returnType}}: Required<{{{returnType}}}>{{/returnType}} = yield apiCall(Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}, Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}['{{nickname}}'],
{{#allParams.0}}
{{#allParams}}
{{#isUniqueId}}
{{#isArray}}
{{#items.isArray}}
{{^required}}{{paramName}} ? {{/required}}{{paramName}}.map(p => p.toArray().map(p2 => (p2 ? parseFloat(p2) : null) as number)).toArray(){{^required}} : undefined{{/required}},
{{/items.isArray}}
{{^items.isArray}}
{{^required}}{{paramName}} ? {{/required}}{{paramName}}.map(p => (p ? parseFloat(p) : null) as number ).toArray(){{^required}} : undefined{{/required}},
{{/items.isArray}}
{{/isArray}}
{{^isArray}}
{{^required}}{{paramName}} ? {{/required}}parseFloat({{paramName}}){{^required}} : undefined{{/required}},
{{/isArray}}
{{/isUniqueId}}
{{^isUniqueId}}
{{#isArray}}
{{#items.isModel}}
{{^required}}{{paramName}} ? {{/required}}{{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.toApiArray({{paramName}}){{^required}} : undefined{{/required}},
{{/items.isModel}}
{{^items.isModel}}
{{^required}}{{paramName}} ? {{/required}}{{paramName}}.toJS(){{^required}} : undefined{{/required}},
{{/items.isModel}}
{{/isArray}}
{{#isModel}}
{{^required}}{{paramName}} ? {{/required}}{{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.toApi({{paramName}}){{^required}} : undefined{{/required}},
{{/isModel}}
{{^isArray}}
{{^isModel}}
{{paramName}},
{{/isModel}}
{{/isArray}}
{{/isUniqueId}}
{{/allParams}}
{{/allParams.0}}
);
{{#returnType}}
{{^hasReturnPassthroughVoid}}
let successReturnValue: any = undefined;
{{/hasReturnPassthroughVoid}}
{{/returnType}}
{{#returnTypeSupportsEntities}}
if (toEntities) {
{{#returnPassthrough}}
successReturnValue = {{#lambda.camelcase}}{{{returnType}}}{{/lambda.camelcase}}RecordUtils.fromApiPassthroughAsEntities(response);
{{/returnPassthrough}}
{{^hasReturnPassthroughVoid}}
{{^returnPassthrough}}
{{#returnTypeIsArray}}
{{#returnTypeAlternate}}
successReturnValue = {{#lambda.camelcase}}{{returnBaseTypeAlternate}}{{/lambda.camelcase}}Utils.fromApiArrayAsEntities(response);
{{/returnTypeAlternate}}
{{/returnTypeIsArray}}
{{#returnTypeIsModel}}
successReturnValue = {{#lambda.camelcase}}{{returnTypeAlternate}}{{/lambda.camelcase}}Utils.fromApiArrayAsEntities([response]);
{{/returnTypeIsModel}}
{{/returnPassthrough}}
{{/hasReturnPassthroughVoid}}
yield put(normalizedEntities(successReturnValue));
yield put({{nickname}}Success_Entities(successReturnValue));
}
if (toInlined) {
{{/returnTypeSupportsEntities}}
{{#returnType}}
{{#returnPassthrough}}
successReturnValue = {{#lambda.camelcase}}{{{returnType}}}{{/lambda.camelcase}}RecordUtils.fromApiPassthrough(response);
yield put({{nickname}}Success(successReturnValue));
{{/returnPassthrough}}
{{#hasReturnPassthroughVoid}}
yield put({{nickname}}Success());
{{/hasReturnPassthroughVoid}}
{{^hasReturnPassthroughVoid}}
{{^returnPassthrough}}
{{#returnTypeIsArray}}
{{#returnTypeAlternate}}
successReturnValue = {{#lambda.camelcase}}{{returnBaseTypeAlternate}}{{/lambda.camelcase}}Utils.fromApiArray(response);
yield put({{nickname}}Success(successReturnValue));
{{/returnTypeAlternate}}
{{/returnTypeIsArray}}
{{#returnTypeIsModel}}
successReturnValue = {{#lambda.camelcase}}{{returnTypeAlternate}}{{/lambda.camelcase}}Utils.fromApi(response);
yield put({{nickname}}Success(successReturnValue));
{{/returnTypeIsModel}}
{{^returnTypeIsArray}}
{{^returnTypeIsModel}}
yield put({{nickname}}Success(response));
{{/returnTypeIsModel}}
{{/returnTypeIsArray}}
{{/returnPassthrough}}
{{/hasReturnPassthroughVoid}}
{{/returnType}}
{{^returnType}}
yield put({{nickname}}Success());
{{/returnType}}
{{#returnTypeSupportsEntities}}
}
{{/returnTypeSupportsEntities}}
{{#returnType}}
{{#returnPassthrough}}
return successReturnValue;
{{/returnPassthrough}}
{{#hasReturnPassthroughVoid}}
return undefined;
{{/hasReturnPassthroughVoid}}
{{^hasReturnPassthroughVoid}}
{{^returnPassthrough}}
{{#returnTypeIsArray}}
{{#returnTypeAlternate}}
return successReturnValue;
{{/returnTypeAlternate}}
{{/returnTypeIsArray}}
{{#returnTypeIsModel}}
return successReturnValue;
{{/returnTypeIsModel}}
{{^returnTypeIsArray}}
{{^returnTypeIsModel}}
return response;
{{/returnTypeIsModel}}
{{/returnTypeIsArray}}
{{/returnPassthrough}}
{{/hasReturnPassthroughVoid}}
{{/returnType}}
{{^returnType}}
return undefined;
{{/returnType}}
} catch (error) {
if (markErrorsAsHandled) {error.wasHandled = true; }
yield put({{nickname}}Failure({error, requestPayload: _action_.payload}));
return error;
}
}
//endregion
{{/operation}}
{{/operations}}

View File

@@ -0,0 +1 @@
export * from './src/index{{importFileExtension}}';

View File

@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "esnext",
"outDir": "dist/esm"
}
}

View File

@@ -0,0 +1,25 @@
{
"compilerOptions": {
"declaration": true,
"target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}",
{{#sagasAndRecords}}
"strict": true,
{{/sagasAndRecords}}
"module": "commonjs",
"moduleResolution": "node",
"outDir": "dist",
{{^supportsES6}}
"lib": [
"es6",
"dom"
],
{{/supportsES6}}
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
"dist",
"node_modules"
]
}

View File

@@ -3269,6 +3269,52 @@ public class SpringCodegenTest {
.bodyContainsLines("if (b.value.equals(value)) {");
}
@Test
public void testHasOperationParameterExtraAnnotation_issue18224() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_18224.yaml");
final SpringCodegen codegen = new SpringCodegen();
codegen.setOpenAPI(openAPI);
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(SpringCodegen.DATE_LIBRARY, "java8-localdatetime");
codegen.additionalProperties().put(INTERFACE_ONLY, "true");
codegen.additionalProperties().put(USE_RESPONSE_ENTITY, "false");
codegen.additionalProperties().put(DELEGATE_PATTERN, "true");
codegen.additionalProperties().put(REQUEST_MAPPING_OPTION, "api_interface");
codegen.additionalProperties().put(SPRING_CONTROLLER, "true");
ClientOptInput input = new ClientOptInput();
input.openAPI(openAPI);
input.config(codegen);
DefaultGenerator generator = new DefaultGenerator();
generator.setGenerateMetadata(false); // skip metadata generation
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
Map<String, File> files = generator.opts(input).generate().stream()
.collect(Collectors.toMap(File::getName, Function.identity()));
JavaFileAssert javaFileAssert = JavaFileAssert.assertThat(files.get("TestApi.java"));
javaFileAssert
.assertMethod("_postToTest")
.assertParameter("groupObj")
.assertParameterAnnotations()
.containsWithName("com.test.MyAnnotationInPath")
.toParameter()
.toMethod()
.assertParameter("token")
.assertParameterAnnotations()
.containsWithName("com.test.MyAnnotationInQuery")
.toParameter()
.toMethod()
.assertParameter("clientId")
.assertParameterAnnotations()
.containsWithName("com.test.MyAnnotationInHeader");
}
@Test
public void testHasOperationExtraAnnotation_issue15822() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
@@ -4589,11 +4635,8 @@ public class SpringCodegenTest {
// public Object4(Type1 pageInfo, String responseType, String requestId, Boolean success) {
// super(responseType, requestId, success, pageInfo);
// }
// UPDATE: with https://github.com/OpenAPITools/openapi-generator/pull/18238
// (REFACTOR_ALLOF_WITH_PROPERTIES_ONLY default to true)
// public Object4(String responseType, String requestId, Boolean success, Type1 pageInfo)
JavaFileAssert.assertThat(output.get("Object4.java"))
.assertConstructor("String", "String", "Boolean", "Type1")
.assertConstructor("Type1", "String", "String", "Boolean")
.hasParameter("responseType").toConstructor()
.hasParameter("requestId").toConstructor()
.hasParameter("success").toConstructor()

View File

@@ -0,0 +1,66 @@
openapi: 3.0.3
info:
title: sample spec
version: 1.0.0
paths:
/test/{groupObj}:
post:
summary: Post to test
description: ''
operationId: postToTest
parameters:
- $ref: '#/components/parameters/groupObj'
- $ref: '#/components/parameters/token'
- $ref: '#/components/parameters/clientId'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ObjTest'
responses:
201:
description: success
components:
parameters:
groupObj:
in: path
name: groupObj
required: true
schema:
type: string
pattern: "[a-zA-Z]"
x-pattern-message: "Only letters"
x-field-extra-annotation: '@com.test.MyAnnotationInPath'
token:
in: query
name: token
required: true
schema:
type: string
pattern: "[0-9a-fA-F]"
x-pattern-message: "Only numbers and letters a-f"
x-field-extra-annotation: '@com.test.MyAnnotationInQuery'
clientId:
in: header
name: clientId
required: true
schema:
type: string
pattern: "\\d"
x-pattern-message: "Only numbers"
x-field-extra-annotation: '@com.test.MyAnnotationInHeader'
schemas:
ObjTest:
description: A model to return
type: object
properties:
field1:
type: integer
format: int64
field2:
type: string
pattern: "\\w"
x-pattern-message: "Only letters, numbers and underscore"
field3:
type: string
pattern: "\\w"

View File

@@ -2202,6 +2202,13 @@ components:
- $ref: '#/components/schemas/Pig'
discriminator:
propertyName: className
mammal_anyof:
anyOf:
- $ref: '#/components/schemas/whale'
- $ref: '#/components/schemas/zebra'
- $ref: '#/components/schemas/Pig'
discriminator:
propertyName: className
whale:
type: object
properties:

View File

@@ -1981,6 +1981,13 @@ components:
- $ref: '#/components/schemas/Pig'
discriminator:
propertyName: className
mammal_anyof:
anyOf:
- $ref: '#/components/schemas/whale'
- $ref: '#/components/schemas/zebra'
- $ref: '#/components/schemas/Pig'
discriminator:
propertyName: className
whale:
type: object
properties:

View File

@@ -250,11 +250,12 @@ class AuthApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@@ -493,11 +494,12 @@ class AuthApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting

View File

@@ -255,11 +255,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'image/gif'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'image/gif'
]
)
# authentication setting
@@ -517,11 +518,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@@ -788,11 +790,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@@ -1058,11 +1061,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@@ -1328,11 +1332,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@@ -1598,11 +1603,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@@ -1868,11 +1874,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@@ -2138,11 +2145,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@@ -2408,11 +2416,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@@ -2678,11 +2687,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@@ -297,11 +297,12 @@ class FormApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@@ -567,11 +568,12 @@ class FormApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@@ -912,11 +914,12 @@ class FormApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@@ -327,11 +327,12 @@ class HeaderApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting

View File

@@ -311,11 +311,12 @@ class PathApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting

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