OpenAPITools / OpenAPITools/openapi-generator
[BUG] typescript-axios generator works bad for formdata array
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
openapi-generator version
5.1.1
OpenAPI declaration file content or url
put:
summary: "Update a new painting"
operationId: "updatePainting"
tags:
- "Paintings"
consumes:
- "multipart/form-data"
parameters:
- in: "formData"
name: "image"
type: "file"
- in: "formData"
name: "genres"
type: **"array"**
items:
type: "string"
required: true
Generation Details
openapi-generator-cli generate -g typescript-axios -i ../server/swagger.yaml -o src/api
Steps to reproduce
Specification example results in:
if (genres) {
localVarFormParams.append(genres.join(COLLECTION_FORMATS.csv));
}
and the error in browser displayed: TypeError: Failed to execute 'append' on 'FormData': 2 arguments required, but only 1 present.
Suggest a fix
Expected result:
if (genres) {
localVarFormParams.append('genres', genres.join(COLLECTION_FORMATS.csv));
}
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 with the typescript-axios generator and reproduce the issue using the provided OpenAPI formData declaration and generation command. Trace the generated FormData handling for the genres array, then verify the generated call includes the parameter name and passes the reproduction without the browser append error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100