Re: [protobuf] Forcing JSON encoding to include default values (Java?)
Where is JsonFormat defined? No reference to how to print JSON from Java in the docs. Nothing in the API index. On Sunday, November 1, 2015 at 2:46:16 PM UTC-5, Feng Xiao wrote: > > > > On Sun, Nov 1, 2015 at 12:32 AM, Marco> wrote: > >> The documentation mentions "An implementation may provide options to emit >> fields with default values in the JSON-encoded output." >> >> I assumed that meant an implementation of Printer class, ie. an >> alternative to JsonFormat.printer().print(myMessage), but it appears >> that any implementation would depend on GeneratedMessage::getAllFields() >> which does not include default fields (GeneratedMessage:2123). I also >> read through descriptor.proto to see if there was an option for this, but >> that did not appear to be the case. >> >> Is there a way to do this out of the box, or would it require code >> changes? And would this be different for other languages? (This is using >> proto3, if that's not implied by the above.) >> > The option is not added yet. It will be something like: > JsonFormat.printer().printingDefaultValueFields().print(myMessage); > > Likely it will be included in the next beta release. > >> -- >> 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+u...@googlegroups.com . >> To post to this group, send email to prot...@googlegroups.com >> . >> Visit this group at http://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] Timestamps
The Proto3 docs reference a "Timestamp" type in JSON Mappings https://developers.google.com/protocol-buffers/docs/proto3#json But no other reference is made to this. Are timestamps supported as a first class type in Version 3? -- 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] When will protobuf v3.0.0 support node.js?
Any idea when protobuf v3.0.0 will have node.js code generation? -- 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 http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
[protobuf] PIP install broken on 2.6.0 (out of date python-dateutil 1.5 dependency)
PIP install fails since 2.6.0 (released 8/25/14) pip install protobuf Traceback (most recent call last): File string, line 17, in module File /Users/burdon/projects/src/alienlaboratories/core/tools/python/build/protobuf/setup.py , line 199, in module ... pkg_resources.VersionConflict: (python-dateutil 2.2 (/Users/burdon/projects/ src/alienlaboratories/core/tools/python/lib/python2.7/site-packages), Requirement.parse('python-dateutil=1.4,2')) But the default public index for python-dateutil is 2.2 (https://pypi.python.org/pypi/python-dateutil) The workaround is to downgrade to 1.5 (pip install -U python-dateutil==1.5) But this wasn't necessary for 2.5.0 -- 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 http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
Re: [protobuf] decode messages that are in protocol buffer format
I would highly recommend looking at this: http://code.google.com/p/protobuf-wireshark/ Might get you want you need. -Aaron On Tue, Oct 18, 2011 at 11:02 AM, Marc Gravell marc.grav...@gmail.com wrote: Well, firstly protobuf is not a text format, so UTF-8 is not the way to start. What is it you need? Note that the protobuf format is ambiguous unless you already know the schema (the same data can be interpreted in different ways). However, if you read the encoding spec, you should be able to guess many cases. Marc On 18 Oct 2011, at 11:03, newbie choudhury.ana...@gmail.com wrote: Hi, I am developing a sniffer that will sniff messages moving between a message broker and DWH. The messages are written in protocol buffers serialization format. So the message body that I sniff is a byte string. How do I decode this message to human readable format? The sniffer is developed in c# .net . I tried using System.Text.Encoding.UTF8.GetString(body) , but extra character gets added maybe because UTF8 doesn't identify this format. Thanks. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] adding submessages to higher message
New to protoco buffers so sorry if this is a simple/stupid question. I have a proto: message WrapperMessage { enum Type { PING = 1; PONG = 2; } message Header{ required Type type = 1; required string source = 2; required int64 time = 3; } required TIMIHeader header = 1; repeated Ping ping= 2; repeated Pong pong= 3; extensions 500 to max; } message Pong { optional int32 count =1; optional string message = 2; } message Ping { optional int32 count =1; optional string message = 2; } I need the wrapper so that I can send multiple other message types over a single udp datastream. I was going to make a message factory to generate the Ping and Pong messages: Pong* pong = myFactory-createPong(Hello); How can I add this Pong message now to a wrapper? I want to be able to use the factory so I can generate several Pong messages at once to pack together in a single WrapperMessage before sending. I only see that calling: WrapperMessage.add_pong() will give me a Pong* back. But then I either have to merge that will my factory message or pass it to factory to populate. Any suggestions of better way to do this (or improve my proto design)? Thanks. -Aaron -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: adding submessages to higher message
I found the method: AddAllocated(Element*) which I think will add the Pong* that I have already created/allocated myself. Any input if there is a better method then this to use would be appreciated. Thanks. -Aaron On Wed, Apr 20, 2011 at 4:25 PM, Aaron Rich aaron.r...@gmail.com wrote: New to protoco buffers so sorry if this is a simple/stupid question. I have a proto: message WrapperMessage { enum Type { PING = 1; PONG = 2; } message Header{ required Type type = 1; required string source = 2; required int64 time = 3; } required TIMIHeader header = 1; repeated Ping ping= 2; repeated Pong pong= 3; extensions 500 to max; } message Pong { optional int32 count =1; optional string message = 2; } message Ping { optional int32 count =1; optional string message = 2; } I need the wrapper so that I can send multiple other message types over a single udp datastream. I was going to make a message factory to generate the Ping and Pong messages: Pong* pong = myFactory-createPong(Hello); How can I add this Pong message now to a wrapper? I want to be able to use the factory so I can generate several Pong messages at once to pack together in a single WrapperMessage before sending. I only see that calling: WrapperMessage.add_pong() will give me a Pong* back. But then I either have to merge that will my factory message or pass it to factory to populate. Any suggestions of better way to do this (or improve my proto design)? Thanks. -Aaron -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] required field in extend
Newbie question: Can an extended message have a required field? For example, If I wanted to make any application using detailperson.proto's definition of a person have to have a middle name? person.proto: message person { required string first_name =1; required string last_name =2; extensions 100 to 199; } - detailedperson.proto: extend person { required string middle_name = 100; } Thanks. -Aaron -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Failing java tests
I can build and install from the latest version, but both the C and Java tests fail (on OS/X): make check mv: rename src/.deps/gtest.Tpo to src/.deps/gtest.Plo: No such file or directory make[3]: *** [src/gtest.lo] Error 1 mvn test Tests in error: testDynamicMessageAccessors(com.google.protobuf.DynamicMessageTest) testDynamicMessageExtensionAccessors(com.google.protobuf.DynamicMessageTest) testDynamicMessageRepeatedSetters(com.google.protobuf.DynamicMessageTest) testDynamicMessageDefaults(com.google.protobuf.DynamicMessageTest) testDynamicMessageSerialization(com.google.protobuf.DynamicMessageTest) testDynamicMessageParsing(com.google.protobuf.DynamicMessageTest) testDynamicMessagePackedParsing(com.google.protobuf.DynamicMessageTest) testDynamicMessageCopy(com.google.protobuf.DynamicMessageTest) testToBuilder(com.google.protobuf.DynamicMessageTest) testParseKnownAndUnknown(com.google.protobuf.UnknownFieldSetTest) Tests run: 252, Failures: 0, Errors: 10, Skipped: 0 -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] In python - How would I send and receive a PB in the POST payload of http request?
I'm fairly new to python and very new to protocol buffers. Any points in the right direction would be helpful. thx -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.