Mock YAML Generator
YAML drives a huge amount of modern tooling: Kubernetes manifests, CI pipelines, and infrastructure configuration all live in YAML files. When you are building or testing a parser, a templating layer, or a config-driven feature, you need valid sample documents that exercise nested maps, lists, and mixed value types. This tool generates that YAML for you.
How it works
The generator builds a tree of values and serializes it with two-space indentation, the standard YAML convention (tabs are forbidden in YAML indentation). Maps emit key: value pairs, lists emit - item entries, and nested structures indent one level deeper per depth.
Type handling follows YAML’s inference rules. Booleans render as true/false, numbers render bare, and null renders as null. Crucially, any string that looks like a boolean, number, or null is wrapped in quotes so the parser keeps it as a string. Three presets shape the output: a generic application config, a Kubernetes-style manifest (apiVersion, kind, metadata, spec), and a CI pipeline (stages, jobs, steps).
Tips and notes
- Validate output with a YAML linter or
yaml.safe_loadto confirm it parses; it should round-trip cleanly. - The Kubernetes preset is structurally representative but not schema-validated, so check it against the real resource schema before applying.
- Quoting of ambiguous strings (for example
"yes","123") prevents YAML from coercing them into booleans or numbers. - Increase list sizes to test how your parser or UI handles longer sequences.