question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested Yaml question

See original GitHub issue

Hi. 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:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
cowtowncodercommented, Apr 2, 2021

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.

0reactions
cowtowncodercommented, Apr 9, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found