chrisdew / protobuf

Protocol Buffers for Node.JS
http://code.google.com/p/protobuf-for-node/
Apache License 2.0
234 stars 71 forks source link

Required message fields are not handled properly #11

Closed shargors closed 12 years ago

shargors commented 12 years ago

Everything works if the proto file is this:

package ptest; message LoginReq { optional string login_name = 1; optional string password = 2; }

But if the login_name field becomes required then deserialization fails and provides the following error:

libprotobuf ERROR google/protobuf/message_lite.cc:123] Can't parse message of type "ptest.LoginReq" because it is missing required fields: login_name

undefined:1 function(self) { var f = this; return function(arg) { return f.call(self, ^ Error: Malformed message at Function.parse (unknown source) at Object. (/home/ec2-user/dev/tests/msgs/test.js:14:24) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.runMain (module.js:492:10) at process.startup.processNextTick.process._tickCallback (node.js:244:9)

shargors commented 12 years ago

Oops, never mind. I did not realize that login_name in the proto file would be loginName in JavaScript.