Questions tagged [protocol-buffers]

For questions about Google's protocol buffers

Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages.

https://developers.google.com/protocol-buffers

7638 questions
36
votes
4 answers

Any experiences with Protocol Buffers?

I was just looking through some information about Google's protocol buffers data interchange format. Has anyone played around with the code or even created a project around it? I'm currently using XML in a Python project for structured content…
saint_groceon
  • 6,167
  • 5
  • 32
  • 26
35
votes
6 answers

Protocol Buffer imports not recognized in Intellij

I am attempting to import one protocol buffer message into another, but the imports are not recognized. As long as I don't try to import one protobuf into another, the protobuf code is generated (in java), the code compiles and runs as expected. I'm…
L. Blanc
  • 2,150
  • 2
  • 21
  • 31
35
votes
1 answer

Making a small change to a Java protocol buffers object

I want to make a small change, deep in tree of Java protocol buffer objects. I can use the .getBuilder() method to make a new object that is a clone of an old one with some changes. When this is done at a deep level, the code becomes…
fadedbee
  • 42,671
  • 44
  • 178
  • 308
34
votes
1 answer

how do has_field() methods relate to default values in protobuf?

I'm trying to determine the relationship between default values and the has_foo() methods that are declared in various programmatic interfaces. In particular, I'm trying to determine under what circumstances (if any) you can "tell the difference"…
Edward Loper
  • 15,374
  • 7
  • 43
  • 52
34
votes
4 answers

Is "google/protobuf/struct.proto" the best way to send dynamic JSON over GRPC?

I have a written a simple GRPC server and a client to call the server (both in Go). Please tell me if using golang/protobuf/struct is the best way to send a dynamic JSON with GRPC. In the example below, earlier I was creating Details as a…
Anuj Gupta
  • 341
  • 1
  • 3
  • 6
34
votes
2 answers

How fast or lightweight Is Protocol Buffer?

Is Protocol Buffer for .NET gonna be lightweight/faster than Remoting(the SerializationFormat.Binary)? Will there be a first class support for it in language/framework terms? i.e. is it handled transparently like with Remoting/WebServices?
Hao
  • 8,047
  • 18
  • 63
  • 92
34
votes
2 answers

gRPC + Image Upload

I want to create a simple gRPC endpoint which the user can upload his/her picture. The protocol buffer declaration is the following: message UploadImageRequest { AuthToken auth = 1; // An enum with either JPG or PNG FileType image_format…
Nate Lee
  • 2,842
  • 1
  • 24
  • 30
34
votes
9 answers

No module named google.protobuf

I am trying to run Google's deep dream. For some odd reason I keep getting ImportError: No module named google.protobuf after trying to import protobuf. I have installed protobuf using sudo install protobuf. I am running python 2.7 OSX Yosemite…
lecorbu
  • 343
  • 1
  • 3
  • 7
34
votes
2 answers

Extending Protobuf Messages

I have many different schemas, however there are a set of fields which every schema contains. I was wondering if there was a way to have a different schema extend a parent schema and inherit its fields. For example this is what I want: message…
user1413793
  • 9,057
  • 7
  • 30
  • 42
33
votes
2 answers

Why do the Go-generated protobuf files contain mutex locks?

While working and generating protobuf stubs in go I stumbled upon this interesting issue. Whenever I try and copy a message's struct by value I get this warning: call of state.world.script.HandleEvent copies lock value:…
Nitzan
  • 1,669
  • 3
  • 19
  • 33
33
votes
3 answers

Where to store proto files which are shared among projects?

I have project A and project B. They may be in different programming languages. Project A exposes an API using proto files, which project B will use to then generate the API in the programming language which project B uses. But where are the proto…
stwykd
  • 2,684
  • 3
  • 19
  • 20
33
votes
2 answers

How do I share Protocol Buffer .proto files between multiple repositories

We are considering using Protocol Buffers for communicating between a python & a node.js service that each live in their own repos. Since the .proto files must be accessible to both repos, how should we share the .proto files? We are currently…
Swaraj
  • 1,235
  • 1
  • 13
  • 22
33
votes
3 answers

Can protobuf service method return primitive type?

I'm trying to use Google protobuf and i 'm having the next descriptions: message.proto file: message Request { required int32 id = 1; optional string value = 2; } service.proto file: import "message.proto"; service Service { rpc request…
4ntoine
  • 19,816
  • 21
  • 96
  • 220
33
votes
1 answer

Difference between Microsoft's Bond and Google's Protocol Buffers

Recently (January 2015) Microsoft open-sourced Bond, their framework for working with schematized data. In many aspects it is similar to Google's Protocol Buffers. What are the biggest differences between the two? What are pros and cons, that is, in…
dtldarek
  • 949
  • 1
  • 13
  • 17
31
votes
1 answer

Dynamically access oneof value from a protobuf

Let's say I defined a protobuf message like this message Config { oneof config{ A a = 1; B b = 2; } } now inside python code, when I am parsing a message instance of Config, I can get the one of field name with field =…
ustcyue
  • 601
  • 1
  • 7
  • 15