Recipe 'MergeYaml' doesn't add a new row to a table
The issue can be reproduced by following test case. I executed it locally by adding it to the MergeYamlTest class.
@Test
fun mergeSequenceMap() = assertChanged(
recipe = MergeYaml(
"$",
"""
testing:
table:
- row1key1: v111
row1key2: v222
""".trimIndent(),
false,
null
),
before = """
testing:
table:
- row2key1: v111
row2key2: v222
""",
after = """
testing:
table:
- row1key1: v111
row1key2: v222
- row2key1: v111
row2key2: v222
"""
)
Hi @dmbelyaev, At this time MergeYaml only supports merging scalars into sequences, determining the equality of two mappings is required to prevent the recipe from continually re-adding the same sequence value. At this time determining mapping equality is one of the challenges preventing support for merging non scalars into sequences.
check out this test https://github.com/openrewrite/rewrite/blob/88b334f3cea1bbd895340bed27a643515bfc573a/rewrite-yaml/src/test/kotlin/org/openrewrite/yaml/MergeYamlTest.kt#L111-L140
fixed by #2240