YAML Basics
Quick reference for writing YAML configuration files.
Basic Syntax
| YAML | Meaning |
|---|---|
key: value |
Assign a value |
- item |
List item |
# comment |
Comment (ignored) |
"string" |
Explicit string (use quotes if value has special chars) |
- |
Indentation (use spaces, not tabs) |
Data Types
Strings
Numbers
Booleans
Lists
Dictionaries
# Inline syntax
server: {host: localhost, port: 8080}
# Block syntax
server:
host: localhost
port: 8080
Indentation Rules
- Use spaces (not tabs)
- Consistent indentation (usually 2 spaces)
- Nested items are indented further
Common Patterns in DQM-ML
Key-Value Pairs
Lists of Options
Nested Configuration
features:
processors:
- name: image_embedding
type: features_embeddings
model:
arch: resnet18
infer:
batch_size: 10
width: 224
Common Mistakes to Avoid
Wrong: Using Tabs
Wrong: Inconsistent Indentation
# Wrong — key2 indented inconsistently
key1: value
··key2: value # ← 2 extra spaces (shown as ..), wrong level
# Correct — consistent indentation
key1: value
key2: value
Wrong: Missing Colon
Tools for Writing YAML
- YAML Validator - Check syntax
- Visual Studio Code: extension YAML by Red Hat
Yaml validation
Add on top of your configuration:
You might need to update the link to the schema, relative to your configuration file, or absolute.
Related Pages
- Configuration - Full configuration guide
- CLI Reference - Command-line usage