sphere-scala-libs
sphere-scala-libs copied to clipboard
Type hint field annotation on sealed trait enums
The @JSONTypeHintField and @MongoTypeHintField annotations are only respected on sealed traits when they are present on each variation of that type. For sealed abstract classes it is sufficient to only put the annotation on the base-class.
I created a test scenarios here: https://github.com/commercetools/sphere-scala-libs/commit/0ee1f85f4e3c8c464740b36461831012ef97d348
The tests "JSONTypeHintField must be respected when only defined on sealed trait base-class" and "JSONTypeHintField must be respected when only defined on abstract class base-class"
in json/json-derivation/src/test/scala/io/sphere/json/generic/JsonTypeHintFieldSpec.scala
Show this difference in behaviour.
This commit also contains a test for the Mongo codec in an embedded context mongo/mongo-derivation/src/test/scala/io/sphere/mongo/generic/MongoEmbeddedSpec.scala