jsonnet
jsonnet copied to clipboard
multifile output not creating yaml stream
I have a jsonnet which outputs a json of the form {out.yaml: [{a:1},{b:2}]}
(json simplified for this example).
When I run the command jsonnet -y -m.
I do not get the intended yaml stream in the out.yaml file. Instead I get the json format output [{a:1},{b:2}]}
.
Is this expected behavior?
I also ran the same command but using jrsonnet (jrsonnet -y -m.
) and I obtain the yaml stream as I would expect
When you're using multi to output files that are not json (e.g. yaml), you have to choose a format for each file being output. In practice that means using std.exportYamlDoc or std.exportYamlStream to convert the value to a string (use the right function for the format you want) and then using -S when using --multi in order to avoid encoding that string as json.