Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proto3 default values #471

Closed
rosek86 opened this issue Sep 8, 2016 · 3 comments
Closed

proto3 default values #471

rosek86 opened this issue Sep 8, 2016 · 3 comments

Comments

@rosek86
Copy link

rosek86 commented Sep 8, 2016

Hi,

I have a very simple message as the one below. That message is compiled to json using pbjs. I try to set mode field to 0, encode and then decode the message. When the message is decoded mode field no longer have 0 value but it is set to null.

Looking on the documentation for proto3, the default value for number should be decoded as 0 number:
https://developers.google.com/protocol-buffers/docs/proto3#default

Please let me know if I can provide more details about my problem.

Many thanks,
Krzysztof

syntax = "proto3";

package Package;

message Data {
  uint32 mode = 1;
}
@paralin
Copy link

paralin commented Sep 14, 2016

This is probably because pbjs does not seem to include the proto3 syntax in some cases.

@paralin
Copy link

paralin commented Sep 14, 2016

#380

@dcodeIO
Copy link
Member

dcodeIO commented Nov 28, 2016

Closing this for now.

protobuf.js 6.0.0

Feel free to send a pull request if this is still a requirement.

@dcodeIO dcodeIO closed this as completed Nov 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants