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 4d2f116daf..d5dfcc0a10 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 @@ -121,7 +121,7 @@ export class {{classname}} { // authentication ({{name}}) required {{#isApiKey}} {{#isKeyInHeader}} - if (this.configuration.apiKeys["{{keyParamName}}"]) { + if (this.configuration.apiKeys?.["{{keyParamName}}"]) { headers['{{keyParamName}}'] = this.configuration.apiKeys["{{keyParamName}}"]; } @@ -130,7 +130,7 @@ export class {{classname}} { {{^hasQueryParams}} let queryParameters = new URLSearchParams(); {{/hasQueryParams}} - if (this.configuration.apiKeys["{{keyParamName}}"]) { + if (this.configuration.apiKeys?.["{{keyParamName}}"]) { queryParameters.append('{{keyParamName}}', this.configuration.apiKeys["{{keyParamName}}"]); } diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts index ba76f58877..a28b44fc64 100644 --- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts @@ -255,7 +255,7 @@ export class PetService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/store.service.ts index cadb5a9048..84b80c0f1d 100644 --- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/store.service.ts @@ -85,7 +85,7 @@ export class StoreService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/user.service.ts index 7cac2f8bf5..32ed0c7a5f 100644 --- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/user.service.ts @@ -56,7 +56,7 @@ export class UserService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } @@ -101,7 +101,7 @@ export class UserService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } @@ -146,7 +146,7 @@ export class UserService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } @@ -191,7 +191,7 @@ export class UserService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } @@ -311,7 +311,7 @@ export class UserService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } @@ -355,7 +355,7 @@ export class UserService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } 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 index 851eb41148..3a8c5f4125 100644 --- 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 @@ -256,7 +256,7 @@ export class PetService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } 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 index 6b35126e5b..daae6d1dbe 100644 --- 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 @@ -86,7 +86,7 @@ export class StoreService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } 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 index f5e7a5ff5c..c34c9ae187 100644 --- 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 @@ -57,7 +57,7 @@ export class UserService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } @@ -102,7 +102,7 @@ export class UserService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } @@ -147,7 +147,7 @@ export class UserService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } @@ -192,7 +192,7 @@ export class UserService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } @@ -312,7 +312,7 @@ export class UserService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; } @@ -356,7 +356,7 @@ export class UserService { let headers = {...this.defaultHeaders}; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { + if (this.configuration.apiKeys?.["api_key"]) { headers['api_key'] = this.configuration.apiKeys["api_key"]; }