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
Given this sum type with a type hint field, optionally embedded in a test class:
@JSONTypeHintField
sealed abstract class TypeHintEnum
case object Varialtion1 extends TypeHintEnum
case object Varialtion2 extends TypeHintEnum
object TypeHintEnum {
implicit val json: JSON[TypeHintEnum] = deriveJSON[TypeHintEnum]
}
case class Test5(name: String, @JSONEmbedded embedded: Option[TypeHintEnum])
object Test5 {
implicit val json: JSON[Test5] = jsonProduct(apply _)
}
The desieralisation of this json to the test class
"""{ "name": "ze name" }"""
Fails like this:
[info] - should support the absence of optional embedded type hinted attributes *** FAILED *** (24 milliseconds)
[info] io.sphere.json.JSONException: Missing type field 'type' in '{"name":"ze name"}'
[info] at io.sphere.json.package$.getFromJValue(package.scala:74)
[info] at io.sphere.json.package$.getFromJSON(package.scala:60)
[info] at io.sphere.json.package$.getFromJSON(package.scala:63)
Instead of setting the embedded field to None.
The text was updated successfully, but these errors were encountered:
Given this sum type with a type hint field, optionally embedded in a test class:
The desieralisation of this json to the test class
Fails like this:
Instead of setting the embedded field to
None
.The text was updated successfully, but these errors were encountered: