Re: [protobuf] Forcing JSON encoding to include default values (Java?)

2015-11-01 Thread 'Feng Xiao' via Protocol Buffers
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+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.
>

-- 
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] protoc-gen-go and internal/grpc

2015-11-01 Thread zellyn
Any particular reason the grpc plugin for protoc-gen-go is in an internal/ 
subdirectory? We import it because we want to include the grpc plugin along 
with our custom plugins, but with the move to go 1.5, the import will break.

I was considering adding a grpc or include_grpc package under 
protoc-gen-go/ that could be imported just to link the grpc plugin, but 
that seems silly: would it be reasonable to elide the /internal/ 
subdirectory?

Zellyn

-- 
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.