From e6a17e7db48dac31383aa5edb384a240d3adde06 Mon Sep 17 00:00:00 2001 From: Quarke Date: Tue, 19 Aug 2025 11:29:03 -0400 Subject: [PATCH 1/2] Enable support for Editions in protoc-gen-grpc-web. protoc-gen-js now supports Editions. Enable support here by exposing supported version information to protoc too. --- javascript/net/grpc/web/generator/grpc_generator.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/javascript/net/grpc/web/generator/grpc_generator.cc b/javascript/net/grpc/web/generator/grpc_generator.cc index d7dac70f3..e05ce0ecb 100644 --- a/javascript/net/grpc/web/generator/grpc_generator.cc +++ b/javascript/net/grpc/web/generator/grpc_generator.cc @@ -30,6 +30,7 @@ #include using google::protobuf::Descriptor; +using google::protobuf::Edition; using google::protobuf::EnumDescriptor; using google::protobuf::FieldDescriptor; using google::protobuf::FileDescriptor; @@ -1522,9 +1523,12 @@ class GrpcCodeGenerator : public CodeGenerator { uint64_t GetSupportedFeatures() const override { // Code generators must explicitly support proto3 optional. - return CodeGenerator::FEATURE_PROTO3_OPTIONAL; + return CodeGenerator::FEATURE_PROTO3_OPTIONAL | CodeGenerator::FEATURE_SUPPORTS_EDITIONS; } + Edition GetMinimumEdition() const override { return Edition::EDITION_PROTO2; } + Edition GetMaximumEdition() const override { return Edition::EDITION_2023; } + bool Generate(const FileDescriptor* file, const string& parameter, GeneratorContext* context, string* error) const override { GeneratorOptions generator_options; From f9c4e3aadef76e238341b7eccd144acb0daa3adf Mon Sep 17 00:00:00 2001 From: Quarke Date: Tue, 19 Aug 2025 20:13:50 -0400 Subject: [PATCH 2/2] Update grpc_generator.cc with comment linking edition support to protoc-gen-js --- javascript/net/grpc/web/generator/grpc_generator.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/javascript/net/grpc/web/generator/grpc_generator.cc b/javascript/net/grpc/web/generator/grpc_generator.cc index e05ce0ecb..1fe4c0d63 100644 --- a/javascript/net/grpc/web/generator/grpc_generator.cc +++ b/javascript/net/grpc/web/generator/grpc_generator.cc @@ -1526,6 +1526,7 @@ class GrpcCodeGenerator : public CodeGenerator { return CodeGenerator::FEATURE_PROTO3_OPTIONAL | CodeGenerator::FEATURE_SUPPORTS_EDITIONS; } + // Keep synced with protoc-gen-js: https://github.com/protocolbuffers/protobuf-javascript/blob/861c8020a5c0cba9b7cdf915dffde96a4421a1f4/generator/js_generator.h#L157-L158 Edition GetMinimumEdition() const override { return Edition::EDITION_PROTO2; } Edition GetMaximumEdition() const override { return Edition::EDITION_2023; }