Skip to main content

How this library is built

Almost everything callable in sportsdataverse is generated: the ESPN wrappers, the native (non-ESPN) families, the dataset loaders, their TypeScript row and params types, and every reference page on this site come out of tools/codegen/generate.mjs. The generator reads two kinds of input:

  • Vendored YAML — endpoint and returns-schema YAML that sportsdataverse-py owns. npm run vendor copies it verbatim from a pinned sdv-py commit into tools/codegen/vendor/upstream/ (with a LOCK of git blob shas) and derives tools/codegen/endpoints/<family>.yaml. Never hand-edit a vendored file; it is clobbered on the next re-vendor and npm run vendor:check fails on the drift.
  • JS-owned YAML and TypeScript — families that exist only here (hockeytech, odds_api, yahoo_scores, recruiting), the overlays that patch a vendored family, the utilities catalogue, the breaking-change register, and the hand-written runtime under src/.

Every generated file carries a visible footer naming its source and linking the page here that explains it. The CI gates are npm run vendor:check (vendored inputs), npm run codegen:check (every generated output, this site's pages included), npm run api:check (the public API report) and npm test.

SurfaceSource of truthGeneratedCount
ESPN (vendored)sdv-py espn_*.yaml at the pinsrc/generated/espn/*.ts, docs/docs/<league>/126 endpoints × 30 leagues
Native, vendoredsdv-py <family>.yaml at the pinsrc/generated/flat/*.ts23 families
Native, JS-ownedtools/codegen/endpoints/<family>.yaml in this reposrc/generated/flat/*.ts4 families
Dataset loaderssdv-py releases.yaml + loader_schemas.yamlsrc/generated/loaders/*.ts323 loaders
Hand-writtenTypeScript under src/src/generated/utilities.ts, docs/docs/utilities/208 utility exports

sdv-py pin: afafaedae47b. 1059 native wrappers in total; 438 verified endpoints carry row types; 19 breaking changes on record.

The surfaces​

Changing something​

You want to…EditThen run
add / change a shared endpointsdv-py first; bump the pin in tools/codegen/vendor.yamlnpm run vendor -- --ref <sha> → npm run codegen
patch how JS binds a vendored familytools/codegen/overlay/<family>.yamlnpm run vendor -- --offline → npm run codegen
add a JS-only endpointtools/codegen/endpoints/<family>.yaml (a JS-owned family)npm run codegen
describe a returns-table columnsdv-py's manual_column_descriptions.yaml (vendored here)re-vendor → npm run codegen
label a hand-written exporttools/codegen/utilities.yamlnpm run codegen
record a breaking changetools/codegen/breaking.yaml (+ CHANGELOG.md)npm run codegen
change the runtimesrc/ (never src/generated/)npm run build && npm test

Column descriptions on every returns table resolve through tools/codegen/descriptions.mjs: the schema's own text, then sdv-py's hand-curated manual_column_descriptions.yaml (by schema key, then _global), then the column descriptions mined from the SDV R packages (r_column_descriptions.yaml: the league's package, its sport's siblings, the merged union). npm run codegen prints the fill rate per family and writes docs/src/generated/description_coverage.json.