Re: [protobuf] extending field and message options
All fully-qualified symbols must be a unique for an invocation of protoc. In the generated code, you can refer to the generated extension (just like referring to generated messages, enums, and services), and if their fully-qualified names weren't unique, it would result in compilation errors in the generated code. *Josh Humphries* jh...@bluegosling.com On Mon, Mar 13, 2017 at 4:15 PM, Arpit Baldevawrote: > Hi, > > I have my proto file like following. > > package example; > > message ExFieldOptions > { > map meta_data = 1; > } > > extend google.protobuf.FieldOptions > { > ExFieldOptions exOptions = 4245; > } > > extend google.protobuf.MessageOptions > { > ExFieldOptions exOptions = 4245; > } > > When I run it through ProtoC (for C++ code generation), I run into an error > > "exOptions" is already defined in "example". > > Is this a bug? Or is it required that extension name need to be unique > across options? > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to protobuf+unsubscr...@googlegroups.com. > To post to this group, send email to protobuf@googlegroups.com. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
Re: [protobuf] extending field and message options
I believe this is to be expected, because these top-level extensions would end up having the same name. For example in C++ they would both be called example::exOptions and so there would be a conflict there. To get around this you can either give them different names or keep the same names but nest them inside of messages, like this: message MessageOptionsExtension { extend google.protobuf.MessageOptions { ExFieldOptions exOptions = 4245; } } On Mon, Mar 13, 2017 at 1:15 PM, Arpit Baldevawrote: > Hi, > > I have my proto file like following. > > package example; > > message ExFieldOptions > { > map meta_data = 1; > } > > extend google.protobuf.FieldOptions > { > ExFieldOptions exOptions = 4245; > } > > extend google.protobuf.MessageOptions > { > ExFieldOptions exOptions = 4245; > } > > When I run it through ProtoC (for C++ code generation), I run into an error > > "exOptions" is already defined in "example". > > Is this a bug? Or is it required that extension name need to be unique > across options? > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to protobuf+unsubscr...@googlegroups.com. > To post to this group, send email to protobuf@googlegroups.com. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
[protobuf] extending field and message options
Hi, I have my proto file like following. package example; message ExFieldOptions { mapmeta_data = 1; } extend google.protobuf.FieldOptions { ExFieldOptions exOptions = 4245; } extend google.protobuf.MessageOptions { ExFieldOptions exOptions = 4245; } When I run it through ProtoC (for C++ code generation), I run into an error "exOptions" is already defined in "example". Is this a bug? Or is it required that extension name need to be unique across options? Thanks. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.