Joseph Bisch
Joseph Bisch

Reputation: 176

YAML generated by Ruby appears invalid (!omap vs !!omap)

I am trying to parse some YAML generated by some Ruby code (https://github.com/devrandom/gitian-builder/blob/81bf5d70252363a95cb75eea70f8d1d129948013/bin/gbuild#L322). I am trying to parse it using PyYAML. When PyYAML had trouble parsing the YAML, I tried an online validator (http://yaml-online-parser.appspot.com/) and it failed with the following error:

ERROR:

could not determine a constructor for the tag '!omap'
  in "<unicode string>", line 1, column 5:
    --- !omap
        ^

I see on the YAML website (can't post more than two links yet) that !!omap appears to be correct, not !omap. So why does Ruby output !omap when YAML::Omap is used?

I can't find anything online to explain this behavior.

If you want to see an example of the YAML I am trying to parse, search for the gitian.sigs repo on GitHub under the bitcoin account and look at any of the .assert files there (again, I can't post more than two links).

Upvotes: 1

Views: 211

Answers (1)

Joseph Bisch
Joseph Bisch

Reputation: 176

It turned out to be a legacy thing from Syck. While it should be !!omap, I was told I should be able to tell my parser that !omap is the same as !!omap.

See: https://github.com/tenderlove/psych/issues/241

Upvotes: 3

Related Questions