From cd2b8c094904cb696e4d094fbf59dd8c54c25437 Mon Sep 17 00:00:00 2001 From: Shane Loretz Date: Wed, 28 Oct 2026 20:48:10 +0000 Subject: [PATCH] protoc-gen-openapi: add Protobuf Editions support --- cmd/protoc-gen-openapi/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/protoc-gen-openapi/main.go b/cmd/protoc-gen-openapi/main.go index 75405aed..05b7fb05 100644 --- a/cmd/protoc-gen-openapi/main.go +++ b/cmd/protoc-gen-openapi/main.go @@ -22,6 +22,7 @@ import ( "github.com/google/gnostic/cmd/protoc-gen-openapi/generator" "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/pluginpb" ) @@ -46,7 +47,9 @@ func main() { opts.Run(func(plugin *protogen.Plugin) error { // Enable "optional" keyword in front of type (e.g. optional string label = 1;) - plugin.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) + plugin.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + plugin.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_PROTO2 + plugin.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2023 if *conf.OutputMode == "source_relative" { for _, file := range plugin.Files { if !file.Generate {