pbdirect
pbdirect copied to clipboard
Simple examples not working
package example
import cats.instances.list._
import pbdirect._
object Hello extends App {
case class MyMessage( id: Option[Int], text: Option[String], numbers: List[Int])
val message = MyMessage( id = Some(123), text = Some("Hello"), numbers = List(1, 2, 3, 4))
println(List(message, message.copy(id = Some(999))).toPB.pbTo[List[MyMessage]]) //List(MyMessage(Some(123),Some(Hello),List(1, 2, 3, 4)))
println(List(1, 2, 3).toPB.pbTo[List[Int]])
/* Exception in thread "main" com.google.protobuf.InvalidProtocolBufferException:
While parsing a protocol message, the input ended unexpectedly in the middle of a field.
This could mean either that the input has been truncated or that an embedded message misreported its own length. */
}
with
sbt.version=1.2.6
and
lazy val root = (project in file(".")).
settings(
inThisBuild(List(
organization := "com.example",
scalaVersion := "2.12.7",
version := "0.1.0-SNAPSHOT"
)),
name := "pbdirectTest",
resolvers += Resolver.bintrayRepo("beyondthelines", "maven"),
libraryDependencies += "beyondthelines" %% "pbdirect" % "0.1.0"
)