Two Flavors
Yamls can be either list or map types.
-
Map is ideal for defining objects, configurations, and structuring data with meaningful attributes
-
List is ideal for ordering items and sequences
Map Example
user:
name: "John Doe"
age: 30
location: "New York"
You can see how it is useful for maps to define configurations.
List Example
fruits:
- Apple
- Banana
- Orange
tasks:
- description: Buy groceries
priority: high
- description: Finish report
priority: medium
You can see for sequences such as CD/CI pipelines this is very useful.
Last Notes
A general rule is that list YAML for ordered, anonymous, and repeated things Anonymous meaning you will likely never care to search by some meaningful id for it. Map YAML is for named configuration objects.