mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 06:30:52 +00:00
[BUG][typescript-rxjs] Fix nully type coalescing in Configuration getters (#5329)
* [typescript-rxjs] fix coalescing in Configuration - eliminate nully "" (empty string) value via conditional check - use concrete "string" type in typeof check ("function" may be returned for Object types * [typescript-rxjs] update petstore sample * run petstore-all - run the script for updating all petstores ./bin/typescript-rxjs-petstore-all.sh
This commit is contained in:
parent
4f7d45f603
commit
1ec2c26053
@ -36,12 +36,18 @@ export class Configuration {
|
|||||||
|
|
||||||
get apiKey(): ((name: string) => string) | undefined {
|
get apiKey(): ((name: string) => string) | undefined {
|
||||||
const apiKey = this.configuration.apiKey;
|
const apiKey = this.configuration.apiKey;
|
||||||
return apiKey && (typeof apiKey === 'function' ? apiKey : () => apiKey);
|
if (!apiKey) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return typeof apiKey === 'string' ? () => apiKey : apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||||
const accessToken = this.configuration.accessToken;
|
const accessToken = this.configuration.accessToken;
|
||||||
return accessToken && (typeof accessToken === 'function' ? accessToken : () => accessToken);
|
if (!accessToken) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return typeof accessToken === 'string' ? () => accessToken : accessToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,12 +47,18 @@ export class Configuration {
|
|||||||
|
|
||||||
get apiKey(): ((name: string) => string) | undefined {
|
get apiKey(): ((name: string) => string) | undefined {
|
||||||
const apiKey = this.configuration.apiKey;
|
const apiKey = this.configuration.apiKey;
|
||||||
return apiKey && (typeof apiKey === 'function' ? apiKey : () => apiKey);
|
if (!apiKey) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return typeof apiKey === 'string' ? () => apiKey : apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||||
const accessToken = this.configuration.accessToken;
|
const accessToken = this.configuration.accessToken;
|
||||||
return accessToken && (typeof accessToken === 'function' ? accessToken : () => accessToken);
|
if (!accessToken) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return typeof accessToken === 'string' ? () => accessToken : accessToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,12 +47,18 @@ export class Configuration {
|
|||||||
|
|
||||||
get apiKey(): ((name: string) => string) | undefined {
|
get apiKey(): ((name: string) => string) | undefined {
|
||||||
const apiKey = this.configuration.apiKey;
|
const apiKey = this.configuration.apiKey;
|
||||||
return apiKey && (typeof apiKey === 'function' ? apiKey : () => apiKey);
|
if (!apiKey) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return typeof apiKey === 'string' ? () => apiKey : apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||||
const accessToken = this.configuration.accessToken;
|
const accessToken = this.configuration.accessToken;
|
||||||
return accessToken && (typeof accessToken === 'function' ? accessToken : () => accessToken);
|
if (!accessToken) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return typeof accessToken === 'string' ? () => accessToken : accessToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,12 +47,18 @@ export class Configuration {
|
|||||||
|
|
||||||
get apiKey(): ((name: string) => string) | undefined {
|
get apiKey(): ((name: string) => string) | undefined {
|
||||||
const apiKey = this.configuration.apiKey;
|
const apiKey = this.configuration.apiKey;
|
||||||
return apiKey && (typeof apiKey === 'function' ? apiKey : () => apiKey);
|
if (!apiKey) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return typeof apiKey === 'string' ? () => apiKey : apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||||
const accessToken = this.configuration.accessToken;
|
const accessToken = this.configuration.accessToken;
|
||||||
return accessToken && (typeof accessToken === 'function' ? accessToken : () => accessToken);
|
if (!accessToken) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return typeof accessToken === 'string' ? () => accessToken : accessToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,12 +47,18 @@ export class Configuration {
|
|||||||
|
|
||||||
get apiKey(): ((name: string) => string) | undefined {
|
get apiKey(): ((name: string) => string) | undefined {
|
||||||
const apiKey = this.configuration.apiKey;
|
const apiKey = this.configuration.apiKey;
|
||||||
return apiKey && (typeof apiKey === 'function' ? apiKey : () => apiKey);
|
if (!apiKey) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return typeof apiKey === 'string' ? () => apiKey : apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||||
const accessToken = this.configuration.accessToken;
|
const accessToken = this.configuration.accessToken;
|
||||||
return accessToken && (typeof accessToken === 'function' ? accessToken : () => accessToken);
|
if (!accessToken) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return typeof accessToken === 'string' ? () => accessToken : accessToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user