Menu

#22 kwalify 0.7.2 cannot handle valid YAML sequence (non)indentation

v1.0_(example)
open
nobody
2
2015-08-27
2015-08-27
Ken Coar
No

YAML syntax permits elements of a sequence under a map key to be at the same indentation level as the map key itself. In fact, this is the default format for Ruby's psych #to_yaml emitter. Since I need to validate YAML generated by psych, and I haven't figured out how to tell it to indent sequences, this is a serious problem for me. That kwalify is failing to correctly parse valid YAML is a serious issue for the package.

Both of these are valid YAML:

--- 
foo:

  - bar
  - bletch

--- 
foo:

- bar
- bletch

However, kwalify fails to correctly parse the second example.

Why kwalify (Ruby) has its own YAML parser rather than instrumenting one of the upstream packages (like psych) is something I do not understand.

The attachment contains three YAML files:

  1. A schema;
  2. A conformant file that passes kwalify's validation; and
  3. A conformant file that kwalify considers invalid.

The two conformant files differ only in the sequence indentation as shown above.

Here is a transcript of validating these files:

$ kwalify -v
0.7.2
$ kwalify -lf seqindent-schema.yaml seqindent-pass.yaml
seqindent-pass.yaml#0: valid.
$ kwalify -lf seqindent-schema.yaml seqindent-fail.yaml
ERROR: seqindent-fail.yaml:3:1 [/] document end expected (maybe invalid tab char found).
1 Attachments

Discussion


Log in to post a comment.

MongoDB Logo MongoDB