Closed GoogleCodeExporter closed 9 years ago
Do you think it is a bug ?
Have you checked all the possibilities in DumperOptions ?
Original comment by py4fun@gmail.com
on 24 Sep 2014 at 8:25
Yes, I believe it's a bug - why would outputting incorrect YAML be a default
option?
If the hierarchy of your object is conceptually indented then its
representation should be as well.
If your value is an array of strings it would be indented as such, but when it
is an array of objects it is not.
Original comment by s...@yahoo-inc.com
on 25 Sep 2014 at 12:32
Well, if SnakeYAML outputs incorrect YAML - it is bug. But the generated YAML
is perfectly correct. (If "correct" means that it follows the specification)
Do you may be mean: "the generated YAML does not match my personal preferences"
?
Then it can be divided into 2 parts:
- how can I generate the output with my format
- why my format is better and why it should be accepted as the default format
Original comment by py4fun@gmail.com
on 25 Sep 2014 at 11:58
Ok, let's consider the actual use case then:
How can I get snakeyaml to output in a format that perl YAML can understand?
http://search.cpan.org/~ingy/YAML-1.12/lib/YAML.pod
Let's say you output the above into a file called foo.yaml. How can you get
the following command to work?
perl -MYAML -e 'YAML::LoadFile("foo.yaml")'
Original comment by s...@yahoo-inc.com
on 25 Sep 2014 at 2:15
Now it is clear. If search our issues you will find a number of these cases.
Perl parser cannot parse YAML and users try to compensate it with changes in
SnakeYAML.
I can recommend the following:
1) file a bug for Perl - they have to improve the parser
2) try to use different output options (flow style, for instance)
DumperOptions options = new DumperOptions();
options.setIndent(4);
options.setPrettyFlow(true);
options.setDefaultFlowStyle(FlowStyle.FLOW);
Yaml yaml = new Yaml(options);
3) Have a look at org.yaml.snakeyaml.emitter.Emitter (ExpectBlockSequenceItem,
writeIndent())
Study how it works and make a proposal how to improve it. This is Open Source !
I hope it helps.
Original comment by py4fun@gmail.com
on 25 Sep 2014 at 4:29
Since there is no feedback the issue is closed.
Original comment by py4fun@gmail.com
on 4 Feb 2015 at 10:03
Original issue reported on code.google.com by
s...@yahoo-inc.com
on 23 Sep 2014 at 8:22Attachments: