typescript-angular: Fix Cannot read property 'apiKey' of undefined (#9260)

* fix #9259

* avoid optional chaining operator
This commit is contained in:
Emmanuel Roux
2021-04-16 16:54:58 +02:00
committed by GitHub
parent b5dac42959
commit 032911990d
19 changed files with 95 additions and 19 deletions
@@ -64,7 +64,11 @@ export class {{configurationClassName}} {
{{#isApiKey}}
this.credentials['{{name}}'] = () => {
{{! Fallback behaviour may be removed for 5.0 release. See #5062 }}
return this.apiKeys['{{name}}'] || this.apiKeys['{{keyParamName}}'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['{{name}}'] || this.apiKeys['{{keyParamName}}'];
}
};
{{/isApiKey}}
{{#isBasic}}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class PetStoreConfiguration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}
@@ -61,7 +61,11 @@ export class Configuration {
// init default api_key credential
if (!this.credentials['api_key']) {
this.credentials['api_key'] = () => {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
if (this.apiKeys === null || this.apiKeys === undefined) {
return undefined;
} else {
return this.apiKeys['api_key'] || this.apiKeys['api_key'];
}
};
}