prost
prost copied to clipboard
Prefix idents that don't start with an alphabetic character
Hi @LegNeato do you know of any precedent on how other protobuf implementations handle this?
I do not, I can look into it though. I think if the find & replace infra was a bit more robust this wouldn't be necessary. I'll look into a larger patch as well as what other impls do
Ok, I looked into how protoc handles this. It is a mess! Every language does different things and there is a bunch of undocumented behavior.
This is a problem because prost strips enum prefixes, which turns a valid identifier field name to an invalid identifier. But, similar issues can arise with rust restricted keywords (there are a ton of protoc issues where people have valid idents in one language that are reserved in another, chaos ensues).
Please also add a test to fn test_ident_conversions/ident_conversion.proto's StrawberryRhubarbPIE
I plan to get to this in the next couple of days, thanks @danburkert for the review!
@danburkert Sorry this took so long, thank you again for the review.
@LegNeato seems need to fix the rustfmt ci stage
@LucioFranco whoops, done.
This has recently been fixed by https://github.com/tokio-rs/prost/pull/998