fuwaneko / node-protobuf

Google Protocol Buffers wrapper for Node.js [UNMAINTAINED]
179 stars 42 forks source link

bool values are not encoded #40

Closed jdrukman closed 10 years ago

jdrukman commented 10 years ago

The .proto looks like this

message Request {
    optional double lat = 1;
    optional double lng = 2;
    optional bool include_address = 3;
}

My js code:

    var ob = { lat: lat, lng: lng, include_address: true };
    var proto = revgeo_schema().serialize(ob);
    return proto;

The protobuf never changes no matter what I do for include_address. I tried true, 1, "1", "true", etc...

fuwaneko commented 10 years ago

I can't reproduce this. Booleans should be passed as JS boolean values and they are parsed as booleans as well. var proto = revgeo_schema().serialize(ob); Not sure what you're doing with call to "revgeo_schema", it's not a function. See readme for an example.

P.S. It seems you're using chrisdew/protobuf, not this library.

jdrukman commented 10 years ago

Well, that was embarrassing. The good news is I found out about your library this way, and I'm using it now. It works perfectly! Thanks.