clientBaseClass option is not importing/copying the base class to the output file
See original GitHub issueHey guys,
I tried to wire the clientBaseClass
option, because I need to use the transformOptions
method to add custom HTTP Headers for authentication purposes. I’m generating a TypeScript client. I think my nswag.json
has everything required set up:
...
"useTransformOptionsMethod": true,
"clientBaseClass": "ServiceBase",
"extensionCode": "api-client.extensions.ts",
"output": "au-api-client.ts"
...
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:
import { inject } from 'aurelia-framework';
import { HttpClient, RequestInit } from 'aurelia-fetch-client';
import * as moment from 'moment';
@inject(String, HttpClient)
export class ApplicationService extends ServiceBase {
private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
...
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.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:8 (5 by maintainers)
Top Results From Across the Web
How to copy data from base class to derived class fastly?
1 Answer 1 ... There is no general way to do this, as the layout of the data in the base and derived...
Read more >When amsart is used as a base class of another ...
After glancing at amsclass source documentation and a bit of experimenting, i observed that simply using \documentclass[fleqn]{myamsart} in my ...
Read more >The Designer could not be shown for this file because ...
I have a project produced in Visual Studio 2017. I have just downloaded Visual Studio 2022 and tried to open the project.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 */{…}
Somehow the extension code loader does not find your class and does not load your class:
https://github.com/RSuter/NJsonSchema/blob/master/src/NJsonSchema.CodeGeneration.TypeScript/TypeScriptExtensionCode.cs#L29
Do you see a problem here?