OpenAPITools / OpenAPITools/openapi-generator
[BUG] [typescript-axios] Missing import for ActionResult<IDictionary<string, IEnumerable<QueryResponse>>>
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
When a C# controller action returns ActionResult<IDictionary<string, IEnumerable<QueryResponse>>>
And a web client is generated using the typescript-axios generator
Then the generated implementation of the controller is missing an import to QueryResponse
https://github.com/szszoke/OpenAPIBadTS
Code for QueryResponse is properly generated, it is just not imported.
The relevant file is https://github.com/szszoke/OpenAPIBadTS/blob/main/web_client/api/weather-forecast-api.ts
The same output is generated using the latest docker image, which can be seen my running docker build . in the root directory of the demo repository.
openapi-generator version
5.1.0
OpenAPI declaration file content or url
https://github.com/szszoke/OpenAPIBadTS/blob/main/swagger.json
Generation Details
Minimal project to trigger the bug:
https://github.com/szszoke/OpenAPIBadTS
Steps to reproduce
git clone https://github.com/szszoke/OpenAPIBadTScd OpenAPIBadTSdotnet restoredotnet buildnpm installnpm run trigger-bug
Observe that the last step, where the generated client is compiled via the TypeScript compiler, fails due to the missing import of QueryResponse.
The expected output would be that QueryResponse is imported in api/weather-forecast-api.ts. The actual output is that it is not imported.
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
Clone OpenAPIBadTS and run the listed .NET and npm steps, especially npm run trigger-bug, to reproduce the TypeScript compilation failure. Compare the generated web_client/api/weather-forecast-api.ts with swagger.json and trace the typescript-axios generator's import handling; done means QueryResponse is imported and the generated client compiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100