refactor: map binary params to io.Reader in Go client#47
Draft
dschmidt wants to merge 1 commit into
Draft
Conversation
Override the openapi-generator Go default of *os.File for type: string + format: binary to io.Reader. *os.File still satisfies the interface, so existing callers compile unchanged.
5a1e7ac to
a61870f
Compare
This was referenced May 14, 2026
aa7f96f to
a61870f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
--type-mappings=binary=io.Reader,file=io.Reader,File=io.Readerto the Go generator invocation so binary request/response bodies (e.g.UpdateOwnUserPhotoPut,GetOwnUserPhoto) are emitted asio.Readerinstead of*os.File.*os.Filesatisfiesio.Reader, so existing callers compile unchanged. The runtimesetBodypath in the generated client already prefersio.Readerover*os.File, so behavior is identical at the wire.Note
Waiting on openapi-generator 7.23.0. The download path requires the
*io.Readerbranch added to the shareddecodehelper in OpenAPITools/openapi-generator#23789 (merged, scheduled for milestone 7.23.0, due 2026-05-28). Once the release lands, thegenerator_imagepin in.woodpecker/build-go.yamlneeds to bump fromv7.13.0tov7.23.0. Until then,GetOwnUserPhoto/GetUserPhotowould return"undefined response type"against the generated client. Upload paths (UpdateOwnUserPhotoPut/…Patch) already work viasetBody's existingio.Readerbranch.