-
-
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
[Java] InputStream is preferable to File from oas v3 with format binary #994
Comments
I would like to +1 this idea. My scenario is slightly different in that I could use an InputStream on the Java client side. The client generated method returns a File object. I want the bytes to be streamed and read in, so it's inefficient to write the bytes to disk then immediately read them back into memory. |
This seems to be related to #6715 |
Any update this? |
In my case I also have a problem with the client side (spring-mvc) that expects File for format: binary but I have a spring error because of the content-type: application/pdf |
Same here, seems like the webclient generation has a problem. The generated code tries to convert the response into a file object but fails:
|
Description
Currently,
File
type is employed in generated codes from oas v3 with format binary.I think InputStream type is more suitable for it.
I locally test with jersey, and found that jersey accepts
File
type as request body entity, but it internally writes the binary stream to local disk, and passes the wrote file to the resource class argument.It is not good for performance, so I think we should change type into
InputStream
openapi-generator version
current master (abe741f)
OpenAPI declaration file content or url
https://gist.github.com/fujigon/dd00a99b79a2bc811761b29e63e08a39#file-openapi-yaml
Command line used for generation
Steps to reproduce
execute the command, and it successfully runs.
I get
and so on.
Related issues/PRs
Suggest a fix/enhancement
https://github.com/fujigon/openapi-generator/tree/feature/fix-primitive-type-resolve
The text was updated successfully, but these errors were encountered: