Skip to content

Parser drops everything after empty yaml doc #451

@Cenness

Description

@Cenness

Discussion?
No

Describe the bug
On multidoc yaml input dasel drops all elements after first empty doc.

To Reproduce

  1. Create yaml
first: nonempty
---

---
second: nonempty
---
  1. Run cat md.yaml | dasel -r yaml -w yaml
  2. Get
first: nonempty

Expected behavior

$ cat md.yaml | yq
first: nonempty
---

---
second: nonempty
---

Screenshots
N/A

Desktop:

  • OS: Debian 12
  • Version: dasel version v2.8.1

Additional context

  • yq is mikefarah/yq
  • Multidoc yaml with empty docs in the middle can be seen in the wild on helm charts when entire template file is skipped due to some condition.
  • cat md.yaml | yq -o json | dasel -r json -w yaml crashes into panic, which is preferable to silently skipping payload
  • v3 panics with runtime error: invalid memory address or nil pointer dereference

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions