Skip to content

refactor: map binary params to io.Reader in Go client#47

Draft
dschmidt wants to merge 1 commit into
mainfrom
refactor/go-binary-io-reader
Draft

refactor: map binary params to io.Reader in Go client#47
dschmidt wants to merge 1 commit into
mainfrom
refactor/go-binary-io-reader

Conversation

@dschmidt
Copy link
Copy Markdown
Contributor

@dschmidt dschmidt commented May 14, 2026

Adds --type-mappings=binary=io.Reader,file=io.Reader,File=io.Reader to the Go generator invocation so binary request/response bodies (e.g. UpdateOwnUserPhotoPut, GetOwnUserPhoto) are emitted as io.Reader instead of *os.File.

*os.File satisfies io.Reader, so existing callers compile unchanged. The runtime setBody path in the generated client already prefers io.Reader over *os.File, so behavior is identical at the wire.

Note

Waiting on openapi-generator 7.23.0. The download path requires the *io.Reader branch added to the shared decode helper in OpenAPITools/openapi-generator#23789 (merged, scheduled for milestone 7.23.0, due 2026-05-28). Once the release lands, the generator_image pin in .woodpecker/build-go.yaml needs to bump from v7.13.0 to v7.23.0. Until then, GetOwnUserPhoto / GetUserPhoto would return "undefined response type" against the generated client. Upload paths (UpdateOwnUserPhotoPut / …Patch) already work via setBody's existing io.Reader branch.

@dschmidt dschmidt marked this pull request as ready for review May 14, 2026 09:01
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant