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

golang protobuf remove omitempty tag from generated json tags

If you are using grpc-gateway and you need the default values to be present during json marshaling, you may consider to add the following option when creating your servemux gwmux := runtime.NewServeMux(runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{OrigName: true, EmitDefaults: true})) Outside of grpc-gateway, if you want to marshal your protocol buffer message, use google.golang.org/protobuf/encoding/protojson (*) package instead of encoding/json … Read more

Why are there no custom default values in proto3?

My understanding is that proto3 no longer allows you to detect field presence and no longer supports non-zero default values because this makes it easier to implement protobufs in terms of “plain old structs” in various languages, without the need to generate accessor methods. This is perceived as making Protobuf easier to use in those … Read more