Skip to content

yq does not parse property path correctly ... ? #2266

Closed
@JoshMcCullough

Description

@JoshMcCullough

Describe the bug
I must be doing something wrong here as this seems very basic. It appears that nested properties are not parsed correctly? See below.

Version of yq: 4.45.1
Operating system: RHEL8
Installed via: binary

Input Yaml
test.yml:

test:
  blah: x
  some.data: z

Command

# This works correctly:
> yq -r '.test.blah' test.yml
x

# This does not (expected "z"):
> yq -r '.test.some.data' test.yml
null

# Quoting the compound path part works:
> yq -r '.test."some.data"' test.yml
z

Actual behavior
Querying a compound path part (test.some.data) does not traverse the path.

Expected behavior
Querying a compound path part (test.some.data) should traverse the path without the need for quoting.

Additional context
The test.yml file above includes two ways to write nested paths. A given YAML file could look either way:

test:
  some.data: x

-- or --

test:
  some:
    data: x

Both are valid YAML, the end user wouldn't know which format is in place within a given YAML file (without looking), so querying test.some.data should work for both cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions