Skip to content

openapi2tsclient does not add AbortSignal to interfaces #3634

@Strepto

Description

@Strepto

Hi!

When combining /GenerateClientInterfaces:true and /UseAbortSignal:true the interface does not not contain the AbortSignal.

Example output snippet:

export interface IApiStatusClient {
    getApiStatusIsOnline(): Promise<void>;
}

export class ApiStatusClient implements IApiStatusClient {
...
    getApiStatusIsOnline(signal?: AbortSignal | undefined): Promise<void> {
...
}

Note that Signal is defined in the class, but ignored in the interface.

Full command below:

nswag openapi2tsclient 
/output:src/services/generated/StatusApiClient.ts 
/input:https://URL/swagger/v1/swagger.json 
/ClassName:"{controller}Client"
 /NullValue:undefined 
/GenerateClientInterfaces:true 
/GenerateOptionalParameters:true 
/SupportsStrictNullChecks:true
/EnumStyle:StringLiteral 
/ServiceSchemes:https 
/OperationGenerationMode:MultipleClientsFromFirstTagAndOperationId 
/UseAbortSignal:true
/runtime:Net50

Version Info:

NSwag NPM CLI
NSwag command line tool for .NET Core Net50, toolchain v13.13.2.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v12.0.0.0))

Is this behaviour intentional? I might consider fixing this if its not by design.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions