Hi Stewart,

Your msg.txt file does not get the nesting quite right. You need to write
out "(list=...)" for KvListKeyTValT values
and "(text=...)" for PrimText values, like this:

(style=(list=[(key=(text="display"), val=(text="flex")),
(key=(text="flex-direction"), val=(text="column"))]))


- David


On Thu, Feb 9, 2017 at 7:57 AM, stewart mackenzie <[email protected]>
wrote:

> Greetings,
>
> Steps to reproduce:
>
> cat the below into a file called schema.capnp:
>
> @0xdab3aeaf26d885f5;
>
> struct UiJsCreate {
>   style @0 :KvListKeyTValT;
> }
> struct KvListKeyTValT {
>   list @0 :List(KvKeyTValT);
> }
> struct KvKeyTValT {
>   key @0 :PrimText;
>   val @1 :PrimText;
> }
> struct PrimText {
>   text @0 :Text;
> }
>
> then cat the below into a file called msg.txt:
>
> (style=[(key="display", val="flex"), (key="flex-direction", val="column")])
>
> then encode with this command:
>
> capnp encode schema.capnp UiJsCreate < msg.txt > msg.bin
>
> then decode with this command
>
> capnp decode schema.capnp UiJsCreate < msg.bin > msg.txt2
>
> $ cat message.txt
> ()
>
> Expected behaviour:
> data is successfully encoded and decode without an error message
>
> Actual behaviour
> $ capnp encode schema.capnp UiJsCreate < msg.txt > msg.bin
> <stdin>:1:8-75: error: Type mismatch; expected KvListKeyTValT.
>
> $ capnp --version
> Cap'n Proto version 0.5.3
>
> --
> You received this message because you are subscribed to the Google Groups
> "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/group/capnproto.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to