OpenAPITools / OpenAPITools/openapi-generator
[BUG][typescript-fetch] Generating incorrect types
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
When using openapi-generator to generate a typescript-fetch API from this specification:
openapi-generator generate -i https://api.demo.kaizenep.com/swagger.json -g typescript-fetch -o kaizen-api
The generated code has incorrect types where "List" is referenced. For example line 182 and 219 of output apis/EventsApi.ts
async postEventSearchRaw(requestParameters: PostEventSearchRequest): Promise<runtime.ApiResponse<Array>> {
async postEventSearch(requestParameters: PostEventSearchRequest): Promise<Array> {
This should be:
async postEventSearchRaw(requestParameters: PostEventSearchRequest): Promise<runtime.ApiResponse<List>> {
async postEventSearch(requestParameters: PostEventSearchRequest): Promise<List> {
this is using openapi-generator 4.0.3
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
Reproduce the issue with the openapi-generator command and the referenced swagger.json URL, then inspect the generated apis/EventsApi.ts around lines 182 and 219. Compare the generated Promise types with the specification and confirm that the output preserves the referenced List type rather than an empty Array type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100