Skip to content

Simple examples not working #26

@Stefanqn

Description

@Stefanqn
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"
  )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions