- changed status to resolved
Dump with BLOCK & setIndicatorIndent(2) makes wrong YAML on list of maps
Issue #358
resolved
You can check it with 1.17 version:
import org.yaml.snakeyaml.*
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
options.setIndicatorIndent(2)
return new Yaml(options).dump({some:[{db_1:"ds",name:"asd"},{db_2:"daas",name:"adas"}]})
Input:
some:
- db_1: ds
name: asd
- db_2: daas
name: adas
Will produce output:
some:
-
db_1: ds
name: asd
-
db_2: daas
name: adas
Seems like we need to move map block according to indicator indent value.
Thank you.
Comments (2)
-
-
Please check the test: https://bitbucket.org/asomov/snakeyaml/src/f437efd6719eaa93d616c7aca164a3d2d07f0031/src/test/java/org/yaml/snakeyaml/issues/issue358/UnexpectedIndentTest.java?at=default&fileviewer=file-view-default
It looks like the DumperOptions must be validated to prevent invalid input.
- Log in to comment
Fix issue 358: validate DumperOptions
→ <<cset f437efd6719e>>