diff --git a/pkg/yqlib/doc/operators/anchor-and-alias-operators.md b/pkg/yqlib/doc/operators/anchor-and-alias-operators.md index 97b4ec13..a7ecdb55 100644 --- a/pkg/yqlib/doc/operators/anchor-and-alias-operators.md +++ b/pkg/yqlib/doc/operators/anchor-and-alias-operators.md @@ -32,7 +32,7 @@ Given a sample.yml file of: r: 10 - &SMALL r: 1 -- !!merge <<: *CENTRE +- <<: *CENTRE r: 10 ``` then @@ -213,10 +213,10 @@ item_value: &item_value value: true thingOne: name: item_1 - !!merge <<: *item_value + <<: *item_value thingTwo: name: item_2 - !!merge <<: *item_value + <<: *item_value ``` then ```bash @@ -231,7 +231,7 @@ thingOne: value: false thingTwo: name: item_2 - !!merge <<: *item_value + <<: *item_value ``` ## LEGACY: Explode with merge anchors @@ -249,13 +249,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -298,7 +298,7 @@ Given a sample.yml file of: r: 10 - &SMALL r: 1 -- !!merge <<: +- <<: - *CENTRE - *BIG ``` @@ -328,7 +328,7 @@ Given a sample.yml file of: r: 10 - &SMALL r: 1 -- !!merge <<: +- <<: - *BIG - *LEFT - *SMALL @@ -361,13 +361,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -411,7 +411,7 @@ Given a sample.yml file of: r: 10 - &SMALL r: 1 -- !!merge <<: +- <<: - *CENTRE - *BIG ``` @@ -442,7 +442,7 @@ Given a sample.yml file of: r: 10 - &SMALL r: 1 -- !!merge <<: +- <<: - *BIG - *LEFT - *SMALL @@ -467,7 +467,7 @@ Given a sample.yml file of: ```yaml a: b: &b 42 -!!merge <<: +<<: c: *b ``` then diff --git a/pkg/yqlib/doc/operators/divide.md b/pkg/yqlib/doc/operators/divide.md index 6d88949f..62376200 100644 --- a/pkg/yqlib/doc/operators/divide.md +++ b/pkg/yqlib/doc/operators/divide.md @@ -55,7 +55,7 @@ yq '.a = .a / 0 | .b = .b / 0' sample.yml ``` will output ```yaml -a: !!float +Inf -b: !!float -Inf +a: +Inf +b: -Inf ``` diff --git a/pkg/yqlib/doc/operators/modulo.md b/pkg/yqlib/doc/operators/modulo.md index 810f30f3..9e7aa72b 100644 --- a/pkg/yqlib/doc/operators/modulo.md +++ b/pkg/yqlib/doc/operators/modulo.md @@ -34,7 +34,7 @@ yq '.a = .a % .b' sample.yml ``` will output ```yaml -a: !!float 2 +a: 2 b: 2.5 ``` @@ -69,7 +69,7 @@ yq '.a = .a % .b' sample.yml ``` will output ```yaml -a: !!float NaN +a: NaN b: 0 ``` diff --git a/pkg/yqlib/doc/operators/multiply-merge.md b/pkg/yqlib/doc/operators/multiply-merge.md index 368d91fa..2fdb5c6a 100644 --- a/pkg/yqlib/doc/operators/multiply-merge.md +++ b/pkg/yqlib/doc/operators/multiply-merge.md @@ -471,13 +471,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -487,7 +487,7 @@ yq '.foobar * .foobarList' sample.yml will output ```yaml c: foobarList_c -!!merge <<: +<<: - *foo - *bar thing: foobar_thing diff --git a/pkg/yqlib/doc/operators/recursive-descent-glob.md b/pkg/yqlib/doc/operators/recursive-descent-glob.md index cfcb7dae..191fbf80 100644 --- a/pkg/yqlib/doc/operators/recursive-descent-glob.md +++ b/pkg/yqlib/doc/operators/recursive-descent-glob.md @@ -131,13 +131,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -147,7 +147,7 @@ yq '.foobar | [..]' sample.yml will output ```yaml - c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing - foobar_c - *foo diff --git a/pkg/yqlib/doc/operators/traverse-read.md b/pkg/yqlib/doc/operators/traverse-read.md index d418bc00..f8d80ca9 100644 --- a/pkg/yqlib/doc/operators/traverse-read.md +++ b/pkg/yqlib/doc/operators/traverse-read.md @@ -294,13 +294,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -325,13 +325,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -376,13 +376,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -409,13 +409,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -442,13 +442,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -477,13 +477,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -513,13 +513,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -546,13 +546,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -579,13 +579,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then @@ -614,13 +614,13 @@ bar: &bar c: bar_c foobarList: b: foobarList_b - !!merge <<: + <<: - *foo - *bar c: foobarList_c foobar: c: foobar_c - !!merge <<: *foo + <<: *foo thing: foobar_thing ``` then diff --git a/pkg/yqlib/goccy_yaml_test.go b/pkg/yqlib/goccy_yaml_test.go index 9c1158cb..e2c74a83 100644 --- a/pkg/yqlib/goccy_yaml_test.go +++ b/pkg/yqlib/goccy_yaml_test.go @@ -230,8 +230,7 @@ var goccyYamlFormatScenarios = []formatScenario{ description: "merge anchor", skipDoc: true, input: "a: &remember\n c: mike\nb:\n <<: *remember", - // fine to have !!merge as that's what the current impl does - expected: "a: &remember\n c: mike\nb:\n !!merge <<: *remember\n", + expected: "a: &remember\n c: mike\nb:\n <<: *remember\n", }, { description: "custom tag", diff --git a/pkg/yqlib/lib_test.go b/pkg/yqlib/lib_test.go index 02ca6dbf..3d031430 100644 --- a/pkg/yqlib/lib_test.go +++ b/pkg/yqlib/lib_test.go @@ -24,7 +24,7 @@ type parseSnippetScenario struct { var parseSnippetScenarios = []parseSnippetScenario{ { snippet: ":", - expectedError: "yaml: while parsing a block mapping at : did not find expected key", + expectedError: "go-yaml load error in parser (while parsing a block mapping) at L1.C1: did not find expected key", }, { snippet: "", diff --git a/pkg/yqlib/operator_anchors_aliases_test.go b/pkg/yqlib/operator_anchors_aliases_test.go index bd6bbaa7..ef54c478 100644 --- a/pkg/yqlib/operator_anchors_aliases_test.go +++ b/pkg/yqlib/operator_anchors_aliases_test.go @@ -31,7 +31,7 @@ thingOne: value: false thingTwo: name: item_2 - !!merge <<: *item_value + <<: *item_value ` var explodeMergeAnchorsFixedExpected = `D0, P[], (!!map)::foo: diff --git a/pkg/yqlib/operator_divide_test.go b/pkg/yqlib/operator_divide_test.go index c0c9cd96..7da4f8c6 100644 --- a/pkg/yqlib/operator_divide_test.go +++ b/pkg/yqlib/operator_divide_test.go @@ -45,7 +45,7 @@ var divideOperatorScenarios = []expressionScenario{ document: `{a: 1, b: -1}`, expression: `.a = .a / 0 | .b = .b / 0`, expected: []string{ - "D0, P[], (!!map)::{a: !!float +Inf, b: !!float -Inf}\n", + "D0, P[], (!!map)::{a: +Inf, b: -Inf}\n", }, }, { diff --git a/pkg/yqlib/operator_load_test.go b/pkg/yqlib/operator_load_test.go index aab885ae..c7a8480a 100644 --- a/pkg/yqlib/operator_load_test.go +++ b/pkg/yqlib/operator_load_test.go @@ -77,7 +77,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[], (!!map)::{something: {a: apple is included, b: cool.}, over: {here: [{a: apple is included,\n b: cool.}]}}\n", }, }, { diff --git a/pkg/yqlib/operator_modulo_test.go b/pkg/yqlib/operator_modulo_test.go index 246db233..3d3857e8 100644 --- a/pkg/yqlib/operator_modulo_test.go +++ b/pkg/yqlib/operator_modulo_test.go @@ -37,7 +37,7 @@ var moduloOperatorScenarios = []expressionScenario{ document: `{a: 12, b: 2.5}`, expression: `.a = .a % .b`, expected: []string{ - "D0, P[], (!!map)::{a: !!float 2, b: 2.5}\n", + "D0, P[], (!!map)::{a: 2, b: 2.5}\n", }, }, { @@ -53,7 +53,7 @@ var moduloOperatorScenarios = []expressionScenario{ document: `{a: 1.1, b: 0}`, expression: `.a = .a % .b`, expected: []string{ - "D0, P[], (!!map)::{a: !!float NaN, b: 0}\n", + "D0, P[], (!!map)::{a: NaN, b: 0}\n", }, }, { @@ -70,7 +70,7 @@ var moduloOperatorScenarios = []expressionScenario{ document: "a: 2\nb: !goat 2.3", expression: `.a = .a % .b`, expected: []string{ - "D0, P[], (!!map)::a: !!float 2\nb: !goat 2.3\n", + "D0, P[], (!!map)::a: 2\nb: !goat 2.3\n", }, }, { diff --git a/pkg/yqlib/operator_multiply_test.go b/pkg/yqlib/operator_multiply_test.go index 66256c92..fbd556bf 100644 --- a/pkg/yqlib/operator_multiply_test.go +++ b/pkg/yqlib/operator_multiply_test.go @@ -121,7 +121,7 @@ var multiplyOperatorScenarios = []expressionScenario{ document: mergeArrayWithAnchors, expression: `. * .`, expected: []string{ - "D0, P[], (!!map)::sample:\n - &a\n - !!merge <<: *a\n", + "D0, P[], (!!map)::sample:\n - &a\n - <<: *a\n", }, }, { @@ -514,7 +514,7 @@ var multiplyOperatorScenarios = []expressionScenario{ environmentVariables: map[string]string{"originalPath": ".myArray", "otherPath": ".newArray", "idPath": ".a"}, expression: mergeExpression, expected: []string{ - "D0, P[], (!!map)::{myArray: [{a: apple, b: appleB2}, {a: kiwi, b: kiwiB}, {a: banana, b: bananaB, c: bananaC}, {a: dingo, c: dingoC}], something: else}\n", + "D0, P[], (!!map)::{myArray: [{a: apple, b: appleB2}, {a: kiwi, b: kiwiB}, {a: banana, b: bananaB, c: bananaC},\n {a: dingo, c: dingoC}], something: else}\n", }, }, { @@ -546,7 +546,7 @@ var multiplyOperatorScenarios = []expressionScenario{ document: mergeDocSample, expression: `.foobar * .foobarList`, expected: []string{ - "D0, P[foobar], (!!map)::c: foobarList_c\n!!merge <<: [*foo, *bar]\nthing: foobar_thing\nb: foobarList_b\n", + "D0, P[foobar], (!!map)::c: foobarList_c\n<<: [*foo, *bar]\nthing: foobar_thing\nb: foobarList_b\n", }, }, { @@ -554,7 +554,7 @@ var multiplyOperatorScenarios = []expressionScenario{ document: document, expression: `.b * .c`, expected: []string{ - "D0, P[b], (!!map)::{name: dog, \"<<\": *cat}\n", + "D0, P[b], (!!map)::{name: dog, <<: *cat}\n", }, }, { @@ -581,7 +581,7 @@ var multiplyOperatorScenarios = []expressionScenario{ document: "a: 2\nb: !goat 3.5", expression: ".a = .a * .b", expected: []string{ - "D0, P[], (!!map)::a: !!float 7\nb: !goat 3.5\n", + "D0, P[], (!!map)::a: 7\nb: !goat 3.5\n", }, }, { diff --git a/pkg/yqlib/operator_recursive_descent_test.go b/pkg/yqlib/operator_recursive_descent_test.go index 45e63cfd..03dbd8bb 100644 --- a/pkg/yqlib/operator_recursive_descent_test.go +++ b/pkg/yqlib/operator_recursive_descent_test.go @@ -187,7 +187,7 @@ var recursiveDescentOperatorScenarios = []expressionScenario{ document: mergeDocSample, expression: `.foobar | [..]`, expected: []string{ - "D0, P[foobar], (!!seq)::- c: foobar_c\n !!merge <<: *foo\n thing: foobar_thing\n- foobar_c\n- *foo\n- foobar_thing\n", + "D0, P[foobar], (!!seq)::- c: foobar_c\n <<: *foo\n thing: foobar_thing\n- foobar_c\n- *foo\n- foobar_thing\n", }, }, { @@ -195,7 +195,7 @@ var recursiveDescentOperatorScenarios = []expressionScenario{ document: mergeDocSample, expression: `.foobar | [...]`, expected: []string{ - "D0, P[foobar], (!!seq)::- c: foobar_c\n !!merge <<: *foo\n thing: foobar_thing\n- c\n- foobar_c\n- !!merge <<\n- *foo\n- thing\n- foobar_thing\n", + "D0, P[foobar], (!!seq)::- c: foobar_c\n <<: *foo\n thing: foobar_thing\n- c\n- foobar_c\n- <<\n- *foo\n- thing\n- foobar_thing\n", }, }, { @@ -203,7 +203,7 @@ var recursiveDescentOperatorScenarios = []expressionScenario{ document: mergeDocSample, expression: `.foobarList | ..`, expected: []string{ - "D0, P[foobarList], (!!map)::b: foobarList_b\n!!merge <<: [*foo, *bar]\nc: foobarList_c\n", + "D0, P[foobarList], (!!map)::b: foobarList_b\n<<: [*foo, *bar]\nc: foobarList_c\n", "D0, P[foobarList b], (!!str)::foobarList_b\n", "D0, P[foobarList <<], (!!seq)::[*foo, *bar]\n", "D0, P[foobarList << 0], (alias)::*foo\n", @@ -216,7 +216,7 @@ var recursiveDescentOperatorScenarios = []expressionScenario{ document: mergeDocSample, expression: `.foobarList | ...`, expected: []string{ - "D0, P[foobarList], (!!map)::b: foobarList_b\n!!merge <<: [*foo, *bar]\nc: foobarList_c\n", + "D0, P[foobarList], (!!map)::b: foobarList_b\n<<: [*foo, *bar]\nc: foobarList_c\n", "D0, P[foobarList b], (!!str)::b\n", "D0, P[foobarList b], (!!str)::foobarList_b\n", "D0, P[foobarList <<], (!!merge)::<<\n", diff --git a/pkg/yqlib/operator_select_test.go b/pkg/yqlib/operator_select_test.go index 35214f39..b9bcbbcd 100644 --- a/pkg/yqlib/operator_select_test.go +++ b/pkg/yqlib/operator_select_test.go @@ -98,7 +98,7 @@ var selectOperatorScenarios = []expressionScenario{ document: `[{animal: cat, legs: {cool: true}}, {animal: fish}]`, expression: `(.[] | select(.legs.cool == true).canWalk) = true | (.[] | .alive.things) = "yes"`, expected: []string{ - "D0, P[], (!!seq)::[{animal: cat, legs: {cool: true}, canWalk: true, alive: {things: yes}}, {animal: fish, alive: {things: yes}}]\n", + "D0, P[], (!!seq)::[{animal: cat, legs: {cool: true}, canWalk: true, alive: {things: yes}}, {animal: fish,\n alive: {things: yes}}]\n", }, }, { diff --git a/pkg/yqlib/operator_sort_keys_test.go b/pkg/yqlib/operator_sort_keys_test.go index c895b194..562994d4 100644 --- a/pkg/yqlib/operator_sort_keys_test.go +++ b/pkg/yqlib/operator_sort_keys_test.go @@ -37,7 +37,7 @@ var sortKeysOperatorScenarios = []expressionScenario{ document: `{bParent: {c: dog, array: [3,1,2]}, aParent: {z: donkey, x: [{c: yum, b: delish}, {b: ew, a: apple}]}}`, expression: `sort_keys(..)`, expected: []string{ - "D0, P[], (!!map)::{aParent: {x: [{b: delish, c: yum}, {a: apple, b: ew}], z: donkey}, bParent: {array: [3, 1, 2], c: dog}}\n", + "D0, P[], (!!map)::{aParent: {x: [{b: delish, c: yum}, {a: apple, b: ew}], z: donkey}, bParent: {array: [\n 3, 1, 2], c: dog}}\n", }, }, } diff --git a/pkg/yqlib/operator_style_test.go b/pkg/yqlib/operator_style_test.go index 11214092..e7d46f13 100644 --- a/pkg/yqlib/operator_style_test.go +++ b/pkg/yqlib/operator_style_test.go @@ -50,7 +50,7 @@ var styleOperatorScenarios = []expressionScenario{ document: "bing: &foo {x: z}\na:\n c: cat\n <<: [*foo]", expression: `(... | select(tag=="!!str")) style="single"`, expected: []string{ - "D0, P[], (!!map)::'bing': &foo {'x': 'z'}\n'a':\n 'c': 'cat'\n !!merge <<: [*foo]\n", + "D0, P[], (!!map)::'bing': &foo {'x': 'z'}\n'a':\n 'c': 'cat'\n <<: [*foo]\n", }, }, { diff --git a/pkg/yqlib/operator_traverse_path_test.go b/pkg/yqlib/operator_traverse_path_test.go index 6b2d63e3..e09d4991 100644 --- a/pkg/yqlib/operator_traverse_path_test.go +++ b/pkg/yqlib/operator_traverse_path_test.go @@ -494,7 +494,7 @@ var traversePathOperatorScenarios = []expressionScenario{ document: mergeDocSample, expression: `.foobar`, expected: []string{ - "D0, P[foobar], (!!map)::c: foobar_c\n!!merge <<: *foo\nthing: foobar_thing\n", + "D0, P[foobar], (!!map)::c: foobar_c\n<<: *foo\nthing: foobar_thing\n", }, }, { @@ -518,7 +518,7 @@ var traversePathOperatorScenarios = []expressionScenario{ document: mergeDocSample, expression: `.foobarList`, expected: []string{ - "D0, P[foobarList], (!!map)::b: foobarList_b\n!!merge <<: [*foo, *bar]\nc: foobarList_c\n", + "D0, P[foobarList], (!!map)::b: foobarList_b\n<<: [*foo, *bar]\nc: foobarList_c\n", }, }, {