Thursday, October 30, 2008

I have put YamlBeans 0.9.2 to my project. It works.
To see the internals better I have created a space in Assemla
http://trac-hg.assembla.com/yamlb

  • source code migrated from SVN to Mercurial
  • use Maven and apply the recommended folder structure

:( Mercurial is not perfect. When a resource is renamed it is not that simple to see the history in Eclipse.)

Because the project does not define a lot of tests I have started contributing tests to cover complete YAML 1.1. Once I have written most of examples from Chapter 2 (http://yaml.org/spec/1.1/) and most types (http://yaml.org/type/index.html) I realized that YamlBeans fails to cope with a lot of them.
The biggest problem is that most of types are not supported. Only strings, sequences and mappings work.
Read from the YamlBeans project page:

The YAML tokenizer, parser, and emitter are based on those from the JvYAML project. They have been heavily refactored, bugs fixed, etc. The rest of the JvYAML project was not used because of its complexity. YamlBeans strives for the simplest possible thing that works, with the goal being to make it easy to use the YAML data format with Java.


Unfortunately, an attempt to agree with the developer on what shall be supported did not lead to a common understanding. Apparently it should be not a big deal for Java projects.
But it creates an inconvenience if data is exchanged between Java and Python. For instance

map.put("text", "123")

will dump in YamlBeans
---
text: 123
...

instead of (like it is in JvYAML)
---
text: !!str 123
...

As a result PyYAML will assign to 'text' an integer which is not what I would expect.

Also YamlBeans will parse null, bool, float, int, binary as strings. Which is not always convenient.

The public interface was significantly changed and I need to learn 'yet another API' to work with YAML.

I think I shall give JvYAML a try.

0 comments: