pbdirect
pbdirect copied to clipboard
Nested object - java.util.NoSuchElementException: head of empty list
exception is thrown when:
case class A(b: B)
case class B(c: Option[C])
case class C(s1: String, s2: String)
val msg = A(B(Some(C("ds", "xd"))))
val bytes = msg.toPB
val parsed = bytes.pbTo[A]
If you change B to to case class B(c: C) it works.
If you change C to case class B(c: C) it works.
Am I doing something wrong or is it bug?
I believe you missed the following import cats.instances..option._ when you call msg.toPB ?
If you import cats.instances.option._ and then run your code it should be ok.