January 2018 Archives

YAML::PP Grant Report December 2017

Hi there!

Thanks for reading my report. In the last report I included a mini tutorial about string quoting methods in YAML. This time I've written an introduction into YAML Schemas and Tags.

In December I have been working about 60 hours on YAML::PP, YAML::XS, libyaml and the Schema article.

See also my previous reports on blogs.perl.org (Aug/Sep, Oct, Nov ) and news.perlfoundation.org (Aug/Sep, Oct, Nov ).

Introduction to YAML Schemas and Tags

I wrote this article as part of my YAML::PP Grant report for December 2017.

This article will give you an overview how a YAML document is loaded into a data structure and how a processor decides if something is a string, a number, a boolean or something else.

If you look at JSON, the rules are quite obvious:

    "string": "just a string",
    "boolean": true,
    "integer": 42,
    "float": 3.14159,
    "undefined": null,
    "list": [1, 2, 3]

In YAML, it depends on the YAML version, and on the Schema the Processor implements. This makes it more powerful, but also more complicated to implement and use.

Some processors implement YAML 1.1, some implement 1.2, and often there are things that aren't implemented correctly. When writing YAML, it's good to know the official specification to understand why some things are supported in one processor, but not in others.

This article covers:

  • Standard Tags/Schema in YAML 1.2
  • Type System in YAML 1.1
  • How to write compatible YAML
  • Other types of Schemas

As an example, note how boolean handling differs in YAML 1.1/1.2 and the 1.2 schemas.

About tinita

user-pic just another perl punk,