protobuf.js version: 6.3.1
How can read JSON data with static-module ?
With dynamic modules I can just do:
protobuf.load("src/foo.proto").then(function(root) {
var Bar = root.lookup("bar");
return bar.from({baz: {qux: 3}});
});
and it yields Message { baz: Message { qux: 3 } }
However, the code generated with pbjs -t static-module only defines the create method, which doesn't create the right child object types.
This is particularly painful when having things like oneof which depend on functionality defined in the generated type's protototype to guide the encoding (and thus basically encoding an empty message since it cannot determine which field of the oneof to render).
Should we just generate the from method ?
protobuf.js version: 6.3.1
How can read JSON data with
static-module?With dynamic modules I can just do:
and it yields
Message { baz: Message { qux: 3 } }However, the code generated with
pbjs -t static-moduleonly defines thecreatemethod, which doesn't create the right child object types.This is particularly painful when having things like
oneofwhich depend on functionality defined in the generated type's protototype to guide the encoding (and thus basically encoding an empty message since it cannot determine which field of theoneofto render).Should we just generate the
frommethod ?