Schema Registry
The AltSportsLeagues.ai Schema Registry provides 150+ Pydantic v2 models across 7 domains, enabling type-safe data exchange between leagues, sportsbooks, and the platform.
Visual Schema Architecture
Domain Entity Relationships
Domain Overview
Schema Generation Pipeline
Key Schemas by Domain
League Domain Schemas
| Schema | Description | Fields |
|---|---|---|
LeagueQuestionnaire | League onboarding form data | 10 fields |
TierClassification | AI-assigned tier (1.1-4.9) | 5 fields |
ContractTerms | Generated partnership terms | 8 fields |
NegotiationPackage | Complete deal package | 12 fields |
LeagueQuestionnaire Example:
{
"league_name": "Elite Soccer League",
"sport_type": "soccer",
"contact_name": "John Smith",
"contact_email": "john@esl.com",
"participant_count": 32,
"geographic_scope": "international",
"budget_range": "premium",
"has_api": true,
"fan_base_size": 2000000,
"years_operating": 8
}TierClassification Result:
{
"tier": "1.2",
"tier_name": "Premium League",
"composite_score": 87.5,
"complexity_score": 72.0,
"risk_factors": ["high_complexity"]
}Schema Versioning
All schemas follow semantic versioning with automatic migration support:
Version Metadata:
{
"version": "8a31017",
"versionHistory": {
"8a31017": {
"date": "2025-11-03",
"changes": "Auto-generated from LeagueQuestionnaireSchema",
"author": "SchemaAdapterGenerator",
"breaking": false,
"commit": "8a310179"
}
},
"deprecated": false,
"supersedes": null,
"supersededBy": null
}TypeScript Integration
// Import generated types
import type {
LeagueQuestionnaire,
TierClassification,
OddsAdjustment,
Team,
Player
} from '@altsportsleagues/schemas';
// Type-safe API calls
async function submitQuestionnaire(
data: LeagueQuestionnaire
): Promise<TierClassification> {
const response = await fetch('/v1/leagues/questionnaire', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
});
return response.json();
}
// Zod validation (auto-generated)
import { LeagueQuestionnaireSchema } from '@altsportsleagues/schemas/zod';
const validated = LeagueQuestionnaireSchema.parse(formData);Python Integration
from data_layer.shared.python.schemas import (
LeagueQuestionnaire,
TierClassification,
OddsAdjustment
)
# Type-safe model instantiation
questionnaire = LeagueQuestionnaire(
league_name="Elite Soccer League",
sport_type="soccer",
contact_name="John Smith",
contact_email="john@esl.com",
participant_count=32,
geographic_scope="international",
budget_range="premium"
)
# Automatic validation
questionnaire.model_validate(data) # Raises ValidationError on failure
# JSON serialization
json_data = questionnaire.model_dump_json()Schema Updates
Schemas are auto-generated from Pydantic models on every deployment. To add or modify schemas:
- Edit the Pydantic model in
data_layer/shared/python/ - Run
python -m data_layer.shared.generate - TypeScript, JSON Schema, and GraphQL are auto-generated
- Version history is tracked automatically
Related Documentation
- System Specifications - Kiro-style specs with EARS notation
- API Reference - REST API documentation
- Internal Developer Guide - Development workflows