02 / YAML / yaml-generator
YAML Generator
Generate YAML test and configuration data from a schema.
How to use
- 01Define your fields. Each row has a key, a type (string, number, boolean, list or object) and an optional value.
- 02Leave a value empty to get random or default data, or type {i} anywhere in a value to insert the record number (starting at 1), as in service-{i}.
- 03For list fields, enter comma-separated items such as api,backend. For object fields, press + Child to add nested fields. Remove any row with the ✕ button.
- 04Press + Add field for more top-level fields, set Records (1 to 1000), and set an optional Root key such as services.
- 05Press Generate YAML, then Copy the output or press Download .yaml to save it as data.yaml.
What is this tool?
This YAML generator builds structured YAML test and configuration data from a small schema you define in the browser. Fields can be strings, numbers, booleans, lists or nested objects. Values can be fixed, templated with the record index, or left empty to be randomized, which makes it quick to produce dozens of similar service definitions or fixture records. Everything is generated locally in your browser, and nothing is uploaded.
How each field type is filled in
A string field uses your value as written, with {i} replaced by the record number. If the value is empty, it falls back to the key name plus the number, such as name-1, name-2. A number field with an empty value gets a random integer from 0 to 999. Any value that isn't numeric becomes 0. A boolean field is random when empty, true when the value is exactly true, and false for anything else. A list field splits its value on commas and trims each item, defaulting to alpha and beta when empty. An object field has no value of its own. It holds the child fields you add with + Child, and those can nest further.
Templating with {i} works in any string, number, boolean or list value, so a list value of shard-{i}a,shard-{i}b gives each record its own pair of items.
Worked example: three service definitions
The default schema shows the typical pattern. name is a string set to service-{i}, replicas is a number left empty, enabled is a boolean left empty, tags is a list set to api,backend, and resources is an object with cpu: 500m and memory: 256Mi as children. With Records set to 3 and Root key set to services, Generate YAML produces a services: key holding a list of three items. They're named service-1 to service-3, each has random replicas and enabled values, the same two tags, and a nested resources block.
The root key controls the outer shape. With a root key, the records are wrapped under that key. Clear the root key to get a bare top-level list. Clear it and set Records to 1 to get a single mapping with no list around it, which is handy for producing one config file.
Common use cases
- Generating dozens of service entries to load-test a config parser or templating step
- Creating YAML fixtures with predictable, numbered IDs for data-driven test cases
- Producing a single sample config document to seed documentation or a starter repo
- Mocking nested resource blocks, such as CPU and memory limits, to exercise Helm or Kustomize logic
- Building randomized boolean and numeric inputs to probe edge cases in a YAML-driven feature flag system
FAQ
How do I generate YAML test data?
Define fields with a key and type, set how many records you want, and press Generate YAML. You can copy the output or download it as data.yaml.
How do I make each record unique?
Type {i} inside a value, for example user-{i}. It's replaced with the record number, starting at 1. Empty string fields also get unique key-based values automatically.
Can I create nested YAML objects?
Yes. Set a field's type to object and press + Child to add nested fields. Child fields can be objects too.
How many records can I generate?
Between 1 and 1000 per run. Values outside that range are clamped.
How do I get a top-level list instead of a root key?
Clear the Root key field. The records are then output as a plain YAML list, or as a single mapping if Records is 1.