Documentation Index
Fetch the complete documentation index at: https://mintlify.com/kulterryan/who-to-bother-at-on-x/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Who To Bother uses Valibot for runtime validation of all company JSON files. This ensures data integrity and provides helpful error messages when validation fails.Why Valibot?
Valibot is a modern schema validation library that provides:- Type Safety: TypeScript types are inferred directly from the schema
- Runtime Validation: Validates data at build time and runtime
- Single Source of Truth: One schema definition for both validation and types
- JSON Schema Generation: Auto-generate JSON Schema for IDE support
- Detailed Error Messages: Clear, actionable error messages
The build will fail if any JSON file fails validation, preventing deployment of invalid data.
Schema Definition
The Valibot schema is defined insrc/data/companies/schema.ts:
src/data/companies/schema.ts
Validation Rules
The schema enforces the following validation rules:Contact Validation
Must be a non-empty string
- Must be an array with at least one handle
- Each handle must start with
@ - Can only contain letters, numbers, and underscores
- No spaces or special characters (except
_)
@timneutkens, @shadcn, @user_123Invalid examples: timneutkens (missing @), @user name (space), @user-name (hyphen)Optional field that must be a valid email format if provided
Optional field that must be a valid URL if provided
Category Validation
Must be a non-empty string
Must be an array with at least one contact
Company Validation
- Must be a non-empty string
- Can only contain lowercase letters, numbers, and hyphens
- No uppercase, spaces, or special characters (except hyphen)
vercel, tanstack, google-ai-studioInvalid examples: Vercel (uppercase), tan_stack (underscore)Must be a non-empty string (can contain any characters)
Must be a non-empty string
Must be a non-empty string that matches a key in
company-logos.tsxMust be an array with at least one category
Optional fields that must be valid URLs if provided
Validation Script
The validation script (src/scripts/validate-companies.ts) validates all company JSON files:
src/scripts/validate-companies.ts
Running Validation
Validate all company files with:- Read all
.jsonfiles fromsrc/data/companies/ - Exclude
schema.jsonandexample.json.template - Validate each file against the Valibot schema
- Print results with checkmarks (✅) for valid files and crosses (❌) for invalid files
- Show detailed error messages for any validation failures
- Exit with code 1 if any files fail validation (prevents builds)
Example Output
JSON Schema Generation
A JSON Schema is automatically generated from the Valibot schema for IDE support:src/data/companies/schema.json from the Valibot schema using @valibot/to-json-schema.
IDE Autocomplete
To enable IDE autocomplete, add the$schema property to your company JSON files:
- Autocomplete: Suggestions as you type
- Inline validation: Red squiggly lines for errors
- Hover documentation: Tooltips with field descriptions
- Error messages: Detailed error messages before you run validation
Build-Time Validation
Validation runs automatically during the build process:package.json
Type Safety
TypeScript types are inferred directly from the Valibot schema:- TypeScript types always match the runtime validation
- No duplication between types and validation
- Single source of truth for data structure
Common Validation Errors
Handle format errors
Handle format errors
Error:
Handle must start with @ and contain only letters, numbers, and underscoresCause: Handle doesn’t start with @ or contains invalid charactersFix: Ensure all handles:- Start with
@ - Contain only letters, numbers, and underscores
- No spaces, hyphens, or other special characters
Company ID format errors
Company ID format errors
Error:
Company ID must be lowercase with only letters, numbers, and hyphensCause: Company ID contains uppercase letters or invalid charactersFix: Use only lowercase letters, numbers, and hyphens:Missing required fields
Missing required fields
Error:
Company ID is required (or other field name)Cause: A required field is missingFix: Ensure all required fields are present:id,name,description,logoType- At least one
categorywithnameandcontacts - Each contact must have
productandhandles
Empty arrays
Empty arrays
Error:
At least one handle is required or At least one contact is required per categoryCause: Required arrays are emptyFix: Ensure:- Each contact has at least one handle
- Each category has at least one contact
- The company has at least one category
Invalid email format
Invalid email format
Error:
Must be a valid email addressCause: Email field doesn’t match email formatFix: Use a valid email format:Invalid URL format
Invalid URL format
Error:
Must be a valid URLCause: URL fields don’t match URL formatFix: Use complete, valid URLs:Best Practices
Use IDE autocomplete
Add
"$schema": "./schema.json" to enable IDE validation and autocompleteValidate early and often
Run
pnpm validate frequently while editing to catch errors earlyRead error messages
Valibot provides detailed, actionable error messages - read them carefully
Test locally
Always test with
pnpm dev after validation passes