Introduction to YAML

YAML stands for Yet Another Markup Language or YAML Ain’t Markup Language, depending who you ask. It's a text-based format, superset of JSON but more human-readable.

There are 2 types of structures, that can be combined, you need to know about in YAML to read and write Open API documents:

Maps let you define name-value pairs:

Notice that unlike JSON the quotation marks are optional

When you define multiple structures in a single file, use a --- separator line:

You can specify more complex structures with a key that maps to another map:

The structure is given by the lines indentation. The number of space is up to you as long as it's at least 1 and you're consistent. Never use tabs.

Lists let you define sequence of items. Items start with a dash (-) and are indented from the list name:

You can combine lists and maps, as lists of maps, lists of lists, maps of lists and maps of maps: