Nested Yaml question
See original GitHub issueHi. I was using version 2.10.5 and my code was able to process nested yamls correctly. With version 2.12.2 I am not able to make it work.
Code:
YAMLMapper yamlMapper = new YAMLMapper(new YAMLFactory().enable(YAMLGenerator.Feature.MINIMIZE_QUOTES));
yamlMapper.writerWithDefaultPrettyPrinter().writeValue(new File("output.yaml"), resource.getResource());
Output with version 2.10.5
---
apiVersion: v1
kind: MyKind
metadata:
name: example
data:
config.yaml: |
lowercaseOutputName: true
rules:
- pattern: "metric<name=(.+)><>(\\w+)"
name: "metric_$1_$2"
type: "GAUGE"
Output with version 2.12.2
---
apiVersion: v1
kind: MyKind
metadata:
name: example
data:
config.yaml: "lowercaseOutputName:\
\ true\nrules:\n- pattern: \"metric<name=(.+)><>(\\\\w+)\"\n name:\
\ \"metric_$1_$2\"\n type: \"GAUGE\"\n"
Am I missing some serialization option?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Multiple level nesting in YAML - Stack Overflow
I'm trying to use YAML to create list of all stored procs used in an application and from where they are called. I...
Read more >Yaml - Tangram Docs
When nested, YAML calls this a "collection" – we usually call this an element with a number of parameters: element: parameter1: value parameter2:...
Read more >Using Bash to iterate through nested directories and extract ...
What I need is inside a certain directory (must include nested directories) using bash commands to find all example.yaml files and then, copy ......
Read more >How to represent maps in YAML - Educative.io
The nested map must be indented further than the parent map. Representing maps in YAML. The following code snippet shows how to represent...
Read more >How to define the value of a sequence in questions.yaml?
It is a sequence of hosts. I'd like to fill the value of host using the questions.yaml file? But how can I define...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes. This is difficult because leaving out quoting is dangerous. But I know that use case of “just leave out minimally processed chunk to use in k8s manifests (Helm Charts, whatever)” is pretty common and this is problematic for user-editability.
This is probably related to #246.
Also forgot to mention that a unit test would be needed to show details (explanation alone is not sufficient to reproduce). It would be good to have a small reproduction, but I’ll proceed with #246 since I think that will resolve this issue too.