You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds GET /v1-alpha/oss-index/groups (IN-1414, epic IN-1146). It returns the OSS Index category groups with their top collections and top projects.
api/src/lib/oss-index.ts holds the shared pieces for the OSS Index routes: guards and mappers that turn the pipe's positional topCollections and topProjects tuples into named objects, their schemas, and the sort query param.
oss-index/groups.ts reads category_groups_oss_index. type filters the groups and sort (totalContributors or softwareValue, default totalContributors) orders them.
Project tuples map their logo slot to logoUrl.
A malformed row or tuple answers 503 upstream_unavailable. An invalid sort answers 400.
Notes
The tuple columns are non-nullable in the pipe, so a null slot counts as a malformed row.
The response is { data: [...] }, matching the leaderboards routes.
The categories and collections endpoints stack on this branch and reuse the shared module.
Tests
tests/oss-index.test.ts: tuple guards and mappers.
tests/oss-index-groups.test.ts: response shape, sort and type forwarding, 400 for an invalid sort, 503 for malformed rows, empty list, and the OpenAPI entry.
Low Risk
New read-only v1-alpha endpoint with input validation and upstream row checks; no changes to auth or mutable data paths.
Overview
Adds GET /v1-alpha/oss-index/groups, a read-only OSS Index API that returns category groups (totals plus nested top collections and projects) from the Tinybird category_groups_oss_index pipe. Optional type filters groups; sort (totalContributors default or softwareValue) is passed through as orderBy. Responses use { data: [...] } like other leaderboard-style routes.
Introduces api/src/lib/oss-index.ts for reuse by future OSS Index endpoints: TypeBox schemas, runtime guards for pipe positional tuples, mappers to named objects (project logo → logoUrl), and shared sort query validation. The route validates full rows and nested tuples; invalid sort returns 400 without calling Tinybird; bad upstream shape returns 503upstream_unavailable.
Vitest coverage exercises tuple guards/mappers and the route (mapping, query forwarding, empty results, OpenAPI tag).
Reviewed by Cursor Bugbot for commit d3e659d. Bugbot is set up for automated code reviews on this repo. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
GET /v1-alpha/oss-index/groups(IN-1414, epic IN-1146). It returns the OSS Index category groups with their top collections and top projects.api/src/lib/oss-index.tsholds the shared pieces for the OSS Index routes: guards and mappers that turn the pipe's positionaltopCollectionsandtopProjectstuples into named objects, their schemas, and thesortquery param.oss-index/groups.tsreadscategory_groups_oss_index.typefilters the groups andsort(totalContributorsorsoftwareValue, defaulttotalContributors) orders them.logoslot tologoUrl.upstream_unavailable. An invalidsortanswers 400.Notes
{ data: [...] }, matching the leaderboards routes.Tests
tests/oss-index.test.ts: tuple guards and mappers.tests/oss-index-groups.test.ts: response shape, sort and type forwarding, 400 for an invalid sort, 503 for malformed rows, empty list, and the OpenAPI entry.main