Description
protobuf.js version: 6.6.3
Hey, first off this library is really great - love the typescript integration! Thanks for building it.
I'm trying to work out how to retain 'null' values across the wire. We have some instances where a value can be null and it means something different to empty string or 0 value. Google has the wrappers https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto that let you do this, and protobuf.js handles retaining the null well, however it doesn't automatically wrap and unwrap the values
Lets say I have
message ChangeEvent {
string source = 1;
google.protobuf.StringValue code = 2;
}
I'd like to be able to pass in:
const changeEventWithCode = {
source = 'test',
code = 'code',
}
const changeEventWithoutCode = {
source = 'test',
code = null,
}
and have them both encode & decode to the same thing. However it seems if I want to set the code string, I have to do:
const changeEventWithCode = {
source = 'test',
code = {
value: 'code',
},
}
I was hoping fromObject and toObject would handle this, but they don't - is there any way I can hook in some customisation to do this, or would this be a good feature to add to the framework?