The problem is very simple. YAML 1.1 is _almost_ backwards compatible to 1.0, with the exception for a few points. The point that broke is the shorthand tags from the YAML type repository. In YAML 1.0 you could prefix a value with !str and this means it shouldn't be interpolated as another type of value. A typical example (and actually the example that triggered the incident) is this:
version: !str 0.2Now, in YAML 1.1, it doesn't look the same way. It was decided that a single exclamation point is actually shorthand for the user namespace, while a double exclamation point means the yaml.org:2002-namespace. So, the above example in YAML 1.1 is
version: !!str 0.2This is a tiny change, but it breaks, since YAML 1.0 handles !!str as a private type, and YAML 1.1 handles !str as a private type. Not a really nice situation.
The solution in my case will be to add a flag for RbYAML and JvYAML that specifies that you want 1.0-compatibility. When that flag is turned on, some of these issues will be handled correctly by the parser, and emitted in a way an 1.0 parser could read. This will be the only change in RbYAML. But JvYAML will contain (as detailed before) an emitter, JavaBean materialization and many bug fixes.
Inga kommentarer:
Skicka en kommentar