Discussion:
[protobuf] Default value not accessible in proto3
love sidhu
2018-04-26 09:12:29 UTC
Permalink
Hi,

This is how my response message is defined in proto file.

message Response{
bool isOk = 1;
}


When I set this bool value in gRPC server to false, I'm not receiving it on
client side
but If I set this bool value to true I receive it on client side.

I read this link:
https://stackoverflow.com/questions/41089035/protobuf-default-values
and saw that default values are not sent on wire and in case of boolean
variables, False is default value. I don't know how true it is?


Is there some general proper way of how to handle this for all types of
variables(int32, bool etc.)

Thanks,
Lovepreet
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
'Feng Xiao' via Protocol Buffers
2018-04-26 20:29:51 UTC
Permalink
Post by love sidhu
Hi,
This is how my response message is defined in proto file.
message Response{
bool isOk = 1;
}
When I set this bool value in gRPC server to false, I'm not receiving it
on client side
If you receive an empty Response message, it means the value of the isOk
field is the default which is false. Why do you care to send it over the
wire?
Post by love sidhu
but If I set this bool value to true I receive it on client side.
https://stackoverflow.com/questions/41089035/protobuf-default-values
and saw that default values are not sent on wire and in case of boolean
variables, False is default value. I don't know how true it is?
Is there some general proper way of how to handle this for all types of
variables(int32, bool etc.)
Thanks,
Lovepreet
--
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
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...