Data Generation Tools
February 12, 2026 ยท View on GitHub
Two tools generate test data for different purposes:
| Tool | Output | Use Case |
|---|---|---|
cmd/seed | Writes directly to database | API development and testing |
cmd/generate-mock | Writes a JSON file to disk | Crawler testing |
Seed (cmd/seed)
Inserts random or fixture-based relying party data directly into the database. Useful for populating the API with realistic data during development.
Usage
# Requires database to be running
docker compose up -d db
# Seed with defaults (3 relying parties, each with 1-20 intended uses)
WIMAPI_DATABASE_HOST=localhost go run ./cmd/seed
# Seed 100 relying parties
WIMAPI_DATABASE_HOST=localhost go run ./cmd/seed -relying-parties 100
# Seed only predefined fixtures
WIMAPI_DATABASE_HOST=localhost go run ./cmd/seed -fixtures-only
# Seed fixtures first, then fill to 50 with random data
WIMAPI_DATABASE_HOST=localhost go run ./cmd/seed -include-fixtures -relying-parties 50
# Clear all data first, then seed fresh
WIMAPI_DATABASE_HOST=localhost go run ./cmd/seed -fresh -relying-parties 20
# Use a custom config file
WIMAPI_DATABASE_HOST=localhost go run ./cmd/seed -config /path/to/config.yaml
CLI Flags
| Flag | Default | Description |
|---|---|---|
-relying-parties | 3 | Number of relying parties to insert (each gets 1-20 random intended uses) |
-fixtures-only | false | Seed only predefined fixture data (ignores -relying-parties) |
-include-fixtures | false | Seed fixtures first, then random data to reach the -relying-parties count |
-fresh | false | Truncate all data before seeding |
-config | "" | Path to config file (overrides WIMAPI_CONFIG_FILE and default paths) |
Notes:
-fixtures-onlyand-include-fixturesare mutually exclusive- The seeder auto-creates a supervisory authority to satisfy foreign keys
- Database triggers automatically populate the
filter_valuestable
Mock Generator (cmd/generate-mock)
Generates a JSON file containing relying party data in the format the crawler expects. Used to test the crawler without a real external data source.
Usage
# Generate 100 relying parties (default)
go run ./cmd/generate-mock
# Generate 500 with custom output path
go run ./cmd/generate-mock -count 500 -output data/custom-mock.json
# Customize intended uses per relying party
go run ./cmd/generate-mock -count 100 -intended-uses-min 2 -intended-uses-max 5
# Generate a second file with non-overlapping UUIDs
go run ./cmd/generate-mock -count 100 -output data/mock-source-2.json -index-offset 100
CLI Flags
| Flag | Default | Description |
|---|---|---|
-count | 100 | Number of relying parties to generate |
-output | data/mock-crawler-data.json | Path to output JSON file |
-intended-uses-min | 1 | Minimum intended uses per relying party |
-intended-uses-max | 3 | Maximum intended uses per relying party |
-index-offset | 0 | Offset added to each index for UUID generation |
Notes:
- UUIDs are deterministic โ generated from the index via
GenerateDeterministicUUID("wrp-{index}"). This means the same index always produces the same UUID. - When generating multiple files, use
-index-offsetto avoid UUID collisions. For example, if file 1 has 100 entries (indices 0-99), use-index-offset 100for file 2. - The output directory is created automatically if it doesn't exist.