Open
Description
When merging into an existing list with no indentation, the modified entry will be indented, causing the new list to be invalid
What version of OpenRewrite are you using?
I am using
- OpenRewrite v8.47.1
- Maven plugin v6.2.0
What is the smallest, simplest way to reproduce the problem?
I wrote a unit test to reproduce the issue
class MergeYamlTest implements RewriteTest {
...
@Test
void mergeListRespectIndentation() {
rewriteRun(spec ->
spec.recipe(new MergeYaml(
"$",
//language=yaml
"""
widget:
list:
- item 2
""",
false,
null,
null,
null,
null
)),
yaml(
"""
widget:
list:
- item 1
""",
"""
widget:
list:
- item 1
- item 2
"""
)
);
}
...
}
What did you expect to see?
widget:
list:
- item 1
- item 2
What did you see instead?
widget:
list:
- item 1
- item 2
Metadata
Assignees
Labels
Type
Projects
Status
Backlog
Activity