Open fodiimre opened 7 years ago
You have to add the import statement to "api-client.extensions.ts"
... or define the base class directly in "api-client.extensions.ts" so that it is inlined... (like in the sample)
I have the ServiceBase
class defined in the api-client.extensions.ts
, what should I import there?
I have this in api-client.extensions.ts
:
export class ServiceBase {
protected transformOptions(options: RequestOptionsArgs) {
console.log('transformOptions');
return Promise.resolve(options);
}
protected transformResult(url: string, response: Response, processor: (response: Response) => any): Observable<any> {
console.log('transformResult');
return processor(response);
}
}
Ok this is strange...
Try manually adding "ServiceBase" to the "ExtensionClasses" settings:
"extensionClasses": [ "ServiceBase" ]
the ClientBaseClass should be automatically added but there seems to be a problem...
Adding "extensionClasses": [ "ServiceBase" ]
did not help.
Somehow the extension code loader does not find your class and does not load your class:
Do you see a problem here?
I encountered the same problem. It seems that it has to do with windows/unix file endings. On my windows machine this doesn't work:
export class Lvsapibaseclient {...}
But this ugly one get's generated in the right way:
export class Lvsapibaseclient /\r /{...}
Hey guys,
I tried to wire the
clientBaseClass
option, because I need to use thetransformOptions
method to add custom HTTP Headers for authentication purposes. I'm generating a TypeScript client. I think mynswag.json
has everything required set up:I set it up, based on this. My problem is that an import statement is missing for the
ServiceBase
class in the generated file, so the generated client cannot be used at all:Here it seems to add the base class to the generated file, but for me it does not.
Version info:
Generated using the NSwag toolchain v11.6.1.0 (NJsonSchema v9.5.0.0)
Any ideas how to fix it? Thank you.