diff --git a/protoc-gen-grpc-gateway/main.go b/protoc-gen-grpc-gateway/main.go index b838d50fbe7..5c36ee54c46 100644 --- a/protoc-gen-grpc-gateway/main.go +++ b/protoc-gen-grpc-gateway/main.go @@ -18,6 +18,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/internal/gengateway" "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/types/pluginpb" ) var ( @@ -54,6 +55,7 @@ func main() { protogen.Options{ ParamFunc: flag.CommandLine.Set, }.Run(func(gen *protogen.Plugin) error { + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) reg := descriptor.NewRegistry() err := applyFlags(reg) diff --git a/protoc-gen-openapiv2/main.go b/protoc-gen-openapiv2/main.go index ebcae17d004..af4367d7aae 100644 --- a/protoc-gen-openapiv2/main.go +++ b/protoc-gen-openapiv2/main.go @@ -146,7 +146,10 @@ func emitFiles(out []*descriptor.ResponseFile) { for idx, item := range out { files[idx] = item.CodeGeneratorResponse_File } - emitResp(&pluginpb.CodeGeneratorResponse{File: files}) + emitResp(&pluginpb.CodeGeneratorResponse{ + SupportedFeatures: uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL), + File: files, + }) } func emitError(err error) {