Groups
Groups
Sign in
Groups
Groups
Protocol Buffers
Conversations
About
Send feedback
Help
Using enum as extension id?
19 views
Skip to first unread message
crotty.ch...@gmail.com
unread,
May 7, 2013, 4:31:33 PM
5/7/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to prot...@googlegroups.com
Is it possible to define an extension and use an enum value as the extension id?
Say with the following files defined:
file: MessageType.proto:
enum MessageType {
MSG_TYPE_1 = 100;
MSG_TYPE_2 = 101;
}
file: AMessage.proto:
import "MessageType.proto";
message AMessage {
required MessageType type = 1;
extensions 100 to 200;
}
file: MessageType1.proto:
import "MessageType.proto";
import "AMessage.proto";
message MessageType1 {
extend AMessage {
required MessageType1 ext_type = 100; // here I would like to use MessageType.MSG_TYPE_1
}
}
Is it possible to use an enum definition in the extension definition? I keep getting an error from protoc saying it is expecting a field number.
Thanks,
Chris
Reply all
Reply to author
Forward
0 new messages