gen-grpc-gateway, gen-openapiv2: add support for proto3 optional by adambabik · Pull Request #1951 · grpc-ecosystem/grpc-gateway (original) (raw)

Fixes #1278.

Even though, the main piece of code was added in google.golang.org/protobuf/compiler/protogen package, each plugin needs to explicitly enable support for proto3 optional fields. This change does exactly that. Note that gen-openapiv2 still does not fully benefit from protogen, hence, there are two helper methods enabling the feature in two different ways.

Also, this change does not treat optional fields in any different way in neither gen-grpc-gateway, nor gen-openapiv2 which actually might be required to deliver a valid experience.