Skip to content

Comma operator order of precedence different to jq #1156

Open
@ivoshm

Description

Describe the bug

If you want return more subkeys in expression like .a|,b,.c, yq return only subvalue for first subkey and others are null.

JQ returns all subvalues correctly.

Version of yq: 4.22.1 (tested on 4.24.2, 4.14.1 and 4.10.0 too)
Operating system: linux (noticed on windows port too)
Installed via: ArchLinux package go-yq

Input Yaml

a:
  b: B
  c: C
  d: D

Command
The command you ran:

yq '.a|.b,.c,.d' input.yaml

Actual behavior

B
null
null

Expected behavior

B
C
D

Additional context
It was originally discovered in XML mode, but it behaves the same in YAML and JSON.

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions