OpenAPITools / OpenAPITools/openapi-generator
[BUG] Java client (OkHttp) uses java.io.File for file parameters, instead of an InputStream
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
There is a serious design flaw in the Java client generated by default. Open to workarounds, have not been able to find one so far.
Description
Currently, if you have a binary string input parameter, the generated client takes a parameter of java.io.File. This is wrong because it means that you can only pass in a "local file" as a parameter. You cannot pass in a memory stream, which would be the more common case.
There does not seem to be an option to configure this, thus rendering the generated client completely useless for APIs that take in binary string / file parameter types. This is a huge issue. Would love to know if there is a workaround.
openapi-generator version
openapi-generator-cli-5.0.0-beta2.jar
OpenAPI declaration file content or url
https://api.cloudmersive.com/swagger/api/convert
Generation Details
See above
Steps to reproduce
See above
Related issues/PRs
N/A
Suggest a fix
Offer an option to use InputStream
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by generating the Java client from the linked Cloudmersive Swagger declaration with openapi-generator-cli-5.0.0-beta2.jar and inspect how binary string or file parameters are represented. Trace the generated client and generator configuration for a way to use InputStream, then verify that generated APIs accept in-memory streams rather than only java.io.File.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100