From 298ccfcfd85d11fd75421db8cab383da434f4595 Mon Sep 17 00:00:00 2001 From: Paul Hagedorn Date: Thu, 21 Jul 2022 13:41:32 +0200 Subject: [PATCH] [typescript-nestjs] Upgrade to NestJS v8 (#12937) * feat(typescript-nestjs): upgrade to nestjs v8 Set default nestVersion to 8.0.0 * chore(typescript-nestjs): create typescript-nestjs-v8-provided-in-root.yaml and add it to samples.json * chore(typescript-nestjs): generate samples * docs(typescript-nestjs): generate docs * chore(typescript-nestjs): re-generate samples --- .github/.test/samples.json | 6 + ...typescript-nestjs-v8-provided-in-root.yaml | 10 + docs/generators/typescript-nestjs.md | 4 +- .../TypeScriptNestjsClientCodegen.java | 7 +- .../typescript-nestjs/README.mustache | 4 +- .../typescript-nestjs/api.module.mustache | 6 + .../typescript-nestjs/api.service.mustache | 6 + .../builds/default/.gitignore | 4 + .../builds/default/.openapi-generator-ignore | 23 + .../builds/default/.openapi-generator/FILES | 22 + .../builds/default/.openapi-generator/VERSION | 1 + .../builds/default/README.md | 137 +++++ .../builds/default/api.module.ts | 32 ++ .../builds/default/api/api.ts | 7 + .../builds/default/api/pet.service.ts | 475 ++++++++++++++++++ .../builds/default/api/store.service.ts | 190 +++++++ .../builds/default/api/user.service.ts | 387 ++++++++++++++ .../builds/default/configuration.ts | 79 +++ .../builds/default/git_push.sh | 57 +++ .../builds/default/index.ts | 5 + .../builds/default/model/apiResponse.ts | 22 + .../builds/default/model/category.ts | 21 + .../builds/default/model/models.ts | 6 + .../builds/default/model/order.ts | 37 ++ .../builds/default/model/pet.ts | 39 ++ .../builds/default/model/tag.ts | 21 + .../builds/default/model/user.ts | 30 ++ .../builds/default/package.json | 73 +++ .../builds/default/tsconfig.build.json | 9 + .../builds/default/tsconfig.json | 22 + .../builds/default/tslint.json | 18 + .../builds/default/variables.ts | 7 + 32 files changed, 1760 insertions(+), 7 deletions(-) create mode 100644 bin/configs/typescript-nestjs-v8-provided-in-root.yaml create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.gitignore create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.openapi-generator-ignore create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.openapi-generator/FILES create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.openapi-generator/VERSION create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/README.md create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api.module.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/api.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/pet.service.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/store.service.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/user.service.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/configuration.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/git_push.sh create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/index.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/apiResponse.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/category.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/models.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/order.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/pet.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/tag.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/user.ts create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/package.json create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tsconfig.build.json create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tsconfig.json create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tslint.json create mode 100644 samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/variables.ts diff --git a/.github/.test/samples.json b/.github/.test/samples.json index 6520d1fbf09..4d9f501e144 100644 --- a/.github/.test/samples.json +++ b/.github/.test/samples.json @@ -1226,6 +1226,12 @@ "Client: TypeScript" ] }, + { + "input": "typescript-nestjs-v8-petstore-provided-in-root.sh", + "matches": [ + "Client: TypeScript" + ] + }, { "input": "typescript-node-petstore-with-npm.sh", "matches": [ diff --git a/bin/configs/typescript-nestjs-v8-provided-in-root.yaml b/bin/configs/typescript-nestjs-v8-provided-in-root.yaml new file mode 100644 index 00000000000..16a957708c6 --- /dev/null +++ b/bin/configs/typescript-nestjs-v8-provided-in-root.yaml @@ -0,0 +1,10 @@ +generatorName: typescript-nestjs +outputDir: samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/typescript-nestjs +additionalProperties: + nestVersion: 8.0.0 + "npmName": "@openapitools/typescript-nestjs-petstore" + "npmVersion": "1.0.0" + "npmRepository" : "https://skimdb.npmjs.com/registry" + "snapshot" : false diff --git a/docs/generators/typescript-nestjs.md b/docs/generators/typescript-nestjs.md index 99d70502c6c..38720fb9411 100644 --- a/docs/generators/typescript-nestjs.md +++ b/docs/generators/typescript-nestjs.md @@ -11,7 +11,7 @@ title: Documentation for the typescript-nestjs Generator | generator type | CLIENT | | | generator language | Typescript | | | generator default templating engine | mustache | | -| helpTxt | Generates a TypeScript Nestjs 6.x client library. | | +| helpTxt | Generates a TypeScript Nestjs 8.x or 6.x client library. | | ## CONFIG OPTIONS These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. @@ -29,7 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |modelFileSuffix|The suffix of the file of the generated model (model<suffix>.ts).| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original| |modelSuffix|The suffix of the generated model.| |null| -|nestVersion|The version of Nestjs.| |6.0.0| +|nestVersion|The version of Nestjs.|
**8.0.0**
Use new HttpModule and HttpService from @nestjs/axios.
**6.0.0**
Use old HttpModule and HttpService from @nestjs/common.
|8.0.0| |npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null| |npmRepository|Use this property to set an url your private npmRepo in the package.json| |null| |npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java index 5814238c94d..19b9369bd80 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java @@ -53,7 +53,7 @@ public class TypeScriptNestjsClientCodegen extends AbstractTypeScriptClientCodeg public static final String STRING_ENUMS = "stringEnums"; public static final String STRING_ENUMS_DESC = "Generate string enums instead of objects for enum values."; - protected String nestVersion = "6.0.0"; + protected String nestVersion = "8.0.0"; protected String npmRepository = null; protected String serviceSuffix = "Service"; protected String serviceFileSuffix = ".service"; @@ -91,7 +91,7 @@ public class TypeScriptNestjsClientCodegen extends AbstractTypeScriptClientCodeg this.cliOptions.add(CliOption.newBoolean(TAGGED_UNIONS, "Use discriminators to create tagged unions instead of extending interfaces.", this.taggedUnions)); - this.cliOptions.add(new CliOption(NEST_VERSION, "The version of Nestjs.").defaultValue(this.nestVersion)); + this.cliOptions.add(new CliOption(NEST_VERSION, "The version of Nestjs.").addEnum("8.0.0","Use new HttpModule and HttpService from @nestjs/axios.").addEnum("6.0.0","Use old HttpModule and HttpService from @nestjs/common.").defaultValue(this.nestVersion)); this.cliOptions.add(new CliOption(SERVICE_SUFFIX, "The suffix of the generated service.").defaultValue(this.serviceSuffix)); this.cliOptions.add(new CliOption(SERVICE_FILE_SUFFIX, "The suffix of the file of the generated service (service.ts).").defaultValue(this.serviceFileSuffix)); this.cliOptions.add(new CliOption(MODEL_SUFFIX, "The suffix of the generated model.")); @@ -113,7 +113,7 @@ public class TypeScriptNestjsClientCodegen extends AbstractTypeScriptClientCodeg @Override public String getHelp() { - return "Generates a TypeScript Nestjs 6.x client library."; + return "Generates a TypeScript Nestjs 8.x or 6.x client library."; } @Override @@ -170,6 +170,7 @@ public class TypeScriptNestjsClientCodegen extends AbstractTypeScriptClientCodeg additionalProperties.put("injectionToken", nestVersion.atLeast("4.0.0") ? "InjectionToken" : "OpaqueToken"); additionalProperties.put("injectionTokenTyped", nestVersion.atLeast("4.0.0")); additionalProperties.put("useHttpClient", nestVersion.atLeast("4.3.0")); + additionalProperties.put("useAxiosHttpModule", nestVersion.atLeast("8.0.0")); if (additionalProperties.containsKey(SERVICE_SUFFIX)) { serviceSuffix = additionalProperties.get(SERVICE_SUFFIX).toString(); validateClassSuffixArgument("Service", serviceSuffix); diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/README.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/README.mustache index c3c32e95219..735f9890335 100644 --- a/modules/openapi-generator/src/main/resources/typescript-nestjs/README.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/README.mustache @@ -16,7 +16,7 @@ In your Nestjs project: ``` // without configuring providers import { ApiModule } from '{{npmName}}'; -import { HttpModule } from '@nestjs/common'; +import { HttpModule } from '@nestjs/{{#useAxiosHttpModule}}axios{{/useAxiosHttpModule}}{{^useAxiosHttpModule}}common{{/useAxiosHttpModule}}'; @Module({ imports: [ @@ -66,7 +66,7 @@ in order to avoid naming conflicts: ``` import { ApiModule } from 'my-api-path'; import { ApiModule as OtherApiModule } from 'my-other-api-path'; -import { HttpModule } from '@nestjs/common'; +import { HttpModule } from '@nestjs/{{#useAxiosHttpModule}}axios{{/useAxiosHttpModule}}{{^useAxiosHttpModule}}common{{/useAxiosHttpModule}}'; @Module({ imports: [ diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.module.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.module.mustache index 636f9ef25f4..9cfdc25aec5 100644 --- a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.module.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.module.mustache @@ -1,4 +1,10 @@ +{{#useAxiosHttpModule}} +import { DynamicModule, Module, Global } from '@nestjs/common'; +import { HttpModule, HttpService } from '@nestjs/axios'; +{{/useAxiosHttpModule}} +{{^useAxiosHttpModule}} import { DynamicModule, HttpService, HttpModule, Module, Global } from '@nestjs/common'; +{{/useAxiosHttpModule}} import { Configuration } from './configuration'; {{#apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache index 72605436334..066abea1363 100644 --- a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache @@ -1,7 +1,13 @@ {{>licenseInfo}} /* tslint:disable:no-unused-variable member-ordering */ +{{#useAxiosHttpModule}} +import { Inject, Injectable, Optional } from '@nestjs/common'; +import { HttpService } from '@nestjs/axios'; +{{/useAxiosHttpModule}} +{{^useAxiosHttpModule}} import { HttpService, Inject, Injectable, Optional } from '@nestjs/common'; +{{/useAxiosHttpModule}} import { AxiosResponse } from 'axios'; import { Observable } from 'rxjs'; {{#imports}} diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.gitignore b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.gitignore new file mode 100644 index 00000000000..149b5765472 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.openapi-generator-ignore b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.openapi-generator/FILES b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.openapi-generator/FILES new file mode 100644 index 00000000000..d51e5a9a8bc --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.openapi-generator/FILES @@ -0,0 +1,22 @@ +.gitignore +README.md +api.module.ts +api/api.ts +api/pet.service.ts +api/store.service.ts +api/user.service.ts +configuration.ts +git_push.sh +index.ts +model/apiResponse.ts +model/category.ts +model/models.ts +model/order.ts +model/pet.ts +model/tag.ts +model/user.ts +package.json +tsconfig.build.json +tsconfig.json +tslint.json +variables.ts diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.openapi-generator/VERSION b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.openapi-generator/VERSION new file mode 100644 index 00000000000..66672d4e9d3 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/README.md b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/README.md new file mode 100644 index 00000000000..fc0ff642c3d --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/README.md @@ -0,0 +1,137 @@ +## @openapitools/typescript-nestjs-petstore@1.0.0 + +### Building + +To install the required dependencies and to build the typescript sources run: +``` +npm install +npm run build +``` + +#### General usage + +In your Nestjs project: + + +``` +// without configuring providers +import { ApiModule } from '@openapitools/typescript-nestjs-petstore'; +import { HttpModule } from '@nestjs/axios'; + +@Module({ + imports: [ + ApiModule, + HttpModule + ], + providers: [] +}) +export class AppModule {} +``` + +``` +// configuring providers +import { ApiModule, Configuration, ConfigurationParameters } from '@openapitools/typescript-nestjs-petstore'; + +export function apiConfigFactory (): Configuration => { + const params: ConfigurationParameters = { + // set configuration parameters here. + } + return new Configuration(params); +} + +@Module({ + imports: [ ApiModule.forRoot(apiConfigFactory) ], + declarations: [ AppComponent ], + providers: [], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + +``` +import { DefaultApi } from '@openapitools/typescript-nestjs-petstore'; + +export class AppComponent { + constructor(private apiGateway: DefaultApi) { } +} +``` + +Note: The ApiModule a dynamic module and instantiated once app wide. +This is to ensure that all services are treated as singletons. + +#### Using multiple swagger files / APIs / ApiModules +In order to use multiple `ApiModules` generated from different swagger files, +you can create an alias name when importing the modules +in order to avoid naming conflicts: +``` +import { ApiModule } from 'my-api-path'; +import { ApiModule as OtherApiModule } from 'my-other-api-path'; +import { HttpModule } from '@nestjs/axios'; + +@Module({ + imports: [ + ApiModule, + OtherApiModule, + HttpModule + ] +}) +export class AppModule { + +} +``` + + +### Set service base path +If different than the generated base path, during app bootstrap, you can provide the base path to your service. + +``` +import { BASE_PATH } from '@openapitools/typescript-nestjs-petstore'; + +bootstrap(AppComponent, [ + { provide: BASE_PATH, useValue: 'https://your-web-service.com' }, +]); +``` +or + +``` +import { BASE_PATH } from '@openapitools/typescript-nestjs-petstore'; + +@Module({ + imports: [], + declarations: [ AppComponent ], + providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + + +#### Using @nestjs/cli +First extend your `src/environments/*.ts` files by adding the corresponding base path: + +``` +export const environment = { + production: false, + API_BASE_PATH: 'http://127.0.0.1:8080' +}; +``` + +In the src/app/app.module.ts: +``` +import { BASE_PATH } from '@openapitools/typescript-nestjs-petstore'; +import { environment } from '../environments/environment'; + +@Module({ + declarations: [ + AppComponent + ], + imports: [ ], + providers: [ + { + provide: 'BASE_PATH', + useValue: environment.API_BASE_PATH + } + ] +}) +export class AppModule { } +``` diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api.module.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api.module.ts new file mode 100644 index 00000000000..394d158b29c --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api.module.ts @@ -0,0 +1,32 @@ +import { DynamicModule, Module, Global } from '@nestjs/common'; +import { HttpModule, HttpService } from '@nestjs/axios'; +import { Configuration } from './configuration'; + +import { PetService } from './api/pet.service'; +import { StoreService } from './api/store.service'; +import { UserService } from './api/user.service'; + +@Global() +@Module({ + imports: [ HttpModule ], + exports: [ + PetService, + StoreService, + UserService + ], + providers: [ + PetService, + StoreService, + UserService + ] +}) +export class ApiModule { + public static forRoot(configurationFactory: () => Configuration): DynamicModule { + return { + module: ApiModule, + providers: [ { provide: Configuration, useFactory: configurationFactory } ] + }; + } + + constructor( httpService: HttpService) { } +} diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/api.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/api.ts new file mode 100644 index 00000000000..8e44b64083d --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/api.ts @@ -0,0 +1,7 @@ +export * from './pet.service'; +import { PetService } from './pet.service'; +export * from './store.service'; +import { StoreService } from './store.service'; +export * from './user.service'; +import { UserService } from './user.service'; +export const APIS = [PetService, StoreService, UserService]; diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/pet.service.ts new file mode 100644 index 00000000000..115e76e75ae --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/pet.service.ts @@ -0,0 +1,475 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@nestjs/common'; +import { HttpService } from '@nestjs/axios'; +import { AxiosResponse } from 'axios'; +import { Observable } from 'rxjs'; +import { ApiResponse } from '../model/apiResponse'; +import { Pet } from '../model/pet'; +import { Configuration } from '../configuration'; + + +@Injectable() +export class PetService { + + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders: Record = {}; + public configuration = new Configuration(); + + constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) { + this.configuration = configuration || this.configuration; + this.basePath = configuration?.basePath || this.basePath; + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + return consumes.includes(form); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public addPet(pet: Pet, ): Observable>; + public addPet(pet: Pet, ): Observable { + + if (pet === null || pet === undefined) { + throw new Error('Required parameter pet was null or undefined when calling addPet.'); + } + + let headers = this.defaultHeaders; + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml', + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json', + 'application/xml' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + return this.httpClient.post(`${this.basePath}/pet`, + pet, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public deletePet(petId: number, apiKey?: string, ): Observable>; + public deletePet(petId: number, apiKey?: string, ): Observable { + + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling deletePet.'); + } + + + let headers = this.defaultHeaders; + if (apiKey !== undefined && apiKey !== null) { + headers['api_key'] = String(apiKey); + } + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + return this.httpClient.delete(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, ): Observable>>; + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, ): Observable { + + if (status === null || status === undefined) { + throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); + } + + let queryParameters = {}; + if (status) { + queryParameters['status'] = status.join(COLLECTION_FORMATS['csv']); + } + + let headers = this.defaultHeaders; + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml', + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + return this.httpClient.get>(`${this.basePath}/pet/findByStatus`, + { + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public findPetsByTags(tags: Array, ): Observable>>; + public findPetsByTags(tags: Array, ): Observable { + + if (tags === null || tags === undefined) { + throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); + } + + let queryParameters = {}; + if (tags) { + queryParameters['tags'] = tags.join(COLLECTION_FORMATS['csv']); + } + + let headers = this.defaultHeaders; + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml', + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + return this.httpClient.get>(`${this.basePath}/pet/findByTags`, + { + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getPetById(petId: number, ): Observable>; + public getPetById(petId: number, ): Observable { + + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling getPetById.'); + } + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml', + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + return this.httpClient.get(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public updatePet(pet: Pet, ): Observable>; + public updatePet(pet: Pet, ): Observable { + + if (pet === null || pet === undefined) { + throw new Error('Required parameter pet was null or undefined when calling updatePet.'); + } + + let headers = this.defaultHeaders; + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml', + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json', + 'application/xml' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + return this.httpClient.put(`${this.basePath}/pet`, + pet, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public updatePetWithForm(petId: number, name?: string, status?: string, ): Observable>; + public updatePetWithForm(petId: number, name?: string, status?: string, ): Observable { + + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); + } + + + + let headers = this.defaultHeaders; + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/x-www-form-urlencoded' + ]; + + const canConsumeForm = this.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): void; }; + let useForm = false; + let convertFormParamsToString = false; + if (useForm) { + formParams = new FormData(); + } else { + // formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + } + + if (name !== undefined) { + formParams.append('name', name); + } + + if (status !== undefined) { + formParams.append('status', status); + } + + return this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, + convertFormParamsToString ? formParams.toString() : formParams, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * uploads an image + * + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, ): Observable>; + public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, ): Observable { + + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); + } + + + + let headers = this.defaultHeaders; + + // authentication (petstore_auth) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers['Authorization'] = 'Bearer ' + accessToken; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'multipart/form-data' + ]; + + const canConsumeForm = this.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): void; }; + let useForm = false; + let convertFormParamsToString = false; + + // use FormData to transmit files using content-type "multipart/form-data" + // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data + useForm = canConsumeForm; + if (useForm) { + formParams = new FormData(); + } else { + // formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + } + + if (additionalMetadata !== undefined) { + formParams.append('additionalMetadata', additionalMetadata); + } + + if (file !== undefined) { + formParams.append('file', file); + } + + return this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, + convertFormParamsToString ? formParams.toString() : formParams, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } +} diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/store.service.ts new file mode 100644 index 00000000000..29110b427e9 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/store.service.ts @@ -0,0 +1,190 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@nestjs/common'; +import { HttpService } from '@nestjs/axios'; +import { AxiosResponse } from 'axios'; +import { Observable } from 'rxjs'; +import { Order } from '../model/order'; +import { Configuration } from '../configuration'; + + +@Injectable() +export class StoreService { + + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders: Record = {}; + public configuration = new Configuration(); + + constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) { + this.configuration = configuration || this.configuration; + this.basePath = configuration?.basePath || this.basePath; + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + return consumes.includes(form); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public deleteOrder(orderId: string, ): Observable>; + public deleteOrder(orderId: string, ): Observable { + + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); + } + + let headers = this.defaultHeaders; + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + return this.httpClient.delete(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getInventory(): Observable>; + public getInventory(): Observable { + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getOrderById(orderId: number, ): Observable>; + public getOrderById(orderId: number, ): Observable { + + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); + } + + let headers = this.defaultHeaders; + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml', + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + return this.httpClient.get(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public placeOrder(order: Order, ): Observable>; + public placeOrder(order: Order, ): Observable { + + if (order === null || order === undefined) { + throw new Error('Required parameter order was null or undefined when calling placeOrder.'); + } + + let headers = this.defaultHeaders; + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml', + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + return this.httpClient.post(`${this.basePath}/store/order`, + order, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } +} diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/user.service.ts new file mode 100644 index 00000000000..265fceafa25 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/api/user.service.ts @@ -0,0 +1,387 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@nestjs/common'; +import { HttpService } from '@nestjs/axios'; +import { AxiosResponse } from 'axios'; +import { Observable } from 'rxjs'; +import { User } from '../model/user'; +import { Configuration } from '../configuration'; + + +@Injectable() +export class UserService { + + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders: Record = {}; + public configuration = new Configuration(); + + constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) { + this.configuration = configuration || this.configuration; + this.basePath = configuration?.basePath || this.basePath; + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + return consumes.includes(form); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public createUser(user: User, ): Observable>; + public createUser(user: User, ): Observable { + + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling createUser.'); + } + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + return this.httpClient.post(`${this.basePath}/user`, + user, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Creates list of users with given input array + * + * @param user List of user object + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public createUsersWithArrayInput(user: Array, ): Observable>; + public createUsersWithArrayInput(user: Array, ): Observable { + + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling createUsersWithArrayInput.'); + } + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + return this.httpClient.post(`${this.basePath}/user/createWithArray`, + user, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Creates list of users with given input array + * + * @param user List of user object + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public createUsersWithListInput(user: Array, ): Observable>; + public createUsersWithListInput(user: Array, ): Observable { + + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling createUsersWithListInput.'); + } + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + return this.httpClient.post(`${this.basePath}/user/createWithList`, + user, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public deleteUser(username: string, ): Observable>; + public deleteUser(username: string, ): Observable { + + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling deleteUser.'); + } + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + return this.httpClient.delete(`${this.basePath}/user/${encodeURIComponent(String(username))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getUserByName(username: string, ): Observable>; + public getUserByName(username: string, ): Observable { + + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling getUserByName.'); + } + + let headers = this.defaultHeaders; + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml', + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + return this.httpClient.get(`${this.basePath}/user/${encodeURIComponent(String(username))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Logs user into the system + * + * @param username The user name for login + * @param password The password for login in clear text + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public loginUser(username: string, password: string, ): Observable>; + public loginUser(username: string, password: string, ): Observable { + + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling loginUser.'); + } + + if (password === null || password === undefined) { + throw new Error('Required parameter password was null or undefined when calling loginUser.'); + } + + let queryParameters = {}; + if (username !== undefined && username !== null) { + queryParameters['username'] = username; + } + if (password !== undefined && password !== null) { + queryParameters['password'] = password; + } + + let headers = this.defaultHeaders; + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/xml', + 'application/json' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + return this.httpClient.get(`${this.basePath}/user/login`, + { + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Logs out current logged in user session + * + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public logoutUser(): Observable>; + public logoutUser(): Observable { + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + ]; + return this.httpClient.get(`${this.basePath}/user/logout`, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted + * @param user Updated user object + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public updateUser(username: string, user: User, ): Observable>; + public updateUser(username: string, user: User, ): Observable { + + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling updateUser.'); + } + + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling updateUser.'); + } + + let headers = this.defaultHeaders; + + // authentication (api_key) required + if (this.configuration.apiKeys["api_key"]) { + headers['api_key'] = this.configuration.apiKeys["api_key"]; + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers['Accept'] = httpHeaderAcceptSelected; + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected != undefined) { + headers['Content-Type'] = httpContentTypeSelected; + } + return this.httpClient.put(`${this.basePath}/user/${encodeURIComponent(String(username))}`, + user, + { + withCredentials: this.configuration.withCredentials, + headers: headers + } + ); + } +} diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/configuration.ts new file mode 100644 index 00000000000..82e8458f39e --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/configuration.ts @@ -0,0 +1,79 @@ +export interface ConfigurationParameters { + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; +} + +export class Configuration { + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; + + constructor(configurationParameters: ConfigurationParameters = {}) { + this.apiKeys = configurationParameters.apiKeys; + this.username = configurationParameters.username; + this.password = configurationParameters.password; + this.accessToken = configurationParameters.accessToken; + this.basePath = configurationParameters.basePath; + this.withCredentials = configurationParameters.withCredentials; + } + + /** + * Select the correct content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param contentTypes - the array of content types that are available for selection + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderContentType (contentTypes: string[]): string | undefined { + if (contentTypes.length == 0) { + return undefined; + } + + let type = contentTypes.find(x => this.isJsonMime(x)); + if (type === undefined) { + return contentTypes[0]; + } + return type; + } + + /** + * Select the correct accept content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param accepts - the array of content types that are available for selection. + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderAccept(accepts: string[]): string | undefined { + if (accepts.length == 0) { + return undefined; + } + + let type = accepts.find(x => this.isJsonMime(x)); + if (type === undefined) { + return accepts[0]; + } + return type; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/git_push.sh b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/git_push.sh new file mode 100644 index 00000000000..f53a75d4fab --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/index.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/index.ts new file mode 100644 index 00000000000..c312b70fa3e --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/index.ts @@ -0,0 +1,5 @@ +export * from './api/api'; +export * from './model/models'; +export * from './variables'; +export * from './configuration'; +export * from './api.module'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/apiResponse.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/apiResponse.ts new file mode 100644 index 00000000000..682ba478921 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/apiResponse.ts @@ -0,0 +1,22 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Describes the result of uploading an image resource + */ +export interface ApiResponse { + code?: number; + type?: string; + message?: string; +} + diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/category.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/category.ts new file mode 100644 index 00000000000..b988b6827a0 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/category.ts @@ -0,0 +1,21 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * A category for a pet + */ +export interface Category { + id?: number; + name?: string; +} + diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/models.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/models.ts new file mode 100644 index 00000000000..8607c5dabd0 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/models.ts @@ -0,0 +1,6 @@ +export * from './apiResponse'; +export * from './category'; +export * from './order'; +export * from './pet'; +export * from './tag'; +export * from './user'; diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/order.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/order.ts new file mode 100644 index 00000000000..a29bebe4906 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/order.ts @@ -0,0 +1,37 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * An order for a pets from the pet store + */ +export interface Order { + id?: number; + petId?: number; + quantity?: number; + shipDate?: string; + /** + * Order Status + */ + status?: Order.StatusEnum; + complete?: boolean; +} +export namespace Order { + export type StatusEnum = 'placed' | 'approved' | 'delivered'; + export const StatusEnum = { + Placed: 'placed' as StatusEnum, + Approved: 'approved' as StatusEnum, + Delivered: 'delivered' as StatusEnum + }; +} + + diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/pet.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/pet.ts new file mode 100644 index 00000000000..e0404395f91 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/pet.ts @@ -0,0 +1,39 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { Category } from './category'; +import { Tag } from './tag'; + + +/** + * A pet for sale in the pet store + */ +export interface Pet { + id?: number; + category?: Category; + name: string; + photoUrls: Array; + tags?: Array; + /** + * pet status in the store + */ + status?: Pet.StatusEnum; +} +export namespace Pet { + export type StatusEnum = 'available' | 'pending' | 'sold'; + export const StatusEnum = { + Available: 'available' as StatusEnum, + Pending: 'pending' as StatusEnum, + Sold: 'sold' as StatusEnum + }; +} + + diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/tag.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/tag.ts new file mode 100644 index 00000000000..b6ff210e8df --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/tag.ts @@ -0,0 +1,21 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * A tag for a pet + */ +export interface Tag { + id?: number; + name?: string; +} + diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/user.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/user.ts new file mode 100644 index 00000000000..fce51005300 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/model/user.ts @@ -0,0 +1,30 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * A User who is purchasing from the pet store + */ +export interface User { + id?: number; + username?: string; + firstName?: string; + lastName?: string; + email?: string; + password?: string; + phone?: string; + /** + * User Status + */ + userStatus?: number; +} + diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/package.json b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/package.json new file mode 100644 index 00000000000..c49a0a25b9c --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/package.json @@ -0,0 +1,73 @@ +{ + "name": "@openapitools/typescript-nestjs-petstore", + "version": "1.0.0", + "description": "REST client for @openapitools/typescript-nestjs-petstore", + "author": "OpenAPI Generator Contributors", + "repository": { + "type": "git", + "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" + }, + "keywords": [ + "swagger-client" + ], + "license": "Unlicense", + "scripts": { + "build": "tsc -p tsconfig.build.json", + "build:clean": "rm -rf dist/ 2> /dev/null && tsc -p tsconfig.build.json", + "format": "prettier --write \"src/**/*.ts\"", + "start": "ts-node -r tsconfig-paths/register src/main.ts", + "start:dev": "concurrently --handle-input \"wait-on dist/main.js && nodemon\" \"tsc -w -p tsconfig.build.json\" ", + "start:debug": "nodemon --config nodemon-debug.json", + "prestart:prod": "rimraf dist && npm run build", + "start:prod": "node dist/main.js", + "lint": "tslint -p tsconfig.json -c tslint.json", + "lint:fix": "tslint -p tsconfig.json -c tslint.json --fix --force", + "test": "jest", + "test:watch": "jest --watch", + "test:cov": "jest --coverage", + "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", + "test:e2e": "jest --config ./test/jest-e2e.json" + }, + "dependencies": { + "@nestjs/common": "^8.0.0", + "@nestjs/core": "^8.0.0", + "@nestjs/platform-express": "^8.0.0", + "reflect-metadata": "^0.1.13", + "rimraf": "^2.6.3", + "rxjs": "^6.5.2" + }, + "devDependencies": { + "@nestjs/testing": "~8.0.0", + "@types/express": "^4.16.0", + "@types/jest": "^24.0.15", + "@types/node": "^12.6.1", + "@types/supertest": "^2.0.8", + "concurrently": "^4.1.1", + "nodemon": "^1.19.1", + "prettier": "^1.18.2", + "supertest": "^4.0.2", + "ts-jest": "24.0.2", + "ts-node": "8.3.0", + "tsconfig-paths": "3.8.0", + "tslint": "5.18.0", + "typescript": "^4.0", + "wait-on": "^3.2.0" + }, + "jest": { + "moduleFileExtensions": [ + "js", + "json", + "ts" + ], + "rootDir": "src", + "testRegex": ".spec.ts$", + "transform": { + "^.+\\.(t|j)s$": "ts-jest" + }, + "coverageDirectory": "../coverage", + "testEnvironment": "node" + }, + "publishConfig": { + "registry": "https://skimdb.npmjs.com/registry" + } +} diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tsconfig.build.json b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tsconfig.build.json new file mode 100644 index 00000000000..77f0c6a75e9 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "exclude": [ + "node_modules", + "test", + "dist", + "**/*spec.ts" + ] + } \ No newline at end of file diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tsconfig.json b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tsconfig.json new file mode 100644 index 00000000000..c71e17c1b8a --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es5", + "sourceMap": true, + "outDir": "./dist", + "baseUrl": "./", + "incremental": true + }, + "exclude": [ + "node_modules", + "dist" + ], + "filesGlob": [ + "./model/*.ts", + "./api/*.ts" + ] +} diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tslint.json b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tslint.json new file mode 100644 index 00000000000..5651b2f3db0 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tslint.json @@ -0,0 +1,18 @@ +{ + "defaultSeverity": "error", + "extends": ["tslint:recommended"], + "jsRules": { + "no-unused-expression": true + }, + "rules": { + "quotemark": [true, "single"], + "member-access": [false], + "ordered-imports": [false], + "max-line-length": [true, 150], + "member-ordering": [false], + "interface-name": [false], + "arrow-parens": false, + "object-literal-sort-keys": false + }, + "rulesDirectory": [] +} diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/variables.ts b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/variables.ts new file mode 100644 index 00000000000..d52a33f70e5 --- /dev/null +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/variables.ts @@ -0,0 +1,7 @@ + +export const COLLECTION_FORMATS = { + 'csv': ',', + 'tsv': ' ', + 'ssv': ' ', + 'pipes': '|' +}