Simple example:
object TestMessages {
case class InnerMessage(id: Int, name: String)
}
import TestMessages._
case class NestedInnerMessage(id: Int, inner: InnerMessage)
Writing this message works correctly:
"write a message with inner nested type to Protobuf" in {
import TestMessages._
val nested = NestedInnerMessage(0, InnerMessage(1, "Hi"))
nested.toPB shouldBe Array[Byte](8, 0, 18, 6, 8, 1, 18, 2, 72, 105)
}
However, reading gives a compiler error:
"read a message with inner nested type to Protobuf" in {
import TestMessages._
val bytes = Array[Byte](8, 0, 18, 6, 8, 1, 18, 2, 72, 105)
bytes.pbTo[NestedInnerMessage] shouldBe NestedInnerMessage(0, InnerMessage(1, "Hi"))
}
error: could not find implicit value for parameter reader: pbdirect.PBParser[pbdirect.NestedInnerMessage]
Simple example:
Writing this message works correctly:
However, reading gives a compiler error: