je5real / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
Other
0 stars 0 forks source link

makePlural option #410

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Feature request: a makePlural option for protogen that makes the names of 
repeated fields plural.

Based on the way protoc generates C++ and Java code, it's pretty clear that 
.proto files are intended to use singular name for repeated fields. Since those 
languages don't have properties, singular names work well. For example, you 
have a repeated field "bunny" (I hear they're known for repeating), some of the 
Java methods are getBunnyList(), getBunny(int index), and getBunnyCount().

That's fine for the Java code, but using the singular name for repeated fields 
causes C# code readability to suffer. Even with the wonderful magic of fixCase, 
protogen creates a field named "Bunny" of type List<Bunny>. Normally, such a C# 
field would be named "Bunnies".

The makePlural option would fix this by making all repeated field names plural 
when it generates the C# code. A library like 
http://www.nuget.org/packages/Humanizer/ should make this easy.

Original issue reported on code.google.com by ednbeth on 9 Oct 2013 at 2:32