twitter / finatra

Fast, testable, Scala services built on TwitterServer and Finagle

Home Page:https://twitter.github.io/finatra/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

finatra-jackson: add sealed trait deserialization support

scf37 opened this issue · comments

commented

Support deserialization of sealed trait-style enum

Expected behavior

it works

Actual behavior

it deserializes incorrectly

Steps to reproduce the behavior

deserialize sealed trait

commented

That's what I'm using right now:
https://gist.github.com/scf37/4207c960a6932c7add9cb7f108a875ee

It could be great to have built-in support though.

@scf37 would you like to submit a PR to add? Thanks!

As mentioned in the documentation, we recommend users use Java enums and don't provide support out of the box for Scala sealed trait style enums but it is very simple to augment the configuration of the default Finatra object mapper to add a deserializer to do this (like the one posted: https://gist.github.com/scf37/4207c960a6932c7add9cb7f108a875ee). Closing this for now. Thanks!