How to mark rpc as deprecated

TL;DR: It’s possible, but it does not generate a compiler warning. Consider to use field-level deprecation. It looks like it’s possible to add a deprecated option to a service, just like on a message and enum like: service MyService { rpc GetThings(GetThingsRequest) returns (GetThingsResponse) { option deprecated = true; }; } Found this in: https://github.com/google/protobuf/issues/1734 … Read more

protoc: command not found (Linux)

Install protoc for Linux and Mac Linux PROTOC_ZIP=protoc-3.15.8-linux-x86_64.zip curl -OL https://github.com/google/protobuf/releases/download/v3.15.8/$PROTOC_ZIP sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc sudo unzip -o $PROTOC_ZIP -d /usr/local include/* rm -f $PROTOC_ZIP Mac OS X brew install protobuf Alternately, if you don’t have Homebrew. PROTOC_ZIP=protoc-3.15.8-osx-x86_64.zip curl -OL https://github.com/google/protobuf/releases/download/v3.15.8/$PROTOC_ZIP sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc sudo unzip -o $PROTOC_ZIP … Read more

Is there ever a good time to use int32 instead of sint32 in Google Protocol Buffers?

I’m not familiar with Google Protocol Buffers, but my interpretation of the documentation is: use uint32 if the value cannot be negative use sint32 if the value is pretty much as likely to be negative as not (for some fuzzy definition of “as likely to be”) use int32 if the value could be negative, but … Read more

Protobuf3: How to describe map of repeated string?

I had the same need, and got the same error. I do not believe this is possible. Here is the relevant BNF definitions from the language specification. https://developers.google.com/protocol-buffers/docs/reference/proto3-spec messageType = [ “.” ] { ident “.” } messageName mapField = “map” “<” keyType “,” type “>” mapName “=” fieldNumber [ “[“fieldOptions “]” ] “;” type … Read more

google protobuf maximum size

10MB is pushing it but you’ll probably be OK. Protobuf has a hard limit of 2GB, because many implementations use 32-bit signed arithmetic. For security reasons, many implementations (especially the Google-provided ones) impose a size limit of 64MB by default, although you can increase this limit manually if you need to. The implementation will not … Read more

Correct format of protoc go_package?

For pure proto generations you can do the following protoc –go_out=paths=source_relative:./gen -I. authenticator.proto or to generate for grpc the following can be used protoc –go_out=plugins=grpc:./gen –go_opt=paths=source_relative authenticator.proto If that fails you likely have a newer version of protoc and need to use the following command instead. protoc –go-grpc_out=./gen –go-grpc_opt=paths=source_relative authenticator.proto This is just Google making … Read more

Google Protocol Buffers – Storing messages into file

I would recommend using the writeDelimitedTo(OutputStream) and parseDelimitedFrom(InputStream) methods on Message objects. writeDelimitedTo writes the length of the message before the message itself; parseDelimitedFrom then uses that length to read only one message and no farther. This allows multiple messages to be written to a single OutputStream to then be parsed separately. For more information, … Read more