Compare commits

..

3 Commits

Author SHA1 Message Date
William Cheng bae9226d10 Merge branch 'fix_issue18541' of https://github.com/jpduchon/openapi-generator into jpduchon-fix_issue18541 2024-06-19 17:35:42 +08:00
Johann-Peter Duchon 319b3cc9b8 [csharp] Update samples 2024-06-06 10:21:43 +02:00
Johann-Peter Duchon 570792b214 [csharp] Don't apply json converter attribute for DateOnly (#18541)
Applying the OpenAPIDateConverter to an DateOnly property fails at runtime with an exception.
2024-06-06 10:12:40 +02:00
407 changed files with 2252 additions and 14350 deletions
@@ -5,16 +5,12 @@ on:
paths:
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
- samples/openapi3/server/petstore/springboot-3
- samples/server/petstore/springboot-lombok-data
- samples/server/petstore/springboot-lombok-tostring
- samples/server/petstore/springboot-file-delegate-optional
pull_request:
paths:
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
- samples/openapi3/server/petstore/springboot-3
- samples/server/petstore/springboot-lombok-data
- samples/server/petstore/springboot-lombok-tostring
- samples/server/petstore/springboot-file-delegate-optional
jobs:
build:
name: Build Java Spring (JDK17)
@@ -29,7 +25,6 @@ jobs:
- samples/openapi3/server/petstore/springboot-3
- samples/server/petstore/springboot-lombok-data
- samples/server/petstore/springboot-lombok-tostring
- samples/server/petstore/springboot-file-delegate-optional
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
+1 -1
View File
@@ -70,7 +70,7 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
[<img src="https://openapi-generator.tech/img/companies/litslink.png" width="128" height="128">](https://litslink.com/services/artificial-intelligence?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
[<img src="https://openapi-generator.tech/img/companies/designli.jpg" width="128" height="128">](https://designli.co?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
[<img src="https://openapi-generator.tech/img/companies/itm.png" width="128" height="128">](https://opensource.muenchen.de?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
[<img src="https://openapi-generator.tech/img/companies/kong.png" width="128" height="128">](https://konghq.com/products/kong-konnect?utm_medium=referral&utm_source=github&utm_campaign=platform&utm_content=openapi-generator)
[<img src="https://openapi-generator.tech/img/companies/kong.png" width="128" height="128">](https://konghq.com/products/kong-konnect/register?utm_medium=referral&utm_source=github&utm_campaign=platform&utm_content=openapi-generator)
#### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS, Checkly for sponsoring the API monitoring and Gradle for sponsoring Develocity
@@ -1,10 +0,0 @@
generatorName: spring
outputDir: samples/server/petstore/springboot-file-delegate-optional
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue18345.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
delegatePattern: true
useOptional: true
useSpringBoot3: true
artifactId: spring-boot-use-optional
hideGenerationTimestamp: "true"
-4
View File
@@ -1,4 +0,0 @@
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
-1
View File
@@ -74,7 +74,6 @@ 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)
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+2 -2
View File
@@ -120,11 +120,11 @@ 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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|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
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|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
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|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
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|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
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+1 -1
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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|null
## IMPORT MAPPING
+2 -2
View File
@@ -113,11 +113,11 @@ 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, OPERATION_PARAMETER|null
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD|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
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD|null
## IMPORT MAPPING
-303
View File
@@ -1,303 +0,0 @@
---
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
@@ -5121,9 +5121,6 @@ public class DefaultCodegen implements CodegenConfig {
if (parameter.getExtensions() != null && !parameter.getExtensions().isEmpty()) {
codegenParameter.vendorExtensions.putAll(parameter.getExtensions());
}
if (parameter.getSchema() != null && parameter.getSchema().getExtensions() != null && !parameter.getSchema().getExtensions().isEmpty()) {
codegenParameter.vendorExtensions.putAll(parameter.getSchema().getExtensions());
}
Schema parameterSchema;
@@ -2,7 +2,6 @@ package org.openapitools.codegen;
import lombok.Getter;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -19,10 +18,10 @@ 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", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "List of custom annotations to be added to property", null),
X_FIELD_EXTRA_ANNOTATION("x-field-extra-annotation", ExtensionLevel.FIELD, "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),
X_PATTERN_MESSAGE("x-pattern-message", ExtensionLevel.FIELD, "Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable", null),
;
private final String name;
@@ -40,27 +40,17 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
private final Logger LOGGER = LoggerFactory.getLogger(AbstractGoCodegen.class);
private static final String NUMERIC_ENUM_PREFIX = "_";
@Setter
protected boolean withGoCodegenComment = false;
@Setter
protected boolean withAWSV4Signature = false;
@Setter
protected boolean withXml = false;
@Setter
protected boolean enumClassPrefix = false;
@Setter
protected boolean structPrefix = false;
@Setter
protected boolean generateInterfaces = false;
@Setter
protected boolean withGoMod = false;
@Setter
protected boolean generateMarshalJSON = true;
@Setter
protected boolean generateUnmarshalJSON = true;
@Setter protected boolean withGoCodegenComment = false;
@Setter protected boolean withAWSV4Signature = false;
@Setter protected boolean withXml = false;
@Setter protected boolean enumClassPrefix = false;
@Setter protected boolean structPrefix = false;
@Setter protected boolean generateInterfaces = false;
@Setter protected boolean withGoMod = false;
@Setter protected boolean generateMarshalJSON = true;
@Setter protected boolean generateUnmarshalJSON = true;
@Setter
protected String packageName = "openapi";
@Setter protected String packageName = "openapi";
protected Set<String> numberTypes;
public AbstractGoCodegen() {
@@ -434,13 +424,6 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
String ref = p.get$ref();
String type;
// schema is a ref to property's schema e.g. #/components/schemas/Pet/properties/id
if (ModelUtils.isRefToSchemaWithProperties(ref)) {
Schema propertySchema = ModelUtils.getSchemaFromRefToSchemaWithProperties(openAPI, ref);
openAPIType = super.getSchemaType(propertySchema);
ref = propertySchema.get$ref();
}
if (ref != null && !ref.isEmpty()) {
type = toModelName(openAPIType);
} else if ("object".equals(openAPIType) && ModelUtils.isAnyType(p)) {
@@ -448,12 +431,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
type = "interface{}";
} else if (typeMapping.containsKey(openAPIType)) {
type = typeMapping.get(openAPIType);
if (languageSpecificPrimitives.contains(type)) {
if (languageSpecificPrimitives.contains(type))
return (type);
}
} else {
} else
type = openAPIType;
}
return type;
}
@@ -772,7 +753,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
imports.add(createMapping("import", "time"));
addedTimeImport = true;
}
if (!addedOSImport && ("*os.File".equals(cp.dataType) ||
(cp.items != null && "*os.File".equals(cp.items.dataType)))) {
imports.add(createMapping("import", "os"));
@@ -781,15 +762,15 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
if (cp.pattern != null) {
cp.vendorExtensions.put("x-go-custom-tag", "validate:\"regexp=" +
cp.pattern.replace("\\", "\\\\").replaceAll("^/|/$", "") +
"\"");
cp.pattern.replace("\\","\\\\").replaceAll("^/|/$","") +
"\"");
}
}
if (this instanceof GoClientCodegen && model.isEnum) {
imports.add(createMapping("import", "fmt"));
}
if (model.oneOf != null && !model.oneOf.isEmpty() && !addedValidator && generateUnmarshalJSON) {
if(model.oneOf != null && !model.oneOf.isEmpty() && !addedValidator && generateUnmarshalJSON) {
imports.add(createMapping("import", "gopkg.in/validator.v2"));
addedValidator = true;
}
@@ -240,24 +240,18 @@ 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";
@@ -1157,4 +1151,4 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
public GeneratorLanguage generatorLanguage() {
return GeneratorLanguage.TYPESCRIPT;
}
}
}
@@ -2128,7 +2128,7 @@ public class ModelUtils {
}
if (schema instanceof JsonSchema) {
if (schema.getTypes() != null && !schema.getTypes().isEmpty()) {
if (schema.getTypes() != null) {
return String.valueOf(schema.getTypes().iterator().next());
} else {
return null;
@@ -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
@@ -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;
@@ -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);
}
@@ -57,7 +57,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
Object deserialized = null;
{{#discriminator}}
Class<?> cls = JSON.getClassForElement(tree, new {{classname}}().getClass());
Class<?> cls = JSON.getClassForElement(tree, {{classname}}.class);
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;
}
@@ -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;
}
@@ -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
@@ -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;
@@ -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);
}
@@ -57,7 +57,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
Object deserialized = null;
{{#discriminator}}
Class<?> cls = JSON.getClassForElement(tree, new {{classname}}().getClass());
Class<?> cls = JSON.getClassForElement(tree, {{classname}}.class);
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;
}
@@ -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;
}
@@ -54,7 +54,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
Object deserialized = null;
{{#discriminator}}
Class<?> cls = JSON.getClassForElement(tree, new {{classname}}().getClass());
Class<?> cls = JSON.getClassForElement(tree, {{classname}}.class);
if (cls != null) {
// When the OAS schema includes a discriminator, use the discriminator value to
// discriminate the anyOf schemas.
@@ -331,18 +331,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
* @param accessToken Access token
*/
public void setAccessToken(String accessToken) {
setAccessToken(() -> accessToken);
}
/**
* Helper method to set the supplier of access tokens for OAuth2 authentication.
*
* @param tokenSupplier The supplier of bearer tokens
*/
public void setAccessToken(Supplier<String> tokenSupplier) {
for (Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
((OAuth) auth).setAccessToken(tokenSupplier);
((OAuth) auth).setAccessToken(accessToken);
return;
}
}
@@ -1,48 +1,24 @@
package {{invokerPackage}}.auth;
import java.util.Optional;
import java.util.function.Supplier;
import org.springframework.http.HttpHeaders;
import org.springframework.util.MultiValueMap;
/**
* Provides support for RFC 6750 - Bearer Token usage for OAUTH 2.0 Authorization.
*/
{{>generatedAnnotation}}
public class OAuth implements Authentication {
private Supplier<String> tokenSupplier;
private String accessToken;
/**
* Returns the bearer token used for Authorization.
*
* @return The bearer token
*/
public String getAccessToken() {
return tokenSupplier.get();
return accessToken;
}
/**
* Sets the bearer access token used for Authorization.
*
* @param bearerToken The bearer token to send in the Authorization header
*/
public void setAccessToken(String accessToken) {
setAccessToken(() -> accessToken);
}
/**
* Sets the supplier of bearer tokens used for Authorization.
*
* @param tokenSupplier The supplier of bearer tokens to send in the Authorization header
*/
public void setAccessToken(Supplier<String> tokenSupplier) {
this.tokenSupplier = tokenSupplier;
this.accessToken = accessToken;
}
@Override
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
Optional.ofNullable(tokenSupplier).map(Supplier::get).ifPresent(accessToken ->
headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken)
);
if (accessToken != null) {
headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
}
}
}
@@ -66,7 +66,7 @@ public interface {{classname}}Delegate {
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
{{#jdk8-default-interface}}default {{/jdk8-default-interface}}{{>responseType}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}Mono<{{{dataType}}}>{{/isArray}}{{#isArray}}Flux<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}{{#isArray}}List<{{/isArray}}{{#reactive}}Flux<Part>{{/reactive}}{{^reactive}}{{#isFormParam}}MultipartFile{{/isFormParam}}{{^isFormParam}}{{>optionalDataType}}{{/isFormParam}}{{/reactive}}{{#isArray}}>{{/isArray}}{{/isFile}} {{paramName}}{{^-last}},
{{#jdk8-default-interface}}default {{/jdk8-default-interface}}{{>responseType}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}Mono<{{{dataType}}}>{{/isArray}}{{#isArray}}Flux<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}{{#isArray}}List<{{/isArray}}{{#reactive}}Flux<Part>{{/reactive}}{{^reactive}}MultipartFile{{/reactive}}{{#isArray}}>{{/isArray}}{{/isFile}} {{paramName}}{{^-last}},
{{/-last}}{{/allParams}}{{#reactive}}{{#hasParams}},
{{/hasParams}}ServerWebExchange exchange{{/reactive}}{{#vendorExtensions.x-spring-paginated}}{{#hasParams}}, {{/hasParams}}{{^hasParams}}{{#reactive}}, {{/reactive}}{{/hasParams}}final Pageable pageable{{/vendorExtensions.x-spring-paginated}}){{#unhandledException}} throws Exception{{/unhandledException}}{{^jdk8-default-interface}};{{/jdk8-default-interface}}{{#jdk8-default-interface}} {
{{>methodBody}}
@@ -1 +1 @@
{{#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}}
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>optionalDataType}} {{paramName}}{{/isHeaderParam}}
@@ -1 +1 @@
{{#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}}
{{#isPathParam}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>optionalDataType}} {{paramName}}{{/isPathParam}}
@@ -1 +1 @@
{{#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}}
{{#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}}
@@ -146,7 +146,6 @@ 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
@@ -58,6 +58,8 @@ 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 {
@@ -71,6 +73,8 @@ 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 {
@@ -15,10 +15,10 @@ publish_to: {{.}}
environment:
sdk: '>=2.12.0 <4.0.0'
dependencies:
collection: '>=1.17.0 <2.0.0'
http: '>=0.13.0 <2.0.0'
collection: '^1.17.0'
http: '>=0.13.0 <0.14.0'
intl: any
meta: '>=1.1.8 <2.0.0'
meta: '^1.1.8'
dev_dependencies:
test: '>=1.21.6 <1.22.0'
{{#json_serializable}}
@@ -585,6 +585,18 @@ func addFile(w *multipart.Writer, fieldName, path string) error {
return err
}
// Prevent trying to import "fmt"
func reportError(format string, a ...interface{}) error {
return fmt.Errorf(format, a...)
}
// A wrapper for strict JSON decoding
func newStrictDecoder(data []byte) *json.Decoder {
dec := json.NewDecoder(bytes.NewBuffer(data))
dec.DisallowUnknownFields()
return dec
}
// Set request body from an interface{}
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
if bodyBuf == nil {
@@ -2,9 +2,7 @@
package {{packageName}}
import (
"bytes"
"encoding/json"
"fmt"
"reflect"
"time"
)
@@ -338,15 +336,3 @@ func IsNil(i interface{}) bool {
type MappedNullable interface {
ToMap() (map[string]interface{}, error)
}
// A wrapper for strict JSON decoding
func newStrictDecoder(data []byte) *json.Decoder {
dec := json.NewDecoder(bytes.NewBuffer(data))
dec.DisallowUnknownFields()
return dec
}
// Prevent trying to import "fmt"
func reportError(format string, a ...interface{}) error {
return fmt.Errorf(format, a...)
}
@@ -29,7 +29,7 @@
<version.logback>1.4.13</version.logback>
<version.junit>4.13.2</version.junit>
<version.mockito>2.1.0-beta.124</version.mockito>
<version.undertow>2.3.14.Final</version.undertow>
<version.undertow>2.3.12.Final</version.undertow>
<version.jsonpath>2.2.0</version.jsonpath>
<version.httpclient>4.5.13</version.httpclient>
<version.httpasyncclient>4.1.2</version.httpasyncclient>
@@ -163,7 +163,6 @@ import {{packageName}}.infrastructure.ITransformForStorage
{{/vars}}
{{/hasEnums}}
{{#generateOneOfAnyOfWrappers}}
{{#gson}}
class CustomTypeAdapterFactory : TypeAdapterFactory {
override fun <T> create(gson: Gson, type: TypeToken<T>): TypeAdapter<T>? {
@@ -250,22 +249,24 @@ import {{packageName}}.infrastructure.ITransformForStorage
throw IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj["{{{baseName}}}"].toString()))
}
val jsonArray{{name}} = jsonObj.getAsJsonArray("{{{baseName}}}")
// validate the required field `{{{baseName}}}` (array)
for (i in 0 until jsonObj.getAsJsonArray("{{{baseName}}}").size()) {
{{{items.dataType}}}.validateJsonElement(jsonObj.getAsJsonArray("{{{baseName}}}").get(i))
for (i in 0 until jsonArray{{name}}.size()) {
{{{items.dataType}}}.validateJsonElement(jsonArray{{name}}.get(i))
}
{{/required}}
{{^required}}
if (jsonObj["{{{baseName}}}"] != null && !jsonObj["{{{baseName}}}"].isJsonNull) {
if (jsonObj.getAsJsonArray("{{{baseName}}}") != null) {
val jsonArray{{name}} = jsonObj.getAsJsonArray("{{{baseName}}}")
if (jsonArray{{name}} != null) {
// ensure the json data is an array
require(jsonObj["{{{baseName}}}"].isJsonArray) {
String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj["{{{baseName}}}"].toString())
}
// validate the optional field `{{{baseName}}}` (array)
for (i in 0 until jsonObj.getAsJsonArray("{{{baseName}}}").size()) {
{{{items.dataType}}}.validateJsonElement(jsonObj.getAsJsonArray("{{{baseName}}}").get(i))
for (i in 0 until jsonArray{{name}}.size()) {
{{{items.dataType}}}.validateJsonElement(jsonArray{{name}}[i])
}
}
}
@@ -355,7 +356,6 @@ import {{packageName}}.infrastructure.ITransformForStorage
{{/discriminator}}
}
}
{{/gson}}
{{/generateOneOfAnyOfWrappers}}
{{#vendorExtensions.x-has-data-class-body}}
@@ -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}}{{^required}}?{{/required}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{!
"{{#lambda.escapeDollar}}{{{baseName}}}{{/lambda.escapeDollar}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}.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}}{{^required}}?{{/required}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}},
path = "{{path}}"{{#pathParams}}.replace("{"+"{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}},
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}},
@@ -413,35 +413,33 @@ import com.squareup.moshi.adapter
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
@Suppress("UNNECESSARY_SAFE_CALL")
return response.use {
when {
it.isRedirect -> Redirection(
it.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
it.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
)
it.isInformational -> Informational(
it.message{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
it.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
it.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
)
it.isSuccessful -> Success(
responseBody(it.body{{#jvm-okhttp3}}(){{/jvm-okhttp3}}, accept),
it.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
it.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
)
it.isClientError -> ClientError(
it.message{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
it.body{{#jvm-okhttp3}}(){{/jvm-okhttp3}}?.string(),
it.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
it.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
)
else -> ServerError(
it.message{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
it.body{{#jvm-okhttp3}}(){{/jvm-okhttp3}}?.string(),
it.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
it.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
)
}
return when {
response.isRedirect -> Redirection(
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
)
response.isInformational -> Informational(
response.message{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
)
response.isSuccessful -> Success(
responseBody(response.body{{#jvm-okhttp3}}(){{/jvm-okhttp3}}, accept),
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
)
response.isClientError -> ClientError(
response.message{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
response.body{{#jvm-okhttp3}}(){{/jvm-okhttp3}}?.string(),
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
)
else -> ServerError(
response.message{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
response.body{{#jvm-okhttp3}}(){{/jvm-okhttp3}}?.string(),
response.code{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
response.headers{{#jvm-okhttp3}}(){{/jvm-okhttp3}}.toMultimap()
)
}
}
@@ -64,9 +64,9 @@ import okhttp3.MediaType.Companion.toMediaType
private var baseUrl: String = defaultBasePath,
private val okHttpClientBuilder: OkHttpClient.Builder? = null,
{{^kotlinx_serialization}}
private val serializerBuilder: {{#gson}}GsonBuilder{{/gson}}{{#moshi}}Moshi.Builder{{/moshi}}{{#jackson}}ObjectMapper{{/jackson}} = {{#generateOneOfAnyOfWrappers}}{{#gson}}registerTypeAdapterFactoryForAllModels({{/gson}}{{/generateOneOfAnyOfWrappers}}Serializer.{{#gson}}gsonBuilder{{/gson}}{{#generateOneOfAnyOfWrappers}}{{#gson}}){{/gson}}{{/generateOneOfAnyOfWrappers}}{{#moshi}}moshiBuilder{{/moshi}}{{#jackson}}jacksonObjectMapper{{/jackson}},
private val serializerBuilder: {{#gson}}GsonBuilder{{/gson}}{{#moshi}}Moshi.Builder{{/moshi}}{{#jackson}}ObjectMapper{{/jackson}} = Serializer.{{#gson}}gsonBuilder{{/gson}}{{#moshi}}moshiBuilder{{/moshi}}{{#jackson}}jacksonObjectMapper{{/jackson}},
{{/kotlinx_serialization}}
private val callFactory: Call.Factory? = null,
private val callFactory : Call.Factory? = null,
private val callAdapterFactories: List<CallAdapter.Factory> = listOf(
{{#useRxJava}}
RxJavaCallAdapterFactory.create(),
@@ -148,7 +148,7 @@ import okhttp3.MediaType.Companion.toMediaType
addAuthorization(authName, auth)
}
}
{{#generateOneOfAnyOfWrappers}}
{{#generateOneOfAnyOfWrappers}}
{{^kotlinx_serialization}}
{{#gson}}
{{#models}}
@@ -162,7 +162,7 @@ import okhttp3.MediaType.Companion.toMediaType
{{/models}}
{{/gson}}
{{/kotlinx_serialization}}
{{/generateOneOfAnyOfWrappers}}
{{/generateOneOfAnyOfWrappers}}
}
{{#authMethods}}
@@ -177,6 +177,21 @@ import okhttp3.MediaType.Companion.toMediaType
password: String
) : this(baseUrl, okHttpClientBuilder, {{^kotlinx_serialization}}serializerBuilder, {{/kotlinx_serialization}}arrayOf(authName)) {
setCredentials(username, password)
{{#generateOneOfAnyOfWrappers}}
{{^kotlinx_serialization}}
{{#gson}}
{{#models}}
{{#model}}
{{^isEnum}}
{{^hasChildren}}
serializerBuilder.registerTypeAdapterFactory({{modelPackage}}.{{{classname}}}.CustomTypeAdapterFactory())
{{/hasChildren}}
{{/isEnum}}
{{/model}}
{{/models}}
{{/gson}}
{{/kotlinx_serialization}}
{{/generateOneOfAnyOfWrappers}}
}
{{/isBasicBasic}}
@@ -189,6 +204,21 @@ import okhttp3.MediaType.Companion.toMediaType
bearerToken: String
) : this(baseUrl, okHttpClientBuilder, {{^kotlinx_serialization}}serializerBuilder, {{/kotlinx_serialization}}arrayOf(authName)) {
setBearerToken(bearerToken)
{{#generateOneOfAnyOfWrappers}}
{{^kotlinx_serialization}}
{{#gson}}
{{#models}}
{{#model}}
{{^isEnum}}
{{^hasChildren}}
serializerBuilder.registerTypeAdapterFactory({{modelPackage}}.{{{classname}}}.CustomTypeAdapterFactory())
{{/hasChildren}}
{{/isEnum}}
{{/model}}
{{/models}}
{{/gson}}
{{/kotlinx_serialization}}
{{/generateOneOfAnyOfWrappers}}
}
{{/isBasicBearer}}
@@ -210,6 +240,21 @@ import okhttp3.MediaType.Companion.toMediaType
?.setClientSecret(secret)
?.setUsername(username)
?.setPassword(password)
{{#generateOneOfAnyOfWrappers}}
{{^kotlinx_serialization}}
{{#gson}}
{{#models}}
{{#model}}
{{^isEnum}}
{{^hasChildren}}
serializerBuilder.registerTypeAdapterFactory({{modelPackage}}.{{{classname}}}.CustomTypeAdapterFactory())
{{/hasChildren}}
{{/isEnum}}
{{/model}}
{{/models}}
{{/gson}}
{{/kotlinx_serialization}}
{{/generateOneOfAnyOfWrappers}}
}
{{/hasOAuthMethods}}
@@ -253,9 +298,9 @@ import okhttp3.MediaType.Companion.toMediaType
{{/hasAuthMethods}}
{{#hasOAuthMethods}}
/**
* Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Token request builder
*/
* Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Token request builder
*/
fun getTokenEndPoint(): TokenRequestBuilder? {
var result: TokenRequestBuilder? = null
apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
@@ -265,9 +310,9 @@ import okhttp3.MediaType.Companion.toMediaType
}
/**
* Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Authentication request builder
*/
* Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Authentication request builder
*/
fun getAuthorizationEndPoint(): AuthenticationRequestBuilder? {
var result: AuthenticationRequestBuilder? = null
apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
@@ -277,10 +322,10 @@ import okhttp3.MediaType.Companion.toMediaType
}
/**
* Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
* @param accessToken Access token
* @return ApiClient
*/
* Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
* @param accessToken Access token
* @return ApiClient
*/
fun setAccessToken(accessToken: String): ApiClient {
apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
setAccessToken(accessToken)
@@ -289,12 +334,12 @@ import okhttp3.MediaType.Companion.toMediaType
}
/**
* Helper method to configure the oauth accessCode/implicit flow parameters
* @param clientId Client ID
* @param clientSecret Client secret
* @param redirectURI Redirect URI
* @return ApiClient
*/
* Helper method to configure the oauth accessCode/implicit flow parameters
* @param clientId Client ID
* @param clientSecret Client secret
* @param redirectURI Redirect URI
* @return ApiClient
*/
fun configureAuthorizationFlow(clientId: String, clientSecret: String, redirectURI: String): ApiClient {
apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
tokenRequestBuilder
@@ -309,10 +354,10 @@ import okhttp3.MediaType.Companion.toMediaType
}
/**
* Configures a listener which is notified when a new access token is received.
* @param accessTokenListener Access token listener
* @return ApiClient
*/
* Configures a listener which is notified when a new access token is received.
* @param accessTokenListener Access token listener
* @return ApiClient
*/
fun registerAccessTokenListener(accessTokenListener: AccessTokenListener): ApiClient {
apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
registerAccessTokenListener(accessTokenListener)
@@ -346,20 +391,6 @@ import okhttp3.MediaType.Companion.toMediaType
return retrofitBuilder.callFactory(usedCallFactory).build().create(serviceClass)
}
{{#generateOneOfAnyOfWrappers}}
{{^kotlinx_serialization}}
{{#gson}}
/**
* Gets the serializer builder.
* @return serial builder
*/
fun getSerializerBuilder(): GsonBuilder {
return serializerBuilder
}
{{/gson}}
{{/kotlinx_serialization}}
{{/generateOneOfAnyOfWrappers}}
private fun normalizeBaseUrl() {
if (!baseUrl.endsWith("/")) {
baseUrl += "/"
@@ -368,7 +399,7 @@ import okhttp3.MediaType.Companion.toMediaType
private inline fun <T, reified U> Iterable<T>.runOnFirst(callback: U.() -> Unit) {
for (element in this) {
if (element is U) {
if (element is U) {
callback.invoke(element)
break
}
@@ -385,28 +416,3 @@ import okhttp3.MediaType.Companion.toMediaType
}
}
}
{{#generateOneOfAnyOfWrappers}}
{{^kotlinx_serialization}}
{{#gson}}
/**
* Registers all models with the type adapter factory.
*
* @param gsonBuilder gson builder
* @return GSON builder
*/
fun registerTypeAdapterFactoryForAllModels(gsonBuilder: GsonBuilder): GsonBuilder {
{{#models}}
{{#model}}
{{^isEnum}}
{{^hasChildren}}
gsonBuilder.registerTypeAdapterFactory({{modelPackage}}.{{{classname}}}.CustomTypeAdapterFactory())
{{/hasChildren}}
{{/isEnum}}
{{/model}}
{{/models}}
return gsonBuilder
}
{{/gson}}
{{/kotlinx_serialization}}
{{/generateOneOfAnyOfWrappers}}
@@ -92,7 +92,7 @@ import {{packageName}}.infrastructure.*
}}{{#bodyParams}}{{{paramName}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{!
}}{{^hasFormParams}}null{{/hasFormParams}}{{!
}}{{#hasFormParams}}mapOf({{#formParams}}
"{{{baseName}}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{!
"{{{baseName}}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}.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}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}},
"{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}.value{{/isEnum}}{{/isContainer}},
{{/pathParams}}
)
@@ -94,7 +94,7 @@ import {{packageName}}.infrastructure.*
}}{{#bodyParams}}{{{paramName}}}{{/bodyParams}}{{/hasBodyParam}}{{^hasBodyParam}}{{!
}}{{^hasFormParams}}null{{/hasFormParams}}{{!
}}{{#hasFormParams}}mapOf({{#formParams}}
"{{{baseName}}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}{{^required}}?{{/required}}.value{{/isEnum}}, headers = mutableMapOf({{#contentType}}"Content-Type" to "{{contentType}}"{{/contentType}})),{{!
"{{{baseName}}}" to PartConfig(body = {{{paramName}}}{{#isEnum}}.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}}{{^required}}?{{/required}}.value{{/isEnum}}{{/isContainer}},
"{{baseName}}" to {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}.value{{/isEnum}}{{/isContainer}},
{{/pathParams}}
)
@@ -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}}{{^required}}?{{/required}}.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}}.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}}{{^required}}?{{/required}}.value{{/isEnum}}{{^isString}}.toString(){{/isString}}) }
{{{paramName}}}{{^required}}?{{/required}}.let { form.add("{{{baseName}}}", {{{paramName}}}{{#isEnum}}.value{{/isEnum}}{{^isString}}.toString(){{/isString}}) }
{{/formParams}}
{{/hasFormParams}}
@@ -14,7 +14,7 @@
{{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}},
{{/hasOptional}}{{/hasRequired}}{{#optionalVars}}{{>dataClassOptVar}}{{^-last}},
{{/-last}}{{/optionalVars}}
) {{/discriminator}}{{#parent}}: {{{.}}}{{#serializableModel}}, Serializable{{/serializableModel}}{{/parent}}{{#serializableModel}}: Serializable{{/serializableModel}}{
) {{/discriminator}}{{#parent}}: {{{.}}}{{/parent}}{
{{#discriminator}}
{{#requiredVars}}
{{>interfaceReqVar}}
@@ -33,9 +33,4 @@
@JsonProperty({{{value}}}) {{{name}}}({{{value}}}){{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
}
{{/isEnum}}{{/vars}}{{/hasEnums}}
{{#serializableModel}}
companion object {
private const val serialVersionUID: kotlin.Long = 1
}
{{/serializableModel}}
}
@@ -3,9 +3,6 @@ package {{package}}
import java.util.Objects
{{#imports}}import {{import}}
{{/imports}}
{{#serializableModel}}
import java.io.Serializable
{{/serializableModel}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.DecimalMax
import {{javaxPackage}}.validation.constraints.DecimalMin
@@ -28,7 +28,6 @@
"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"
@@ -30,20 +30,6 @@ 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.
@@ -54,24 +40,6 @@ 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}}
@@ -85,36 +53,26 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}
public function getSerialized{{nameInPascalCase}}(): array
{
return array_map(
static fn ($value) => $value?->value ? (string) $value->value : null,
$this->{{name}} ?? []
static fn ($value) => (string) $value->value,
$this->test ?? []
);
}
/**
* 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}}
}
@@ -5,7 +5,30 @@
{{/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}}>")
@@ -14,7 +37,7 @@
{{^isMap}}
{{#items}}
{{#isEnumRef}}
* @Accessor(getter="getSerialized{{nameInPascalCase}}", setter="setDeserialized{{nameInPascalCase}}")
* @Accessor(getter="getSerialized{{nameInPascalCase}}")
* @Type("array<string>")
{{/isEnumRef}}
{{^isEnumRef}}
@@ -25,95 +48,66 @@
{{/isContainer}}
{{^isContainer}}
{{#isDate}}
* @Assert\Type("\Date")
* @Type("DateTime<'Y-m-d'>")
{{/isDate}}
{{#isDateTime}}
* @Assert\Type("\DateTime"))
* @Type("DateTime")
{{/isDateTime}}
{{#isEnumRef}}
* @Accessor(getter="getSerialized{{nameInPascalCase}}", setter="setDeserialized{{nameInPascalCase}}")
* @Type("string")
* @Accessor(getter="getSerialized{{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}};
@@ -101,16 +101,12 @@ 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));
}
@@ -186,12 +186,11 @@ class {{classname}}:
{{#hasProduces}}
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[{{#produces}}
'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}
]
)
_header_params['Accept'] = self.api_client.select_header_accept(
[{{#produces}}
'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}
]
)
{{/hasProduces}}
{{#hasConsumes}}
@@ -232,7 +232,7 @@ class ApiClient:
body = self.sanitize_for_serialization(body)
# request url
if _host is None or self.configuration.ignore_operation_servers:
if _host is None:
url = self.configuration.host + resource_path
else:
# use server/host defined in path or operation instead
@@ -177,10 +177,10 @@ class RESTClientObject:
data.add_field(k, v)
args["data"] = data
# Pass a `bytes` or `str` parameter directly in the body to support
# Pass a `bytes` parameter directly in the body to support
# other content types than Json when `body` argument is provided
# in serialized form
elif isinstance(body, str) or isinstance(body, bytes):
elif isinstance(body, bytes):
args["data"] = body
else:
# Cannot generate the request from given parameters
@@ -24,9 +24,6 @@ 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.
@@ -151,11 +148,8 @@ 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,
*,
debug: Optional[bool] = None
) -> None:
"""Constructor
"""
@@ -170,9 +164,6 @@ 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
"""
@@ -223,10 +214,7 @@ conf = {{{packageName}}}.Configuration(
self.logger_file = None
"""Debug file location
"""
if debug is not None:
self.debug = debug
else:
self.__debug = False
self.debug = False
"""Debug switch
"""
@@ -1,4 +1,5 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, unused_attributes, non_camel_case_types)]
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
#![allow(unused_imports, unused_attributes)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
use async_trait::async_trait;
@@ -1,26 +0,0 @@
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>;
@@ -1,21 +0,0 @@
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();
@@ -1,5 +0,0 @@
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;
}
@@ -1,46 +0,0 @@
## {{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
```
@@ -1,19 +0,0 @@
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}}
]);
}
@@ -1,446 +0,0 @@
/* 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}}
@@ -1,16 +0,0 @@
/* 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}}
@@ -1,446 +0,0 @@
/* 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}}
@@ -1,4 +0,0 @@
wwwroot/*.js
node_modules
typings
dist
@@ -1,17 +0,0 @@
/* 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}}
@@ -1,11 +0,0 @@
/**
* {{{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.
*/
@@ -1,24 +0,0 @@
{{>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;
}
@@ -1,27 +0,0 @@
{{#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}}
@@ -1,160 +0,0 @@
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}}
}
@@ -1,50 +0,0 @@
/**
* {{#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}}
@@ -1,66 +0,0 @@
{{#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}}
}
@@ -1,6 +0,0 @@
/**
* @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}};
@@ -1,3 +0,0 @@
/* tslint:disable */
/* eslint-disable */
// TODO: add model tests
@@ -1,29 +0,0 @@
/* 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}}
@@ -1,20 +0,0 @@
/* tslint:disable */
/* eslint-disable */
{{>licenseInfo}}
{{#models}}
{{#model}}
{{#isEnum}}
{{>modelEnum}}
{{/isEnum}}
{{^isEnum}}
{{#oneOf}}
{{#-first}}
{{>modelOneOf}}
{{/-first}}
{{/oneOf}}
{{^oneOf}}
{{>modelGeneric}}
{{/oneOf}}
{{/isEnum}}
{{/model}}
{{/models}}
@@ -1 +0,0 @@
README.md
@@ -1,40 +0,0 @@
{
"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}}
}

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