jooby icon indicating copy to clipboard operation
jooby copied to clipboard

Add type to MessageEncoder

Open MrRawbin opened this issue 5 months ago • 0 comments

The MessageDecoder interface provides a type parameter, which makes sense since it is impossible to know what to decode into otherwise.

The MessageEncoder, however, does not have the type param. The docs for message encoding assumes that the JSON library used knows how to handle the result, which is of type Object. This is true for gson and jackson, but when using kotlinx.serialization I get issues when trying to encode for example ArrayLists due to type erasure.

Would it be possible (and make sense) to add a type parameter to MessageEncoder?

MrRawbin avatar Jan 18 '24 12:01 MrRawbin