Data Generation Tools

February 12, 2026 ยท View on GitHub

Two tools generate test data for different purposes:

ToolOutputUse Case
cmd/seedWrites directly to databaseAPI development and testing
cmd/generate-mockWrites a JSON file to diskCrawler 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

FlagDefaultDescription
-relying-parties3Number of relying parties to insert (each gets 1-20 random intended uses)
-fixtures-onlyfalseSeed only predefined fixture data (ignores -relying-parties)
-include-fixturesfalseSeed fixtures first, then random data to reach the -relying-parties count
-freshfalseTruncate all data before seeding
-config""Path to config file (overrides WIMAPI_CONFIG_FILE and default paths)

Notes:

  • -fixtures-only and -include-fixtures are mutually exclusive
  • The seeder auto-creates a supervisory authority to satisfy foreign keys
  • Database triggers automatically populate the filter_values table

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

FlagDefaultDescription
-count100Number of relying parties to generate
-outputdata/mock-crawler-data.jsonPath to output JSON file
-intended-uses-min1Minimum intended uses per relying party
-intended-uses-max3Maximum intended uses per relying party
-index-offset0Offset 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-offset to avoid UUID collisions. For example, if file 1 has 100 entries (indices 0-99), use -index-offset 100 for file 2.
  • The output directory is created automatically if it doesn't exist.