Importing YAML files was requested by multiple people, it was proposed in #196 and popped up in various discussions. Also YAML files are very popular in the Kubernetes communities which are heavy users of jsonnet.
Implementing library function (probably builtin) parseYaml would allow processing yaml files with jsonnet. It would require importing it first through importstr then invoking parseYaml on the result. Later we can think about automatically applying it based on extension or something.
Relatedly imporstr and parseJson should be used rather than import when dealing with json (not jsonnet) files, especially if they are not 100% trusted (consider imporstr "/etc/passwd").
Challenges:
- YAML is complicated, making it very difficult to keep byte-for-byte compatibility
- The existing parsers may be slightly non-compliant
- Safe vs unsafe yaml
@benley, @nikolay
Importing YAML files was requested by multiple people, it was proposed in #196 and popped up in various discussions. Also YAML files are very popular in the Kubernetes communities which are heavy users of jsonnet.
Implementing library function (probably builtin)
parseYamlwould allow processing yaml files with jsonnet. It would require importing it first throughimportstrthen invokingparseYamlon the result. Later we can think about automatically applying it based on extension or something.Relatedly
imporstrandparseJsonshould be used rather thanimportwhen dealing withjson(not jsonnet) files, especially if they are not 100% trusted (considerimporstr "/etc/passwd").Challenges:
@benley, @nikolay