Schema Registry
Schema Registry Overview

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

SchemaDescriptionFields
LeagueQuestionnaireLeague onboarding form data10 fields
TierClassificationAI-assigned tier (1.1-4.9)5 fields
ContractTermsGenerated partnership terms8 fields
NegotiationPackageComplete deal package12 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:

  1. Edit the Pydantic model in data_layer/shared/python/
  2. Run python -m data_layer.shared.generate
  3. TypeScript, JSON Schema, and GraphQL are auto-generated
  4. Version history is tracked automatically

Related Documentation

Platform

Documentation

Community

Support

partnership@altsportsdata.comdev@altsportsleagues.ai

2025 Β© AltSportsLeagues.ai. Powered by AI-driven sports business intelligence.

πŸ€– AI-Enhancedβ€’πŸ“Š Data-Drivenβ€’βš‘ Real-Time