palantir / conjure-go

Conjure generator for Go
Apache License 2.0
7 stars 15 forks source link

Iterable Binary return type inconsistent with other binary types #194

Open AdamDeHovitz opened 3 years ago

AdamDeHovitz commented 3 years ago

Unlike with other return types, conjure-go special cases binary endpoints to use the ReadCloser stream type rather than the default []byte. Specifically, endpoints that return binary use ReadCloser while optional<binary> endpoints will return *ReadCloser after the resolution of https://github.com/palantir/conjure-go/issues/192. In contrast endpoints with either a set<binary> or list<binary> type use an unstreamable [][]byte go type. Ultimately this might be the right choice but we should compare the implementation against conjure-java, validate that this type works, and add unit/integration testing to guarantee this behavior.

AdamDeHovitz commented 3 years ago

I did some testing in java and found the following type conversions from conjure to java: binary -> BinaryResponseBody optional<binary> -> Optional<BinaryResponseBody> list<binary> -> List<ByteBuffer

gregakinman commented 3 years ago

@AdamDeHovitz List<ByteBuffer> doesn't look like streaming to me, so at first glance it looks like this is consistent with the Java implementation, but I'm not 100% sure