How do I go about specify the default for a repeated field?
e.g., given a .piqi file as follows
.record [
.name foo-heartbeat
.field [
.name message-type
.code 1
.type foo-heartbeat-message-type
]
.field [
.name version
.code 2
.type foo-version
]
.field [
.name interfaces
.code 7
.type interface
.repeated
]
]
I'd like to be set the default for the 'interfaces' field to be an empty list.
e.g., if you look at the following erlang
(ubic@paglierino)1> A1 = {ubic_foo_heartbeat,<<"M_wY>Py">>,1,[]}.
(ubic@paglierino)3> ubic_records:gen_foo_heartbeat(A1, json).
<<"{\"message_type\":\"M_wY>Py\",\"version\":1}">>
I'd prefer the output to actually look like
<<"{ \"message_type\": \"M_wY>Py\", \"version\": 1, \"interfaces\": [] }">>
I know that I can achieve this by running ubic_records:gen_foo_heartbeat(A1, json, [{json_omit_null_fields, false}])., but that has other side-effects -(you get all the other un-assigned fields to, not just this one)
Is there a way here? Or am I SOL?