Re: [protobuf] Guid conventions
I haven't had to store a GUID/UUID in a proto before but it seems like string or bytes would be the best choice. You would definitely want to use bytes (not string) if you're using the binary representation, since string fields are for UTF-8 only. We could consider eventually creating a well-known type but I'm not sure how much demand there is for one. On Wed, Dec 6, 2017 at 11:46 AM, Marc Gravellwrote: > A question on Stack Overflow earlier (https://stackoverflow.com/ > questions/47674930/google-protobuf-proto-file-query/4767629) reminded me > that I'm not fully "up" on the conventions for using guids in protobuf. > > There's no primitive / keyword for them, and AFAIK no "well known type". > So : how do folks tend to handle guids? Strings? Bytes? *Should* there be a > stronger guid story? Or is this just a non-issue? > > Thoughts? > > Marc > > -- > 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] ParseFromArray always returning true
On Wed, Dec 6, 2017 at 4:39 PM, 'Allen Vicencio' via Protocol Buffers < protobuf@googlegroups.com> wrote: > If all my fields in a protobuf are `optional`, will ParseFromArray ever > return false? I am doing some tests right now, and I am testing two > scenarios: > > >> Person > > optional string name; > > > Vehicle > > optional int64 wheels; > > > 1. Empty buffer is passed into Person#ParseFromArray. Returns true. > 2. Instance of Person is serialized into a buffer. Buffer is passed into > Vehicle#ParseFromArray. Returns true. > > Is this expected behavior? > Unless you have required fields, protobuf parsing will always return true as long as the input data is valid proto wire format. > -- > 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] Validate .proto file in Java
I guess this might help, I found this class https://github.com/square/wire/blob/master/wire-schema/src/main/java/com/squareup/wire/schema/internal/parser/ProtoParser.java which looks like something I could use though. I will give it a shot and let you know. Thanks a lot for the tip! On 6 December 2017 at 21:39, Marc Gravellwrote: > Apparently https://github.com/square/wire/ includes a runtime .proto > parser for Java. That might help? It isn't the official one, note. > > On 6 Dec 2017 8:28 p.m., "Omar Al-Safi" wrote: > >> Hello folks, >> >> I stubbled upon a requirements that I receive a textual representation of >> a proto file from an external service and then I need to save it. I want >> first to check if the text is a valid protobuf schema representation, is >> there way a to validate the syntax of a proto file during the runtime? I >> know that I can use the protoc compiler to validate a file and produce the >> compiled schema but my intention here just only to* validate the syntax* >> of the textual representation of a text if is a valid proto schema syntax. >> >> -- >> 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.