Related to Google Protocol Buffers, borrows its name from the .proto file extension containing a protocol schema.
Questions tagged [proto]
564 questions
3
votes
1 answer
Indent a Proto file in Visual Studio
Is there a way to auto indent Proto file code in Visual Studio.
For example, C# code can be indented but proto file isnt getting indented in visual studio 2019. Thanks

Gauravsa
- 6,330
- 2
- 21
- 30
3
votes
1 answer
What is the relationship between proto package and actual directory structure
I have read official docs & tutorial online about protobuf but I still don't quite understand the relationship between the package name & import path in proto definition and actual directory structure.
To make my question clear, let's say this is my…

torez233
- 193
- 8
3
votes
1 answer
How does protobuf field ordering affect on-the-wire size?
I couldn't find super clear info on this in the docs or online (feel free to point me in the right direction though), but does the ordering of fields in a protobuf message (using syntax = proto3) affect the resulting on-the-wire size? For example,…

akshayc
- 444
- 2
- 9
3
votes
2 answers
Python write list of dicts to protobuf
I am pretty new to protobuf and all of this, but I am trying to take a list of dictionaries and write them to a service using RPC/protobuf. Here is the proto:
syntax = "proto3";
package twittercontent.v1;
message TwitterContentRequest {
string…

DBA108642
- 1,995
- 1
- 18
- 55
3
votes
0 answers
Custom URL Parameter in gRPC-Gateway Transcoding
for example, I have this kind of proto definition:
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {
option (google.api.http) = {
get: "/hello"
};
}
}
message HelloRequest {
repeated int32 ids = 1;
…

dkiswanto
- 192
- 1
- 2
- 12
3
votes
1 answer
How to convert PHP Protobuf Object to a JSON string
I want to convert my Protobuf object to a JSON object using PHP so that I can send it back to the browser.
My Protobuf is
syntax = "proto3";
package Protobuf.Gen.ProposalTotalModel;
option php_generic_services = true;
message ProposalTotal {
…

srth12
- 873
- 9
- 16
3
votes
3 answers
Storing data in Protobuf (vs JSON)?
I've seen many articles about "Protobuf vs JSON". But none of them ever mentioned the data-storing aspect. AFAIK, one can store data in JSON (or XML). But can the same thing be done in Protobuf?
If it cannot be done, how can I store data? Is…

Mydrive1997
- 49
- 1
- 6
3
votes
0 answers
How to resolve proto error 'syntax = "proto2";' or 'syntax = "proto3" when using PHP?
I am trying my first protobuf program using PHP but without success
Following is the file which I created
listing.proto
syntax = "proto3";
package foo.bar;
message Listing {
string ProgramName = 1;
string EpisodeName = 2;
int32…

Sathish Kumar
- 2,150
- 10
- 29
- 51
3
votes
0 answers
Generic gRPC Java Client - existing implementation
I'm searching for a way to implement generic gRPC client in java which would allow to execute calls providing .proto definition (or at least relying on generated grpc classes), service and method names as parameters.
Probably you could advice if…

Suneli
- 31
- 4
3
votes
2 answers
GRPC Repeated field does not transcode to an array as body parameter in REST API
I´m having little luck trying to send a PUT request with JSON containing an array of objects to my GRPC Server using REST. Using GRPC however it accepts an array just like expected. This is what I have defined in my proto file:
message UpdateRequest…

pettert
- 31
- 4
3
votes
1 answer
Range over elements of a protobuf array in Go
I have a Protobuf structure defined as so in my .proto file:
message Msg{
message SubMsg {
string SubVariable1 = 1;
int32 SubVariable2 = 2;
...
}
string Variable1 = 1;
repeated SubMsg Variable2 = 2;
...
}
I pull data into this…

Michael Pyle
- 65
- 2
- 10
3
votes
1 answer
Why I am getting `Proto class is is already defined in file`?
The first proto file(main.proto) in offline directory
option java_package = "com.xxx.proto";
option java_outer_classname = "Service1";
option java_multiple_files = true;
message Response {
repeated Entity entity = 1;
}
message Entity {}
and…

I.S
- 1,904
- 2
- 25
- 48
3
votes
3 answers
How to convert google.protobuf.Struct field in java.util.Map?
I have a message defined quotation_item.proto file which has google.protobuf.Struct field to parse metadata JSON.
message QuotationItemEntry {
// Other fields
google.protobuf.Struct metadata = 15;
}
Also metadata field is defined in Java…

jaymil
- 31
- 1
- 2
3
votes
0 answers
protobuf: detailed error message when using JsonStringToMessage
I want to know if it is possible to get a more detailed error message when converting a JSON string to a protobuf.
For example, if field foobar in the JSON is not defined in protobuf, I want the error_message() to tell me that "field foobar is not…

sxy390
- 31
- 1
3
votes
1 answer
How correctly import protobuf's files?
Inside city.proto file I want to use (import) protobuf's .proto files. In my golang application I use go modules.
city.proto:
syntax = "proto3";
package proto;
import "google/protobuf/timestamp.proto";
option go_package = "./proto";
message City…

Nurzhan Nogerbek
- 4,806
- 16
- 87
- 193