Questions tagged [scalapb]

ScalaPB is a protocol buffer compiler (protoc) plugin for Scala. It generates Scala case classes, parsers and serializers for protocol buffers.

Main features:

Built on top of Google’s protocol buffer compiler to ensure perfect compatibility with the language specification.

Nested updates are easy by using lenses:

val newOrder = order.update(_.creditCard.expirationYear := 2015)

Generated case classes can co-exist alongside the Java-generated code (the class names will not clash). This allows gradual transition from Java to Scala.

Can optionally generate conversion methods between the Java generated version of Protocol Buffers to the Scala generated version. This makes it possible to migrate your project gradually.

Supports for Oneof’s that were introduced in Protocol Buffers 2.6.0.

Learn more here: https://scalapb.github.io/index.html

Source code: https://github.com/scalapb/ScalaPB

104 questions
0
votes
1 answer

sbt-protoc error File does not reside within any path specified using --proto_path (or -I).You must specify a --proto_path which encompasses this file

I've scala grpc protobuf project with below build.sbt. ThisBuild / version := "0.1.0-SNAPSHOT" val openRtbCoreVersion = "1.5.5" val googleCommonProtosVersion = "1.12.0" val commonSettings: Seq[Def.Setting[_]] = Seq[Def.Setting[_]]( scalaVersion…
user51
  • 8,843
  • 21
  • 79
  • 158
0
votes
0 answers

Converting List[Map[String, Any]] to Option[com.google.protobuf.struct.Struct] using Scalapb

I am trying to convert List[Map[String, Any] to Option[com.google.protobuf.struct.Struct] using Scalapb: Proto: message IOTDecodeRequest { string id = 1; string user_id = 2; bytes raw_data = 3; } message DecodeResult { …
sonia
  • 29
  • 5
0
votes
0 answers

sbt scala pb "Protobufs files found, but PB.targets is empty."

I'm having project which converts proto files into scala case classes. My build.sbt is - ThisBuild / version := "0.1.0-SNAPSHOT" lazy val root = (project in file(".")) .settings( name := "proto-path-error" ) val openRtbCoreVersion =…
user51
  • 8,843
  • 21
  • 79
  • 158
0
votes
0 answers

Protobuf: strange transformation int64 to Long

The protobuf-file has the following declaration of method: message GetRequest { int64 client_id = 1; google.protobuf.StringValue name = 2; } It generate: final case class GetRequest( clientId: _root_.scala.Long = 0L, name:…
Jelly
  • 972
  • 1
  • 17
  • 40
0
votes
1 answer

ScalaPb sbt: Import "data/common/num.proto" was not found or had errors

My project structure is: logs - data - pubs - invent.proto - common - num.proto NOTE - The .proto files are not under src/main/protobuf. They're under a directory called logs directly under project In invent.proto, I have…
user10751899
  • 147
  • 1
  • 9
0
votes
1 answer

How to share .proto (protobuf) files using a shared scala library using sbt

I have a few apps using shared .proto files. Each app's repo currently contains a copy of the files, which is not ideal and has recently created a problem when they accidentally diverged. I would like to store the .proto files in a shared library…
ringo
  • 3
  • 1
0
votes
1 answer

GRPC - Separate proto serialization cpu stage from IO stage

We have a service which sends grpc requests under heavy load. Normally, grpc send is considered to be an IO stage, which means it should use an IO thread pool. We've noticed that the serialization time of the proto objects consumes rather a-lot of…
yaarix
  • 490
  • 7
  • 18
0
votes
1 answer

convert ByteArray to String to ByteArray

I want to convert ByteArray to string and then convert the string to ByteArray,But while converting values changed. someone help to solve this problem. person.proto: syntax = "proto3"; message Person{ string name = 1; int32 age = 2; …
0
votes
2 answers

How to generate any protobuf Enum as String with only one TypeMapper?

For instance, I have some enums in my proto schema: enum E1 { UNKNOWN = 0; OPTION_1 = 1; OPTION_2 = 2; OPTION_3 = 3; } enum E2 { UNKNOWN = 0; ANOTHER_OPTION_1 = 1; ANOTHER_OPTION_2 = 2; ANOTHER_OPTION_3 =…
Oleg
  • 899
  • 1
  • 8
  • 22
0
votes
2 answers

zio-grpc with Scala 3 (2nd try)

Does anyone have a bare-bones zio-grpc server, with codegen in the project also, working with Scala 3? I started with the HelloWorld project from their repo and attempted to get it to build with scalaVersion := "3.1.0" Here is the relevant section…
0
votes
0 answers

Synchronizing clients and server

I'm making a distributed sorting system, where each machine (client) has a specific range of values (partition) to store. I don't have any problem sending and receiving data, but the synchronization is my problem. Before retrieving the wanted…
Bassusour
  • 175
  • 6
  • 14
0
votes
2 answers

how to change the scalaPB default path of protobuf files?

I have a build.sbt for a couple of packages in the same project. When I do sbt compile, my protobuf files are under [packagename]/src/main/protobuf/*, so it won't scan these files since they have that additional package name in the path. How to…
baron
  • 149
  • 3
  • 11
0
votes
1 answer

Scala scalapb GeneratedMessageCompanion- do not conform to trait GeneratedMessageCompanion's

I am trying to generate Scala proto buff classes using Scalapb (https://scalapb.github.io/docs/scalapbc/). I am able to generate scala files but getting below error. type arguments [com.huawei.utility.protobuff.embedtoRedis.embedtoRedis] do not…
Satheesh
  • 121
  • 2
  • 6
0
votes
1 answer

ScalaPB: compilePlugin generate inappropriate class

I'm trying to use Protocol Buffers for generate Scala case classes. Base settings are: 1.In project/plugins.sbt: addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.0") libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" %…
Jelly
  • 972
  • 1
  • 17
  • 40
0
votes
1 answer

Using Scalapb with spark structured streaming and java generated protobuf classes

The project I'm working on is in the planning/prototyping phase and we would like to stream our data into spark 3 using protobuf encoded messages in Kafka and structured streaming. We've prototyped using spark streaming (vs structured streaming)…
Bruce Ritchie
  • 975
  • 9
  • 8