-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[spring] @RequestPart should use "{{basename}}" instead of "file" and observe "required" attribute #9250
Comments
Changing formParams.mustache to the below seems to fix the issue:
|
thanks for reporting this! fixed in #9490 |
Which version of code gen is this fixed |
This is still happening with version 3.0.35 |
Description
When generating a spring-boot server for a POST processing multipart form data to upload one or several files, then the generated @RequestPart annotation always uses the fixed string "file" instead of the name of the part. Additionally, the required attribute is not considerd when building the @RequestPart annotation, so that file upload parameters are always required even if not defined to be so in the Swagger yaml file.
Swagger-codegen version
swagger-codegen-cli-2.4.2.jar
Swagger declaration file content or url
If you post the code inline, please wrap it with
Command line used for generation
Steps to reproduce
Create code with command given above. Check generated Api and Controller.
Related issues/PRs
Suggest a fix/enhancement
In https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/JavaSpring/formParams.mustache change the fixed "file" and replace it by "{{basename}}". Additionally fill the "required" attribute of this annotation.
The text was updated successfully, but these errors were encountered: