Skip to content

ytt fmt changes yaml structure #817

@Zebradil

Description

@Zebradil

What steps did you take:

$ cat <<EOF > test.yaml
top-level list with empty map:
- {}
another top-level element: 42
EOF

$ diff -u test.yaml <(ytt fmt -f test.yaml)

What happened:

Notice how the empty map is replaced by another top-level element, which becomes a list element of top-level list with empty map.

--- test.yaml	2023-03-27 16:49:19.973100152 +0200
+++ /proc/self/fd/11	2023-03-27 16:49:51.349538852 +0200
@@ -1,3 +1,2 @@
 top-level list with empty map:
-- {}
-another top-level element: 42
+  - another top-level element: 42

What did you expect:

The output yaml is structurally identical to the input yaml.

Environment:

  • ytt version 0.45.0
  • OS: Linux x86

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.

Metadata

Metadata

Assignees

Labels

bugThis issue describes a defect or unexpected behaviorcan be replicatedA bug that has been reproducedpriority/unprioritized-backlogHigher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome.

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions