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
  • #10608
Closed
Open
Issue created Oct 15, 2021 by Administrator@rootContributor2 of 6 checklist items completed2/6 checklist items

[BUG] [typescript-axios] axios v0.23.0 has breaking changes

Created by: heavenshell

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

axios v0.2.3 was released and has Breaking changes. https://github.com/axios/axios/releases/tag/v0.23.0 Previous v0.22.0 works fine(No type error)

createRequestFunction() return type is incompatible.

api.ts:3292:13 - error TS2322: Type '(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<unknown, any>>' is not assignable to type '(
axios?: AxiosInstance | undefined, basePath?: string | undefined) => AxiosPromise<User>'.                                                                                         
  Call signature return types 'Promise<AxiosResponse<unknown, any>>' and 'AxiosPromise<User>' are incompatible.                                                                   
    The types of 'then' are incompatible between these types.                                                                                                                     
      Type '<TResult1 = AxiosResponse<unknown, any>, TResult2 = never>(onfulfilled?: ((value: AxiosResponse<unknown, any>) => TResult1 | PromiseLike<TResult1>) | null | undefined
, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | ... 1 more ... | undefined) => Promise<...>' is not assignable to type '<TResult1 = AxiosResponse<User, any>, TRes
ult2 = never>(onfulfilled?: ((value: AxiosResponse<User, any>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>
) | ... 1 more ... | undefined) => Promise<...>'.                                                                                                                                 
        Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.                                                                                                     
          Types of parameters 'value' and 'value' are incompatible.                                                                                                               
            Type 'AxiosResponse<unknown, any>' is not assignable to type 'AxiosResponse<User, any>'.                                                                              
              Type 'unknown' is not assignable to type 'User'.                                                                                                                    
                                                                                                                                                                                  
3292             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);                                                                          
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I generate typescript-axios client like following.

npx openapi-generator-cli generate -i ./codegen/openapi.yaml -g typescript-axios -o ./src/apis/sample -c ./codegen/config.json"
openapi-generator version

5.2.1

Thank you!

Assignee
Assign to
Time tracking