-
-
Notifications
You must be signed in to change notification settings - Fork 7k
[BUG] [Spring] Generated API interface treats multipart arrays as a single file #3139
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
Comments
I am not sure if it is the best solution.... But for me this worked.... 1-Download templates for JavaSpring to local project folder from github 2-Include the templateDirectory parameter in the plugin configuration
3-Fix the related templates: api.mustache, apiDelegate.mustache, exampleReturnTypes.mustache, formParams.mustache, formParams.mustache by replacing all MultipartFile entries by {{#isListContainer}}List<{{/isListContainer}}MultipartFile{{#isListContainer}}>{{/isListContainer}} |
Multi-part binary array strings as outlined in OpenAPITools#3139 resulted in `MultipartFile` rather than `List<MultipartFile>`. This PR attempts to resolve this by adjusting the templates. Two tests have been added: one for `spring-boot` and one for `spring-cloud`. Resolve OpenAPITools#3139
* Fix multi-part binary array strings Multi-part binary array strings as outlined in OpenAPITools#3139 resulted in `MultipartFile` rather than `List<MultipartFile>`. This PR attempts to resolve this by adjusting the templates. Two tests have been added: one for `spring-boot` and one for `spring-cloud`. Resolve OpenAPITools#3139 * Fix multipart file name and description * Handle array of MultipartFile for delegate * Update samples due to file description being picked up * Upload result of bin/spring-stubs
…g Cloud templates (#4616) * Fix multi-part binary array strings Multi-part binary array strings as outlined in #3139 resulted in `MultipartFile` rather than `List<MultipartFile>`. This PR attempts to resolve this by adjusting the templates. Two tests have been added: one for `spring-boot` and one for `spring-cloud`. Resolve #3139 * Fix multipart file name and description * Handle array of MultipartFile for delegate * Update samples due to file description being picked up * Upload result of bin/spring-stubs
Uh oh!
There was an error while loading. Please reload this page.
Bug Report Checklist
Description
Generated API interface for multipart arrays contains a single MultipartFile instead of a list. Besides any MultipartFile argument should have @RequestPart annotation instead of @RequestParam.
openapi-generator version
Tested with 4.0.0 version of https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin
OpenAPI declaration file content or url
Command line used for generation
Maven plugin was used:
Steps to reproduce
Generate MultipartApi interface using the plugin configuration listed above. Both multipartArray and multipartSingle methods contains a single MultipartFile parameter with @RequestParam annotation.
Related issues/PRs
Suggest a fix
Looks like the mustache template formParams.mustache ignores arrays.
The text was updated successfully, but these errors were encountered: