Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

How To YAML

ImaMapleTree edited this page Jun 8, 2023 · 14 revisions

YAML stands for "YAML Ain't Markup Language." It's a human-readable data serialization format that is commonly used in software development. Think of it as a way to organize and store data in a simple and easy-to-read format.

Imagine you have a bunch of information that you want to store, like a list of your favorite books. In YAML, you can represent this information in a structured way. Let's take a look at an example:

image

In this example, we have a list of books. Each book is represented by a set of key-value pairs. The keys ("title," "author," and "year") represent different properties or attributes of the book. The corresponding values ("The Great Gatsby," "F. Scott Fitzgerald," and "1925") provide the actual data.

Indentation is used to define the structure. The hyphen (-) denotes the start of a new item in the list. It is important to maintain proper indenting otherwise the structure may become invalid.

Now, let's get a little bit more complex. Say you wanted to represent an apartment with multiple rooms. Each room should have a size, a number of doors, and a number of windows. Let's see how we could represent something like that in YAML:

image

In this example, our YAML starts off named "Apartment" which consists of two smaller pieces named "Bedroom" and "Kitchen." The smaller pieces are made up of even smaller key-value pairs, where each key represents a property of the person, like "Size," "Doors," and "Windows." The corresponding values provide the specific details for each property.

You might notice that the structure is similar to what we saw earlier with the list of books, but instead of using a hyphen, we use indentation and a colon (:) to separate the key and value.

In these structures, indentation is key to showing relationship. "Bedroom" and "Kitchen" are indented one level further than "Apartment." This establishes the relationship that both "Bedroom" and "Kitchen" are properties of "Apartment," or in other words, they belong to "Apartment." Similarly, "Size," "Doors," and "Windows" are indented one level further than their respective parents. Once again, this establishes that they are properties of their parents.

By mastering these structures, you will be able to effortlessly comprehend and convey intricate relationships. YAML plays a crucial role in configuring Project Lotus, so it is valuable to acquaint yourself with this data format.

Clone this wiki locally