OpenAPITools / OpenAPITools/openapi-generator
[BUG][typescript-axios] TypeError: openapi_1.*Api is not a constructor
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by generating the client with the documented command from the OpenAPI declaration at https://entitree-openapi.vercel.app/api/openapi.json, then inspect the generated src/openapi entry point and its exported ResourceApi, ApiFn, ApiFactory, and WikidataApi symbols. Reproduce the import and instantiation shown in the issue; done means the generated client can be initialized as documented or the supported export usage is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100