Open GoogleCodeExporter opened 9 years ago
This is also a problem if you have two enumerations with identical field names.
For instance:
public enum Foo
{
Default,
A,
B,
}
public enum Bar
{
Default,
X,
Y,
}
So it may be smart to represent these in a .proto as:
namespace Foo {
enum Enum {
Default = 0;
X = 1;
Y = 2;
}
}
namespace Bar {
enum Enum {
Default = 0;
X = 1;
Y = 2;
}
}
Original comment by david.boike@gmail.com
on 27 Sep 2012 at 4:41
Hi Marc,
Do you have any update on this issue? I ran into the same problem, and was
going to fix it with a parse and replace on all my .proto files, but this is
difficult because of the way the default fields are defined in places where the
enum is used. Here is an example:
message Source {
optional SourceType type = 8 [default = TypeA];
...
}
enum SourceType {
TypeA= 0;
TypeB= 1;
TypeC= 2;
TypeD= 3;
}
If I want to rename the enum values in SourceType to avoid name clashes, I also
have to search and replace for all default values in every message that
references this enum. This is not a trivial task (I am replacing these names
because they are being used all over the place in other messages / enums), is
it worth spending time on my own solution for this, or do you already have a
solution / plan to address this issue in the near future?
Thanks <3
Franchesca
Original comment by Franches...@gmail.com
on 15 Oct 2012 at 8:27
Original issue reported on code.google.com by
Gabriele.Giuseppini
on 24 Sep 2012 at 3:41