DSL Reference
Complete reference for the DataGeneration DSL syntax.
Basic Structure
{
"collectionName": {
"count": <number>,
"item": {
"fieldName": <field definition>
}
}
}
Topics
- Collections - Define collections and items
- References - Create relationships between collections (including range and conditional references)
- Shadow Bindings - Bind and reuse referenced items for cross-entity constraints
- Arrays - Generate arrays of values
- Filtering - Exclude specific values
- Expressions - Computed string values with functions
- Static Values - Use literal values
Key Features
Reference Types
- Simple
[*]- Random item - Indexed
[0]- Specific item - Range
[0:9]- Subset by index range - Conditional
[status='active']- Filter by field values - Sequential - Cycle through items in order
- Self
this.field- Reference same item - Shadow Bindings
$name- Bind items for reuse in conditions
Quick Examples
Simple Collection
{
"users": {
"count": 10,
"item": {
"id": {"gen": "uuid"},
"name": {"gen": "name.fullName"}
}
}
}
With References
{
"users": {
"count": 5,
"item": {"id": {"gen": "uuid"}}
},
"orders": {
"count": 20,
"item": {
"id": {"gen": "uuid"},
"userId": {"ref": "users[*].id"}
}
}
}
With Arrays
{
"products": {
"count": 10,
"item": {
"id": {"gen": "uuid"},
"tags": {
"array": {
"size": 3,
"item": {"gen": "lorem.word"}
}
}
}
}
}
Next Steps
Explore each topic in detail using the sidebar navigation.