-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
Currently the writeYaml step is only able to output the yaml to a file. However, sometimes we need the resulting yaml as a string in Groovy, such as when building a kubernetes pod spec. The only workaround is either to write to some temp file and then call readYaml, or to directly call into SnakeYaml, neither of which is ideal.
I propose adding a boolean returnText parameter to writeYaml. If it is omitted or false, then writeYaml preserves its existing behavior. If it is true, then file and ovewrite must not be specified and writeYaml will return the yaml as a string.
Example usage:
String yaml = writeYaml data: object, returnText: true