carvel-dev / ytt

YAML templating tool that works on YAML structure instead of text
https://carvel.dev/ytt
Apache License 2.0
1.69k stars 137 forks source link

@ytt:toml.decode() fails to marshal TOML array of table values #630

Closed pivotaljohn closed 2 years ago

pivotaljohn commented 2 years ago

reported: https://kubernetes.slack.com/archives/CH8KCCKA5/p1647400515157369 minimal example: https://carvel.dev/ytt/#gist:https://gist.github.com/pivotaljohn/81df98b1024374ca04ad30ad987cc70b TOML docs: https://toml.io/en/v1.0.0#array-of-tableshttps://toml.io/en/v1.0.0#array-of-tables

Environment:


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible" 👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

gcheadle-vmware commented 2 years ago

TOML is a little weird in the syntax for an array of tables(maps). Each array item is prefixed with the parent map key and double square brackets:

| YAML |

normal_map:
  a: 1
  b: 2

| TOML |

[normal_map]
a = 1
b = 2

| YAML |

array_of_maps:
- a: 1
  b: 2
- a: 3

| TOML |

[[array_of_maps]]
a = 1
b = 2

[[array_of_maps]]
a = 3