You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please provide any additional information below.
Consider the following .proto file:
message OutterMsg {
message InnerMsg {}
optional InnerMsg inner_msg = 1;
}
Currently, produced code looks like this:
class OutterMsg {
class Types {
class InnerMsg {...}
}
Types.InnerMsg InnerMsg;
}
Which means that to declare a builder for InnerMsg, one needs to type:
OutterMsg.Types.InnerMsg msg;
That's rather long.
It's known that "Types" nested class is used to avoid clashing sub-message and
Property names.
Another way to avoid such problem is to prefix sub-message names. For instance,
a leading underscore char should suffice for 99% of the cases. Produced code
would look like the following:
class OutterMsg {
class _InnerMsg {...}
_InnerMsg InnerMsg;
}
Declaration would look like:
OutterMsg._InnerMsg msg;
A per-message (and perhaps a per-proto-file) option string
csharp_nesting_prefix should work just fine. Proto file would look like the
following:
message OutterMsg {
option (csharp_nesting_prefix) = "_";
message InnerMsg {}
optional InnerMsg inner_msg = 1;
}
Original issue reported on code.google.com by [email protected] on 21 Feb 2014 at 11:22
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 21 Feb 2014 at 11:22The text was updated successfully, but these errors were encountered: