tokio-rs / prost

PROST! a Protocol Buffers implementation for the Rust Language
Apache License 2.0
3.87k stars 501 forks source link

Add support for editions #1031

Open ouillie opened 5 months ago

ouillie commented 5 months ago

Editions are the future of protobuf syntax.

Currently, when you set edition = "2023" at the top of a .proto file, and run it through prost-build using protoc_arg("--experimental_editions"), it will panic on this line because the value of FileDescriptorProto.syntax is "editions". That's pretty much the extent of my investigation. I just figured I'd file this bug since support for editions doesn't seem to be tracked elsewhere.

This may sound like it's adding complexity to Prost, but it looks like it should actually simplify Prost once Prototiller is released, since that will effectively normalize all the different syntaxes and editions into a canonical representation using features, and Prost will only have to support that canonical representation in the long term. It would be a somewhat heavy refactor up front, though.

caspermeijn commented 5 months ago

I agree, editions are important. However, due to backwards compatibility of protoc itself, we need to keep supporting proto2 and proto3 for some time.

Are you willing to do the work to add this support?

ouillie commented 5 months ago

That makes sense. I won't have bandwidth for a couple months, but I'm down to contribute, especially after Prototiller is released.