[typescript] strictNullChecks errors for Configuration.apiKeys
Created by: grktsh
Description
When OpenAPI document has security
field of apiKey
type, openapi-generator generates service classes which have strictNullChecks errors for Configuration.apiKeys
.
openapi-generator version
v3.3.3
OpenAPI declaration file content or url
components:
securitySchemes:
api_key:
type: apiKey
name: X-API-Key
in: header
security:
- api_key: []
Suggest a fix/enhancement
I'd like to add this.configuration.apiKeys &&
to the following condition from typescript-angular/api.service.mustache@master
{{#isKeyInHeader}}
if (this.configuration.apiKeys["{{keyParamName}}"]) {
Here is the definition of Configuration class from typescript-angular/configuration.mustache@master
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;