Closed mobilemindtec closed 5 months ago
Seems like a bug in the Scala 3 macros, the Scala 2 equivalent seems to work
import upickle.implicits.key
case class Person(id: Int, name: String = "test")
implicit val personRw = upickle.default.macroRW[Person]
case class ApiResult[T](data: Option[T] = None, @key("total_count") totalCount: Int)
implicit def apiResultRw[T: upickle.default.ReadWriter] = upickle.default.macroRW[ApiResult[T]]
println(upickle.default.read[Person]("{\"id\":1}")) // OK
println(upickle.default.read[ApiResult[Person]]("{\"total_count\": 10}")) // Works
The problem appears to be that TypeTree.of[T].symbol
for ApiResult[T]
is val <none>
. Exactly why that is the case is unknown to me
@mobilemindtec This fix should have gone out in the latest version 3.1.4
Hello!
I'm getting a missing keys exception when key is a option generic field. Example:
Is there a way to get around this?