From 73b6a9156d6dc4644c94f5a683219ba8aac9fb18 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Wed, 21 Feb 2024 13:49:06 -0800 Subject: [PATCH] Add optional feature in protobuf compiler Fixes error "is a proto3 file that contains optional fields, but code generator protoc-gen-go-ttrpc hasn't been updated to support optional fields in proto3. Please ask the owner of this code generator to support proto3 optional." Signed-off-by: Derek McGowan --- cmd/protoc-gen-go-ttrpc/main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/protoc-gen-go-ttrpc/main.go b/cmd/protoc-gen-go-ttrpc/main.go index 2282e809a..857b04018 100644 --- a/cmd/protoc-gen-go-ttrpc/main.go +++ b/cmd/protoc-gen-go-ttrpc/main.go @@ -18,6 +18,7 @@ package main import ( "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/types/pluginpb" ) func main() { @@ -30,6 +31,7 @@ func main() { return nil }, }.Run(func(gen *protogen.Plugin) error { + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) for _, f := range gen.Files { if !f.Generate { continue