Tag Archives: protobuf

Nullable fields in json generated from protobuf file

Null for nil value my.proto

go mapper

Which will lead to this json response

Omit a field with nil value If you want to omit the field completely, you can use oneof approach proto

go mapper

More info on json options for grpc — https://blog.bullgare.com/2020/07/complete-list-of-swagger-options-to-protobuf-file/

Complete list of swagger options to protobuf file

Here is an example with many options that help generate proper swagger out of protofile. Original URL — https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/examples/internal/proto/examplepb/a_bit_of_everything.proto.

Installing protobuf tools on MacOS

Installing protoc

Or follow different instructions. Installing grpc_cli Option 1. Easy way.

It is described here — https://github.com/grpc/homebrew-grpc. Option 2. Hard way — using cmake and make. NOT RECOMMENDED.

Or follow these instructions