Closed telackey closed 4 years ago
Quick summary version:
@telackey can you try the version beta.8 ?
and remember doing something like
codec.encode({ __type_url: theType, ...message })
would not work, type_url is only for any types.
If you want to encode a message without the container root message you have to do:
codec.encodeByType({ ... }, theType)
Fixed by beta.9
In trying to reorganize some of the Greeting protobufs, I ran into several issues.
The first is that with a definition like this:
The codec will fail with the error 'Invalid field: messages'. Debugging a bit, at that point internally type is set to 'GreetCommand' not 'SubmitCommand', and GreetCommand has no field 'messages'.
Next problem, if I strongly type the field like this, and try to encode it directly (not as part of a GreetCommand) I get an error about __typeurl on a non-Any type. (I think switching this away from an error is already in the queue)
But if I comment out that error, after decoding I get an array of empty objects (
{}
) rather than messages, while if it is anAny
it works as expected.I added tests cases for all three.
To reproduce use:
yarn test --testRegex=proto.test.js