You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use dialogue to communicate with a service that serves arbitrary files. My application logic then parses the file contents. InputStream seems like the perfect type for the result of this call, and ConjureBodySerDe.binaryInputStreamDeserializer provides just that, so that's what I tried to use. However, the service I'm trying to talk to responds with different content type headers depending on the file that it's serving. However, the BinaryEncoding that this deserializer uses only works with application/octet-stream, so it may refuse to deserialize the response.
What did you want to happen?
Fundamentally, Encoding has a getContentType(), so the idea that an encoding is for a specific content type is baked into the design here. But, anything can be treated as an input stream, even if the content could also be interpreted as a more specific type. I would like it if BinaryEncoding could somehow support this, allowing deserialization of any response as an InputStream regardless of the reported content type. It seems easy enough to just have BinaryEncoding.supportsContentType() always return true, but again, there is no accurate answer to BinaryEncoding.getContentType(), so I don't know how that can be implemented. I think part of the issue here is that encodings seem to refer to both serialization and deserialization, but arbitrary binary serialization is not supported (BinaryEncoding.serializer() throws). That makes sense in my opinion, and it makes sense that serialization requires declaring a content type, but since serialization is not possible here, the need for a specific content type makes this encoding too rigid to be useful for my situation.
BLAB: How can the encoding system be refactored to allow turning anything into an input stream? At minimum, it seems like the system needs to be more flexible about there being exactly one content type.
The text was updated successfully, but these errors were encountered:
What happened?
I tried to use dialogue to communicate with a service that serves arbitrary files. My application logic then parses the file contents.
InputStream
seems like the perfect type for the result of this call, andConjureBodySerDe.binaryInputStreamDeserializer
provides just that, so that's what I tried to use. However, the service I'm trying to talk to responds with different content type headers depending on the file that it's serving. However, theBinaryEncoding
that this deserializer uses only works withapplication/octet-stream
, so it may refuse to deserialize the response.What did you want to happen?
Fundamentally,
Encoding
has agetContentType()
, so the idea that an encoding is for a specific content type is baked into the design here. But, anything can be treated as an input stream, even if the content could also be interpreted as a more specific type. I would like it ifBinaryEncoding
could somehow support this, allowing deserialization of any response as anInputStream
regardless of the reported content type. It seems easy enough to just haveBinaryEncoding.supportsContentType()
always returntrue
, but again, there is no accurate answer toBinaryEncoding.getContentType()
, so I don't know how that can be implemented. I think part of the issue here is that encodings seem to refer to both serialization and deserialization, but arbitrary binary serialization is not supported (BinaryEncoding.serializer()
throws). That makes sense in my opinion, and it makes sense that serialization requires declaring a content type, but since serialization is not possible here, the need for a specific content type makes this encoding too rigid to be useful for my situation.BLAB: How can the encoding system be refactored to allow turning anything into an input stream? At minimum, it seems like the system needs to be more flexible about there being exactly one content type.
The text was updated successfully, but these errors were encountered: