See the test below:
@Test
void insertInSequenceEntriesWithDeepSearchWithComment_1() {
rewriteRun(
spec -> spec.recipe(new MergeYaml(
"$..containers",
"imagePullPolicy: Always",
true,
null,
null,
null,
null
)),
yaml(
"""
kind: Pod
spec:
containers:
- name: <container name> # comment
""",
"""
kind: Pod
spec:
containers:
- name: <container name> # comment
imagePullPolicy: Always
"""
)
);
}
This fails because # comment is in DocumentEnd node rather than the yaml block. Not sure what to propose... I'd probably try to keep the inline comment as part of the entry... Or perhaps have a special case for the comment at the end of the document if this would be a less intrusive fix.
See the test below:
This fails because
# commentis in DocumentEnd node rather than the yaml block. Not sure what to propose... I'd probably try to keep the inline comment as part of the entry... Or perhaps have a special case for the comment at the end of the document if this would be a less intrusive fix.