-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
[BUG][KOTLIN-SPRING] Multipart file upload generate wrong type #8333
Comments
@notizklotz thanks for reporting the issue. Can you please file a PR with the suggested fix in the spring generator when you've time? We'll review accordingly |
Hi, yes I'll prepare a PR |
back in 2019 the générator switched to Resources (my bad #2455) Since MultipartFile don't exist in reactive spring. we should use |
I stumbled upon the same problem for reactive. Indeed, Next, the problem is with the mentioned type - So I propose changing it (at least for now) to @wing328 |
Hey Guys, It works with resources but you have to adapt the RequestPart parameter. By default it generates @RequestPart("file") but using @RequesPart("my_param_name") worked for me. |
I have the same issue, trying to upload multiple files within the same request. kotlin-spring generator does not respect the property name for the file:
As you can see, both @m-i-k-e-e how did you manage to set "my_param_name" in there? |
I ran into the same issue with multipart and kotlin-spring generator |
one suggestion as a fix, could be:
|
@dds-pereihug Thank you so much for your solution. It works.
|
Glad i could help @OlgaErmolaeva. @wing328 dont know if there was a pr for this, but if u want i can provide my suggestion as form as PR. |
Hi @wing328 |
please kindly submit a PR if none has been submitted so far we will review accordingly and try to get it merged before next release |
I truly appreciate the time and effort you've already put into addressing this matter. |
Can you please let me know when the next release with this fix will be available? 🤞 Thank you for your effort. |
Bug Report Checklist
Description
The kotlin-spring generator generates multipart file upload attributes as
org.springframework.core.io.Resource
which actually cannot be handled by Spring Boot.org.springframework.web.multipart.MultipartFile
should be generated instead: Uploading files guideThe spring generator handles this case correctly by applying some special case handling in the Mustache templates.
openapi-generator version
openapi-generator-maven-plugin:5.0.0
OpenAPI declaration file content or url
Multipart file upload sample spec
Steps to reproduce
List<MultipartFile>
while the kotlin-spring generator generatesList<Resource>
Related issues/PRs
Suggest a fix
Apply the same special case handling in the templates like the spring generator
The text was updated successfully, but these errors were encountered: