Hi Anton
unfortunately I'm still on 0.5.7, I'll move to the latest as soon as the current project I'm working on is stabilized.
I've found a bug in json encoding with an enumeration with a dash in one of the options. I've narrowed it down to very simple testcase:
I've added the
issue to github: $ cat test.piqi:.enum [ .name dash
.option [ .name with-dash ]
]
.record [ .name test
.field [ .type dash ]
] $ erl1> piqi:start().
ok
2> c(test_piqi), c(test_piqi_ext), rr("*").
[test_test]
3> rl(test_test).
-record(test_test,{dash}).
ok
4> R=#test_test{ dash= with_dash }.
#test_test{dash = with_dash}
5> Json = test_piqi_ext:gen_test(R, json).
<<"{\"dash\":\"with_dash\"}">>
6> test_piqi_ext:parse_test(Json, json).
** exception throw: {piqirun_ext_error,"input:1:9: unknown enum option: \"with_dash\""}
in function piqirun_ext:convert/6 (src/piqirun_ext.erl, line 72)
in call from test_piqi_ext:parse_test/2 (test_piqi_ext.erl, line 15)
7> Xml = test_piqi_ext:gen_test(R, xml).
<<"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test><dash>with-dash</dash></test>\n">>
8> test_piqi_ext:parse_test(Xml,xml).
#test_test{dash = with_dash}I can't yet move to 0.6 but it'll definitely happen within 2 months, because we need to move forward, and we're going to build a lot on the internal piqi xml representation.
Any hints on where to look in the code, maybe we can fix it ourselves?
Thanks
Bart