OpenAPITools / OpenAPITools/openapi-generator
[BUG][java] Allow requests to return InputStream rather than File
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
When the Java SDK is paired with the okhttp-gson library requests made with a response body of...
"type": "string",
"format": "binary"
return a File rather than an InputStream or other form of binary data. I am logging the feature request as I've tried to implement this without success and am looking for guidance on the implementation.
Describe the solution you'd like
Requests with a response body of...
"type": "string",
"format": "binary"
return an InputStream rather than relying on a File. Using the useAbstractionForFiles additional property to control this behavior would be acceptable.
Describe alternatives you've considered
I've attempted to implement this functionality within the SDK using a combination of an additional property, useAbstractionForFiles, which already exists and seems to cover this use-case by the description of the property and using Mustache templates.
Additional context
I've come across an issue where in testing {{#returnType}}{{#isFile}}true{{/isFile}}{{/returnType}} within the request never returns true although the return type from the function is of type File.
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 tracing Java SDK generation for okhttp-gson responses with type: string and format: binary, including the existing useAbstractionForFiles property and Mustache templates. Inspect why {{#returnType}}{{#isFile}} does not evaluate as expected; done means generated requests expose an InputStream or equivalent binary abstraction instead of requiring a File.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100