Skip to content

fix yaml parser, stream mode parity with jq, SIGPIPE handling, version bump#48

Merged
JFryy merged 1 commit into
mainfrom
jf/t/address-yaml-parsing-issue
May 5, 2026
Merged

fix yaml parser, stream mode parity with jq, SIGPIPE handling, version bump#48
JFryy merged 1 commit into
mainfrom
jf/t/address-yaml-parsing-issue

Conversation

@JFryy

@JFryy JFryy commented May 5, 2026

Copy link
Copy Markdown
Owner

Replace goccy/go-yaml with go.yaml.in/yaml/v4 (the actively maintained successor to the standard go yaml library), which correctly parses multiline plain scalars in sequences that goccy rejected with "value is not allowed in this context". Add a regression test for the failing case. Use SetIndent(2) on the encoder to preserve the existing 2-space indentation in YAML output.

Fix --stream output to match jq --stream exactly: emit one compact JSON line per element instead of pretty-printed blocks, and emit [path, []] / [path, {}] for empty arrays and objects (previously silently dropped).

Catch SIGPIPE and exit 0 so pipelines like qq --stream | grep -q foo don't report failure when the downstream consumer exits early

Changes

  • 🛠️ Code Changes

    • Implemented feature
    • Fixed bug
    • Refactored component
    • Updated documentation
  • 🐛 Testing

    • Added unit tests for new functionality
    • Updated existing tests to reflect changes
    • Ran all tests locally
  • 📄 Documentation

    • Updated README or documentation files as needed

Additional Notes

…ersion to v0.3.4

Replace goccy/go-yaml with go.yaml.in/yaml/v4 (the actively maintained
successor), which correctly parses multiline plain scalars in sequences
that goccy rejected with "value is not allowed in this context". Add a
regression test for the failing case. Use SetIndent(2) on the encoder to
preserve the existing 2-space indentation in YAML output.

Fix --stream output to match jq --stream exactly: emit one compact JSON
line per element instead of pretty-printed blocks, and emit [path, []]
/ [path, {}] for empty arrays and objects (previously silently dropped).

Catch SIGPIPE and exit 0 so pipelines like `qq --stream | grep -q foo`
don't report failure when the downstream consumer exits early.
@JFryy

JFryy commented May 5, 2026

Copy link
Copy Markdown
Owner Author

closes #46 #47

@JFryy JFryy merged commit ab50ef6 into main May 5, 2026
1 check passed
@JFryy JFryy deleted the jf/t/address-yaml-parsing-issue branch May 6, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant