Is there any way generate Abstract class as ANY object using NSwag TypeScript Client?

Viewed 418

I have many abstract classes in my .NET application. I have use this abstractions as in the Requests and in the Responses.

When I generated TypeScriptClient then I see next typescript code:

export class IDetectionEngineProfile implements IIDetectionEngineProfile {

    constructor(data?: IIDetectionEngineProfile) {
        if (data) {
            for (var property in data) {
                if (data.hasOwnProperty(property))
                    (<any>this)[property] = (<any>data)[property];
            }
        }
    }

    init(_data?: any) {
    }

    static fromJS(data: any): IDetectionEngineProfile {
        data = typeof data === 'object' ? data : {};
        let result = new IDetectionEngineProfile();
        result.init(data);
        return result;
    }

    toJSON(data?: any) {
        data = typeof data === 'object' ? data : {};
        return data; 
    }
}

export interface IIDetectionEngineProfile {
}

Of course IDetectionEngineProfile have no any property. It is absolutely correct.

But I would prevent generation of this code and work just with ANY object.

It is possible for NSwag?

P/S: I have reviewed Inheritance article. But it is not a solution for me.

0 Answers
Related