Skip to content

Commit c486e40

Browse files
authored
Enable support for Editions in protoc-gen-grpc-web. (#1490)
* 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. * Update grpc_generator.cc with comment linking edition support to protoc-gen-js
1 parent 41c8d58 commit c486e40

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

javascript/net/grpc/web/generator/grpc_generator.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <string>
3131

3232
using google::protobuf::Descriptor;
33+
using google::protobuf::Edition;
3334
using google::protobuf::EnumDescriptor;
3435
using google::protobuf::FieldDescriptor;
3536
using google::protobuf::FileDescriptor;
@@ -1522,9 +1523,13 @@ class GrpcCodeGenerator : public CodeGenerator {
15221523

15231524
uint64_t GetSupportedFeatures() const override {
15241525
// Code generators must explicitly support proto3 optional.
1525-
return CodeGenerator::FEATURE_PROTO3_OPTIONAL;
1526+
return CodeGenerator::FEATURE_PROTO3_OPTIONAL | CodeGenerator::FEATURE_SUPPORTS_EDITIONS;
15261527
}
15271528

1529+
// Keep synced with protoc-gen-js: https://github.com/protocolbuffers/protobuf-javascript/blob/861c8020a5c0cba9b7cdf915dffde96a4421a1f4/generator/js_generator.h#L157-L158
1530+
Edition GetMinimumEdition() const override { return Edition::EDITION_PROTO2; }
1531+
Edition GetMaximumEdition() const override { return Edition::EDITION_2023; }
1532+
15281533
bool Generate(const FileDescriptor* file, const string& parameter,
15291534
GeneratorContext* context, string* error) const override {
15301535
GeneratorOptions generator_options;

0 commit comments

Comments
 (0)