Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #4851
Closed
Open
Issue created Dec 20, 2019 by Administrator@rootContributor

[REQ] Support AbortController in Typescript-Fetch

Created by: rahulsom

Is your feature request related to a problem? Please describe.

The Fetch API supports attaching a signal, and using that to abort requests. This is particularly helpful when building SPAs which background a lot of requests, and the user navigates to an area of the app where some requests are no longer useful. It improves performance for the user if we can cancel pending requests so newer requests can execute sooner.

Describe the solution you'd like

Currently, this is what generated code looks like when using single param

async methodName(requestParameters: RequestType): Promise<ResponseType> {...}
interface RequestType {
  fieldName1: FieldType1;
  fieldName2: FieldType2;
}

Support either of these two methods

async methodName(requestParameters: RequestType, abortController?: AbortController): Promise<ResponseType> {...}
interface RequestType {
  fieldName1: FieldType1;
  fieldName2: FieldType2;
}

or

async methodName(requestParameters: RequestType): Promise<ResponseType> {...}
interface RequestType {
  fieldName1: FieldType1;
  fieldName2: FieldType2;
  abortController: AbortController;
}

This library seems to be commonly used for this purpose - https://github.com/mysticatea/abort-controller

Describe alternatives you've considered

I can't think of an alternative.

Additional context

None.

Assignee
Assign to
Time tracking