OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.49k stars 6.5k forks source link

[BUG][typescript-axios] TypeError: openapi_1.*Api is not a constructor #13039

Open martin-fv opened 2 years ago

martin-fv commented 2 years ago

Bug Report Checklist

Description

I'm using the typescript-axios generator. The creation of the client is not difficult, however there is 0 documentation about the usage. How should it be initialised? It would be really nice to add examples about the meanings of the API exports: ResourceApi, ..ApiFn, ApiFactory: What are the differences?

const client = new WikidataApi();
               ^
TypeError: openapi_1.WikidataApi is not a constructor

However I'm getting this error when initializing the class.

openapi-generator version

"@openapitools/openapi-generator-cli": "^2.5.1"

OpenAPI declaration file content or url

https://entitree-openapi.vercel.app/api/openapi.json

Generation Details

openapi-generator-cli generate -i src/openapi.json -g typescript-axios -o src/openapi

Steps to reproduce
import { WikidataApi } from "./openapi";

const client = new WikidataApi();
const ret = client.getAirlineByIATACodeGet("FRA");
Related issues/PRs
Suggest a fix
willyq2009 commented 2 years ago

any resolution to this issue? running into it when instantiating a new class. Using openApi 3.0.0