diff --git a/pkg/yqlib/candidate_node.go b/pkg/yqlib/candidate_node.go index bfaadd7b..c181d34e 100644 --- a/pkg/yqlib/candidate_node.go +++ b/pkg/yqlib/candidate_node.go @@ -130,7 +130,7 @@ func (n *CandidateNode) GetFileIndex() int { func (n *CandidateNode) GetKey() string { keyPrefix := "" if n.IsMapKey { - keyPrefix = "key-" + keyPrefix = fmt.Sprintf("key-%v-", n.Value) } key := "" if n.Key != nil { diff --git a/pkg/yqlib/doc/operators/keys.md b/pkg/yqlib/doc/operators/keys.md index 537d6594..c07ec119 100644 --- a/pkg/yqlib/doc/operators/keys.md +++ b/pkg/yqlib/doc/operators/keys.md @@ -131,7 +131,7 @@ will output - p: a isKey: false tag: '!!map' -- p: a.c +- p: a.b isKey: true tag: '!!str' - p: a.b @@ -140,6 +140,9 @@ will output - p: a.b.0 isKey: false tag: '!!str' +- p: a.c + isKey: true + tag: '!!str' - p: a.c isKey: false tag: '!!str' diff --git a/pkg/yqlib/operator_load_test.go b/pkg/yqlib/operator_load_test.go index 5bb30321..04710605 100644 --- a/pkg/yqlib/operator_load_test.go +++ b/pkg/yqlib/operator_load_test.go @@ -61,7 +61,7 @@ var loadScenarios = []expressionScenario{ document: `{something: {file: "thing.yml"}, over: {here: [{file: "thing.yml"}]}}`, expression: `(.. | select(has("file"))) |= load("../../examples/" + .file)`, expected: []string{ - "D0, P[], (!!map)::{something: {a: apple is included, b: cool.}, over: {here: [{a: apple is included, b: cool.}]}}\n", + "D0, P[], (doc)::{something: {a: apple is included, b: cool.}, over: {here: [{a: apple is included, b: cool.}]}}\n", }, }, {