-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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] [jaxrs-jersey] [java] [jersey] Generated API interface treats multipart arrays as a single file #7330
Closed
5 of 6 tasks
Labels
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
I prefer 'choice C' , for fixing this issue :-) |
itaru2622
changed the title
[BUG] [jaxrs-jersey] Generated API interface treats multipart arrays as a single file
[BUG] [jaxrs-jersey] [java] [jersey] Generated API interface treats multipart arrays as a single file
Sep 2, 2020
I tested with latest version (*) and found this issue is still exists. *: docker image named openapitools/openapi-generator-cli:latest at https://hub.docker.com/r/openapitools/openapi-generator-cli/ |
6 tasks
itaru2622
added a commit
to itaru2622/openapi-generator
that referenced
this issue
Sep 7, 2020
… on generating jaxrs-jersey. This commit aims to fix OpenAPITools#7330 with described solution 'choice C'.
6 tasks
itaru2622
added a commit
to itaru2622/openapi-generator
that referenced
this issue
Oct 14, 2020
… on generating jaxrs-jersey. This commit aims to fix OpenAPITools#7330 with described solution 'choice C'.
wing328
pushed a commit
that referenced
this issue
Oct 25, 2020
* Fix [jaxrs-jersey][java][jersey] multipart/form-data file array issue on generating jaxrs-jersey. This commit aims to fix #7330 with described solution 'choice C'. * add test code [jaxrs-jersey][java][jersey] for multipart/form-data file on generating * update test code [jaxrs-jersey][java][jersey] for multipart/form-data file on generating followed latest master branch of OpenAPITools/openapi-generator * update samples/* by executing ./bin/generate-samples.sh * update mustaches for JavaJaxxRS/libraries/jersey1/* and samples/* to resolve failure of CI test on PR.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report Checklist
Description
Generated API interface for multipart arrays contains a single of InputStream and FormDataContentDisposition, instead of a list of those.
openapi-generator version
version 4.3.1 and official docker image openapitools/openapi-generator:cli-4.3.x pulled from https://hub.docker.com/r/openapitools/openapi-generator/
OpenAPI declaration file content or url
https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yaml
Generation Details
wget -O /tmp/form-multipart-binary-array.yaml https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yaml docker run -it -v /tmp:/tmp openapitools/openapi-generator:cli-4.3.x generate -g jaxrs-jersey -i /tmp/form-multipart-binary-array.yaml -o /tmp/out cat /tmp/out/src/main/java/org/openapitools/api/impl/MultipartArrayApiServiceImpl.java | grep multipartArray
Steps to reproduce
Generate MultipartApi interface as listed above.
Both multipartArray and multipartSingle methods contains a single of { InputStream, FormDataContentDisposition }
Related issues/PRs
Issue #3139 and PR #4616 (already merged).
Issue #3139 is occurred in spring and this is almost same issue occurred in jaxrs-jersey.
Suggest a fix
The following template files have no array, as described bellow snippets:
JavaJaxRS/formParams.mustache
JavaJaxRS/serviceFormParams.mustache
There are following three choices to fix, according to stackoverflow.com and other sites.
cf. https://stackoverflow.com/questions/56954122/multiple-files-upload-in-a-rest-service-using-jersey
Choice B and C could fix this issue but 'Choice A' may not.
Some may prefer 'Choice C' but other may prefer 'Choice B' !?
choice A) simplest but FAILED in communication test.
List<InputStream>
is always null . It needs some further investigation to find out reason.choice B) keeping backward compatibility, but ugly in coding.
List<FormDataBodyPart>
in multipartArray case as described in following snippets.choice C) breaking backward compatibility, but smarter.
The text was updated successfully, but these errors were encountered: