-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Milestone
Description
Currently transform.Unmarshal allows to either provide a string or a resource. In the first case the format is inferred from the string, but it may be more useful to be able to specify it. For example json has precedence over yaml, so something like {p: [a, b]} would fail since it’s not valid json but is valid yaml. My current solution for this is to make a temporary resource with a .yaml extension and pass that to Unmarshal. This solution is needlessly complicated and more expensive.
I propose to add a "format" key to the option dict so that it can be used like this:
{{ $opts := dict "format" "yaml" }}
{{ $parsed := "{p: [a, b]}” | unmarshal $opts }}