On Sun, Dec 25, 2016 at 11:34 PM, Alexandre Hamez <[email protected] > wrote:
> Hello, > > I'm currently writing an Elixir implementation of protobuf ( > https://github.com/ahamez/protox). > Rather than rolling out my own parser, I use protoc to output a > FileDescriptorSet, described in descriptor.proto. > It's very nice to not have to write a custom parser! > > There are two cases in descriptor.proto for the message > FieldDescriptorProto that I never encountered, even though they are > documented,. > Thus I wonder if these cases happen with old versions of protoc? Or maybe > it's possible to trigger them with very particular proto files? > > 1. https://github.com/google/protobuf/blob/master/src/ > google/protobuf/descriptor.proto#L166 > // If type_name is set, this need not be set. If both this and type_name > // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. > optional Type type = 5; > > -> I never encountered the case where only type_name is set. > > 2. https://github.com/google/protobuf/blob/master/src/ > google/protobuf/descriptor.proto#L170 > // For message and enum types, this is the name of the type. If the name > // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping > // rules are used to find the type (i.e. first the nested types within this > // message are searched, then within the parent, on up to the root > // namespace). > optional string type_name = 6; > > -> I never encountered a not fully qualified name. > > So, are these both cases relevant today or do I need to support these? > protoc will normalize the descriptors after parsing so it likely will never output non-fully qualified names (or set type_name only), however, I would still suggest handle all possible cases in case the behavior changes in future versions of protoc. > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
