Skip to content

Add support for Protobuf Editions #327

Open
@vallahaye

Description

Last year the Protobuf compiler v0.27 was released, and with it came Protobuf Editions. It introduces a new feature flag system aimed at unifying proto2 and proto3 functionality and semantics.

Since then, both the Buf build system and Connect RPCs have successfully added support for it, suggesting that people could start migrating their Protobuf files.

The protoc-gen-go-aip code generator is currently incompatible with Editions and will return an error each time it is run against it:

plugin "go-aip" does not support feature "supports editions" which is required by "testdata.proto"

As far as I've been able to tell, protoc-gen-go-aip is agnostic of Editions, and adding support for it could be straightforward:

gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS)
gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_PROTO3
gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2023

This change would also add support for proto3 optional fields, which I believe the protoc-gen-go-aip code generator is also agnostic of.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions