OpenAPITools / OpenAPITools/openapi-generator
[BUG] File upload Qt5cpp formdata
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
Wrong headers in POST request due to "IsFormData" not set in generated OAIHttpRequest.cpp
openapi-generator version
3.3.4
OpenAPI declaration file content or url
post:
description: Upload a file
operationId: uploadFile
consumes:
- multipart/form-data
parameters:
- name: device_id
in: path
description: device serial number
required: true
type: string
- name: resource_name
in: path
description: Filename
required: true
type: string
- name: uploaded_file
in: formData
description: Uploaded file
required: true
type: file
Command line used for generation
java -jar openapi-generator-cli.jar generate -i pilot/api.yaml -g cpp-qt5 -o test
Suggest a fix
Not sure about the generator fix, but if you stumple across this issue, it can be fixed by setting the isFormData to true when it sets the layout.
if (input->files.length() > 0) {
isFormData = true;
input->var_layout = MULTIPART;
}
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 supplied OpenAPI declaration and cpp-qt5 generation command, then inspect the generated OAIHttpRequest.cpp around multipart layout handling. Done means a file upload request sets IsFormData and produces the correct POST headers for multipart/form-data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, openapi
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100