Questions tagged [yamlbuilder]

5 questions
2
votes
0 answers

Is there any way to exclude null properties when using Groovy's YAMLBuilder?

I'm using Groovy to generate an openapi spec document in YAML. I'm using YamlBuilder to convert the object model to a YAML string. It's been working well so far, but one issue I've noticed is that null properties are present in the YAML output. This…
Scottm
  • 7,004
  • 8
  • 32
  • 33
1
vote
1 answer

Convert Map> to Yaml using YamlBuilder

i want to convert a json {"test": "1,2,3,4"} into yaml of the form: --- test: - 1 - 2 - 3 - 4 for this i tried to use the following groovy snippet: def json = new groovy.json.JsonSlurper().parseText('{"test": "1,2,3,4"}') println json def…
1
vote
0 answers

Groovy YamlBuilder field case

I'm trying to generate a cloudformation template with groovy YamlBuilder, that's why case matters here. The issue is that by default YamlBuilder converts pascal-case fields to camel-case. Please see the example (runnable via groovyConsole): import…
Anton Hlinisty
  • 1,441
  • 1
  • 20
  • 35
1
vote
2 answers

Write a literal YAML field using Groovy 3.0's new YamlBuilder

Groovy 3.0 has a new YamlBuilder class that works in a similar way to the existing JsonBuilder class. I'm trying to work out if I can use YamlBuilder to generate a literal field in YAML such as: data: | this is a literal text value My first…
SteveD
  • 5,396
  • 24
  • 33
0
votes
1 answer

Convert map to yaml file

I'm trying to create yaml file from a map with yamlBuilder but it's not in the right context that I need it to be. For example: Map mymap = [1: "a, b, c ,d", 2: "y, d, x"] The yamlfile that I want to look like: -Content: -1: -a …
Saar Gamzo
  • 57
  • 4