ingydotnet / yaml-pm

YAML Perl Module
http://search.cpan.org/dist/YAML/
20 stars 26 forks source link

Compatibility with YAML Spec 1.2 (and RAML specification) #167

Open mikkoi opened 7 years ago

mikkoi commented 7 years ago

I am having problems with reading in an example of RAML 0.8 Specification: https://github.com/raml-org/raml-tutorial-200/blob/master/jukebox-api.raml

Are we supporting YAML Spec 1.2? Or is the RAML specification wrong?

Several errors, for instance:

YAML Error: Inconsistent indentation level
   Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
   Line: 114
PROBLEM:
    is: [
          searchable: {description: "with valid searchable fields: songTitle", example: "[\"songTitle\", \"Get L\", \"like\"]"},
          orderable: {fieldsList: "songTitle"},
          pageable
        ]
YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 122
PROBLEM:
/{songId}:
YAML Error: Can't parse inline sequence
   Code: YAML_PARSE_ERR_INLINE_SEQUENCE
   Line: 174

PROBLEM:
/albums:
  type:
    collection:
      exampleCollection: !include jukebox-include-albums.sample
      exampleItem: !include jukebox-include-album-new.sample

Edited by @perlpunk: format code blocks for readability

perlpunk commented 6 years ago

YAML.pm actually only supports YAML 1.0. YAML::XS is recommended (but it's based on libyaml, which targets YAML 1.1). You can also try out https://metacpan.org/pod/YAML::PP, which aims to parse YAML 1.2, but it's still in development