Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multifile output not creating yaml stream #969

Open
achauvin-wish opened this issue Jan 4, 2022 · 1 comment
Open

multifile output not creating yaml stream #969

achauvin-wish opened this issue Jan 4, 2022 · 1 comment

Comments

@achauvin-wish
Copy link

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

@sparkprime
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants