Remove item from YamlSequence
Closed this issue · 3 comments
dsgoers20 commented
Hi, how can I remove an item from a YamlSequence? Even when I set overrideConflicts=true
, the old values are not removed:
final YamlMapping original = Yaml.createYamlMappingBuilder()
.add(
"some_key",
Yaml.createYamlSequenceBuilder().add("one").add("two").build()
)
.build();
final YamlMapping updated = new MergedYamlMapping(
original,
() -> Yaml.createYamlMappingBuilder()
.add(
"some_key",
Yaml.createYamlSequenceBuilder().add("three").add("four").build()
).build(),
true
);
System.out.println(updated);
Result:
some_key:
- one
- two
- three
- four
zoeself commented
@dsgoers20 thank you for reporting this. I'll assign someone to take care of it soon.
zoeself commented
@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role DEV
available or because the project does not have enough funds.
Please, make sure there is at least one available contributor with the required role and the project can afford to pay them.
amihaiemil commented
@dsgoers20 I think the only way at the moment is to implement your own YamlSequence
decorator which would "remove" (actually skip) the intended elements from iteration.