vavr-io / vavr-jackson

Jackson datatype module for Vavr
Apache License 2.0
97 stars 35 forks source link

No serializer for Try<?> #181

Open qux42 opened 3 years ago

qux42 commented 3 years ago

Hello, I wonder why there is no serializer for Try<?>. We use vavr a lot in akka-messages, where we can have a Try<?> as an response. So far we are serializing everything with protobuf, but we are planning to change to Jackson. Is it possible, that a serializer for Try gets added?

hypr2771 commented 3 years ago

Here is my attempt to implement a Try serializer and deserializer (note that it also adds a mixin, due to the lack of good support of StackTraceElement): https://github.com/hypr2771/vavr-jackson/commit/dd701ef22813196dd224afc5a27496c7a3b0969b.

Note: I am a beginner using Jackson, so I wouldn't trust much what I did there (some copy and paste), but it seems to work in unit test and using it on my application.