Commit Graph
26 Commits
Author SHA1 Message Date
Joeseph GreyandGitHub b7a06d6e1f fix: parse signed hex and octal integers (#2749) 2026-08-03 11:36:24 +10:00
William FloydandGitHub 30e16a33c3 Fix for #2677 (#2705)
* Update docs given https://github.com/yaml/go-yaml/pull/348

* Fix for https://github.com/mikefarah/yq/issues/2677

Depends on https://github.com/yaml/go-yaml/pull/348

* Test for https://github.com/mikefarah/yq/issues/2677

* Remove redundant check and add test case for explicit `!!merge` on `*+` traversal

* Bump go.yaml.in/yaml/v4 from 4.0.0-rc.4 to 4.0.0-rc.5
2026-06-09 14:08:47 +10:00
dependabot[bot]GitHubmikefarahdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
8c018da9c9 Bump go.yaml.in/yaml/v4 from 4.0.0-rc.3 to 4.0.0-rc.4 (#2579)
* Bump go.yaml.in/yaml/v4 from 4.0.0-rc.3 to 4.0.0-rc.4

Bumps [go.yaml.in/yaml/v4](https://github.com/yaml/go-yaml) from 4.0.0-rc.3 to 4.0.0-rc.4.
- [Commits](https://github.com/yaml/go-yaml/compare/v4.0.0-rc.3...v4.0.0-rc.4)

---
updated-dependencies:
- dependency-name: go.yaml.in/yaml/v4
  dependency-version: 4.0.0-rc.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix test expectations for go.yaml.in/yaml/v4 rc.4 error message changes

Agent-Logs-Url: https://github.com/mikefarah/yq/sessions/e172bcc4-f547-4c9f-bcc5-ba61849d37e5

Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>
2026-04-12 14:26:15 +10:00
b0ba9589d7 Fix findInArray misuse on MappingNodes in equality and contains (#2645)
recurseNodeObjectEqual and containsObject both used findInArray to
locate keys in a MappingNode's Content array. findInArray steps by 1,
so it matches against both keys (even indices) and values (odd indices).

In recurseNodeObjectEqual, when a null key in the LHS matched a null
value in the RHS at the last position, rhs.Content[indexInRHS+1]
accessed an out-of-bounds index, causing a panic.

In containsObject, a %2 guard prevented the panic but introduced false
negatives: when a null value appeared before the actual null key,
findInArray returned the value's odd index, the guard rejected it, and
the function reported the key as missing.

Both functions now use findKeyInMap, which steps by 2 and compares only
key positions. The %2 guard in containsObject is removed.

Reproducer for the panic (recurseNodeObjectEqual):

    echo '? [{~: ~}]
    : v1
    ? [{2: ~}]
    : v2' | yq '. += .'

Reproducer for the false negative (containsObject):

    printf '? 1\n: ~\n? ~\n: x\n' | yq 'contains({~: "x"})'

Found by OSS-Fuzz via the lima project's FuzzEvaluateExpression target.
https://issues.oss-fuzz.com/issues/383860504

Signed-off-by: Jan Dubois <jan@jandubois.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 18:30:44 +10:00
Mike Farah 9e0c5fd3c9 Fixing escape charaters again 😢 #2517 2025-11-25 10:17:43 +11:00
Mike Farah ff2c1c930c Adding more tests 2025-10-12 14:50:41 +11:00
Mike Farah 0b7d4b799c Fixed CSV content starting with # issue #2076 2024-06-29 15:04:07 +10:00
Mike Farah 68aafb6a53 Handle numbers with underscores #2039 2024-06-16 11:09:52 +10:00
Mike FarahandGitHub 13d1bbb45f Generic ast (#1829)
Remove dependency on yaml.Node for internal AST representation. Yaml decoder is now just another decoder.
2023-10-18 12:11:53 +11:00
Mike Farah cb609a1886 Fixed bad line entry for #1422 2022-11-15 11:35:31 +11:00
Mike Farah 688fe55bb9 Added test for err fix 2022-11-09 21:46:00 +11:00
Mike Farah ed551bf339 Added extra parseSnippet test 2022-11-01 09:15:59 +11:00
Mike Farah c887042a1b Fixing null csv bug #1404 2022-10-30 22:02:08 +11:00
d41b44dc42 Add accessor for the yq logger instance (#1013)
Allow consumers of yqlib to customize the logger instance.

Closes #432

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>

Co-authored-by: Carolyn Van Slyck <me@carolynvanslyck.com>
Co-authored-by: Rob Ferguson <robert.j.ferguson@nasa.gov>
2021-11-30 10:51:49 +11:00
Mike Farah ba223df4ac Moved eval function to eval interface 2021-02-11 10:58:40 +11:00
Mikhail KatychevandMike Farah e6336bcb85 added lib_test.go 2021-02-11 10:58:40 +11:00
Mike Farah d19e9f6917 read command 2020-10-13 12:51:37 +11:00
Mike Farah d66a709213 refactored array merge flags into a strategy 2020-07-17 13:26:20 +10:00
Mike Farah feba7b04fa Added path stack to string test 2020-01-09 21:36:05 +11:00
Mike Farah 924eb6c462 Added missing functions to interface 2020-01-09 21:18:24 +11:00
Mike Farah 52eef67e37 more tests, some refactoring 2020-01-09 08:17:56 +11:00
Mike Farah 9771e7001c splatting 2019-12-09 13:44:53 +11:00
Conor NosalandMike Farah 5fc13bdccd update imports for v2 module path 2019-12-06 13:58:56 +11:00
Conor NosalandMike Farah 64d1e58f97 test coverage and linting 2019-12-06 13:58:56 +11:00
Conor NosalandMike Farah 4b3fbb878f Split marshal package from yqlib, implement interfaces 2019-12-06 13:58:56 +11:00
Conor NosalandMike Farah 26a09e6ec0 Move implementation files to yqlib and test packages to allow for imports:
- Move data_navigator, json_converter, merge, and path_parser to pkg/yqlib
- Extract yamlToString from yq to pkg/yqlib/yaml_converter
- Move utils_test to test/utils
2019-12-06 13:58:56 +11:00