[kotlin-spring] Handle arrays of files correctly using MultipartFile#20108
Conversation
…ltipart/form-data
…nstead of Spring's Resource class.
….springframework.core.io.Resource`
|
I'm not sure that I did the samples properly, as they seem to have switched to Windows path separators instead. |
|
thanks for the PR. i've filed #20117 with updated samples. is it correct to say that this is a breaking change as |
|
@wing328 Yeah, I guess you could consider it that. All Spring documentation says to be using MultipartFile for uploads (but we still keep Resource for downloads) |
|
can you please review the build failure when you've time? |
ok. i'll see if i can come up with a way to fallback in case the users prefer the current implementation. |
Sorry, I'm a bit of a noob on Github Actions. Maven build passes successfully when run, is there a way to run these tests locally? (should they be included in mvn test?) |
|
can you run |
|
There isn't any gradle wrapper in that directory EDIT: Ah I got it to run locally after some playing around. Let me fix these issues.. |
…taType.mustache. Update samples
|
@wing328 I made some changes but there doesn't seem to be a good way to verify all the samples compile. I feel like this should be part of the maven build |
|
fyi. updated samples via 2c25491 |
|
agreed with you that we should also test the kotlin spring project with maven as well |
|
cc @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) @stefankoppier (2022/06) @e5l (2024/10) |
|
Is it correct that this change makes it impossible to generate a controller for non multipart fileuploads? |
|
Is it possible to apply this patch on 7.0.1? |
…penAPITools#20108) * [kotlin-spring] Fix no List being used for an array of files using multipart/form-data * [kotlin-spring] Use Spring's MultipartFile class for incoming Files instead of Spring's Resource class. * [kotlin-spring] Add test to ensure that return type for files is `org.springframework.core.io.Resource` * [kotlin-spring] Ensure Array is used for lists of files in generated Api class * Update samples * [kotlin-spring] Move conditional usage of MultipartFile to optionalDataType.mustache. Update samples * update samples --------- Co-authored-by: William Cheng <wing328hk@gmail.com>
This handles request parameters of arrays of files correctly, as well as changing them to use Spring's Multipart File class, as is recommended. Previously, Spring's Resource would be used as the input and the Delegate class would not recognize the array
Fixes the following open issues for Kotlin-spring generator:
#8333
#15251
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)