jsonnet
jsonnet copied to clipboard
Document -S (--string) in language reference (and maybe tutorial, too).
Not much else to say.
$ jsonnet --version && cat test.jsonnet && echo && jsonnet test.jsonnet
Jsonnet commandline interpreter v0.16.0
local wrapper = [
{
some_prop: true
}
];
std.manifestYamlDoc(wrapper)
"- \"some_prop\": true"
Try passing the --string
flag to the jsonnet tool.
Yep. Jsonnet formats the output as JSON by default. The function manifestYamlDoc returns a string, so the output is formatted as JSON string which contains your YAML. When you pass -S
/--string
, the output string is printed verbatim.
Do you mind pointing me to where in the documentation it says this?
I have been going off this and it did not mention any of this https://jsonnet.org/ref/stdlib.html
That said, we should probably document -S
option in reference and/or tutorial. It is described in https://jsonnet.org/articles/output-formats.html, but it's so important that we should mention it in other places too.
Thanks for the response. A line or two of options docs would have saved me an hour of debugging there
I think we can still document it better. This is a pretty basic feature and should be mentioned in the tutorial. Reopening.