Closed simonenkoav closed 3 days ago
Hey @simonenkoav, it looks like you are generating code with https://github.com/stephenh/ts-proto.
The buf CLI compiles Protobuf and hands descriptors (similar to an AST) to plugins that generate code. Anyone can write a Protobuf plugin that works with the buf CLI. ts-proto is one of the plugins that's commonly used to generate TypeScript. Can you file an issue with the upstream repository?
Yes, you are right! Thank you, sorry for taking your time.
GitHub repository with your minimal reproducible example (do not leave this field blank or fill out this field with "github.com/bufbuild/buf" or we will automatically close your issue, see the instructions above!)
github.com/bufbuild/buf
Commands
Output
Expected Output
I expect null value not to be replaced by undefined in
fromPartial
method.Anything else?
We have proto message
Parent
like this:and use
buf generate
, which generates this:So the
value
field must be filled with builtin values (int, string, list, dict, null), which are, as far as I understand, are converted toValue
in
Parent.encode
byValue.wrap
when sending request to the server:It works with all the types except null value —
Parent.value
is replaced byundefined
and server receives empty field. And the problem seems to be inParent.fromParent
, which is called when sending request without our control and replacedParent.value
byundefined
:before encoding.
Could you please support not replacing null values by
undefined
infromPartial
?