Skip to content
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

[Kotlin]] add support for binary response #7205

Closed
wants to merge 5 commits into from

Conversation

revmischa
Copy link
Contributor

@revmischa revmischa commented Aug 13, 2020

Add missing support for handling binary responses in Kotlin clients.
It would be a lot better to use InputStream for the response type mapping, could use some advice on how to achieve that.

More discussion at issue: #7204

@jimschubert , @dr4ke616 @karismann @Zomzog @andrewemery @4brunu @yutaka0m

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

@wing328
Copy link
Member

wing328 commented Aug 18, 2020

e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/c
> Task :compileKotlin FAILED
lient/infrastructure/ApiClient.kt: (121, 23): Unresolved reference: BufferedWriter
e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt: (121, 38): Unresolved reference: FileWriter

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileKotlin'.
> Compilation error. See log for more details

Shippable CI reports the above error. Please take a look when you've time.

@revmischa
Copy link
Contributor Author

Imports fixed. Not sure what's with the CircleCI error, looks like a transient issue to me

@wing328 wing328 added this to the 5.0.0 milestone Aug 20, 2020
@wing328 wing328 changed the title Kotlin binary response [Kotlin]] add support for binary response Aug 20, 2020
@wing328
Copy link
Member

wing328 commented Aug 20, 2020

All tests passed. If no further feedback on this PR, I'll merge it over the weekend.

@revmischa
Copy link
Contributor Author

I think my solution is not a very good solution. We shouldn't write out tempfiles IMO, we should pass the InputStream handle back to the caller. I was hoping to start some discussion on how to achieve that because I couldn't figure out how to change the type mapping only for the response.
I think the response type should be InputStream or something similar, but want to leave the request type as File because it already has support for transmitting files. It wasn't clear to me how to change the type mapping for the response while leaving the request type mapping as File.

@wing328
Copy link
Member

wing328 commented Aug 20, 2020

I think the response type should be InputStream or something similar, but want to leave the request type as File because it already has support for transmitting files. It wasn't clear to me how to change the type mapping for the response while leaving the request type mapping as File.

What about using InputStream for both response and request ? In other words, we'll change the type mapping to map binary (format) to InputStream.

I'll put the merge on hold.

@revmischa
Copy link
Contributor Author

@wing328
Copy link
Member

wing328 commented Aug 20, 2020

Upcoming version v5.0.0 is a major release and it's ok to include breaking changes without fallbacks.

@wing328 wing328 modified the milestones: 5.0.0, 5.0.1 Dec 21, 2020
@wing328 wing328 modified the milestones: 5.0.1, 5.1.0 Feb 8, 2021
@wing328 wing328 removed this from the 5.1.0 milestone Mar 19, 2021
@wing328 wing328 added this to the 5.1.1 milestone Apr 1, 2021
@wing328
Copy link
Member

wing328 commented Apr 17, 2021

Closed via #9284

@wing328 wing328 closed this Apr 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants