Skip to content

Commit adeaf06

Browse files
feat: automate OpenAPI spec sync with endpoint filtering (#132)
Adds `scripts/sync-openapi.ts` that fetches upstream `openapi.json` from js-recall main and filters it for public docs. ## Filtering approach Uses **tag-based filtering** to exclude internal endpoints. Operations tagged with blocked tags are removed, and paths that become empty after filtering are excluded entirely. ### Blocked tags - `Admin` - admin endpoints - `User` - user dashboard endpoints - `NFL` - NFL prediction game endpoints ## Implementation details - Uses `@apidevtools/swagger-parser` for robust OpenAPI spec parsing and validation - Source URL configured via `OPENAPI_SOURCE_URL` environment variable - Filters at the operation level, preserving path metadata for remaining operations ## Build pipeline `build:openapi` now runs sync → generate → prettier in sequence.
1 parent 6dc34a4 commit adeaf06

File tree

14 files changed

+470
-242
lines changed

14 files changed

+470
-242
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
OPENAI_API_KEY=your_openai_api_key # Only used for generating embeddings or AI search
22
NEXT_PUBLIC_SITE_URL=https://docs.recall.network # Only for production
3-
NEXT_PUBLIC_GA_ID=your_google_analytics_id # Only for production
3+
NEXT_PUBLIC_GA_ID=your_google_analytics_id # Only for production
4+
OPENAPI_SOURCE_URL=https://raw.githubusercontent.com/recallnet/js-recall/main/apps/api/openapi/openapi.json # Used by sync-openapi script

docs/reference/endpoints/agent.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Agent
3-
description: Agent management endpoints for a single agent to interact with
3+
description: Agent management endpoints
44
full: true
55
_openapi:
66
toc: []

docs/reference/endpoints/agents.mdx

Lines changed: 0 additions & 27 deletions
This file was deleted.

docs/reference/endpoints/arenas.mdx

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/reference/endpoints/auth.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Auth
3-
description: Authentication endpoints for verifying agent wallet ownership
3+
description: Authentication endpoints
44
full: true
55
_openapi:
66
toc: []

docs/reference/endpoints/competition.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
---
22
title: Competition
3-
description: Get information about or interact with a competition
3+
description: Competition endpoints
44
full: true
55
_openapi:
66
toc: []
77
structuredData:
88
headings: []
99
contents:
1010
- content: Get all competitions
11+
- content: >-
12+
Get the competition rules including trading constraints, rate limits, and formulas for a
13+
specific competition
1114
- content: >-
1215
Get detailed information about a specific competition including all metadata
1316
- content: >-
@@ -20,9 +23,6 @@ _openapi:
2023
2124
while preserving historical participation data. Note: Cannot leave competitions that have
2225
already ended.
23-
- content: >-
24-
Get the competition rules including trading constraints, rate limits, and formulas for a
25-
specific competition
2626
- content: Get the timeline for all agents in a competition
2727
- content: >-
2828
Get all trades for a specific competition. Only available for paper trading competitions.
@@ -50,11 +50,11 @@ _openapi:
5050
document={"specs/competitions.json"}
5151
operations={[
5252
{ path: "/api/competitions", method: "get" },
53+
{ path: "/api/competitions/{competitionId}/rules", method: "get" },
5354
{ path: "/api/competitions/{competitionId}", method: "get" },
5455
{ path: "/api/competitions/{competitionId}/agents", method: "get" },
5556
{ path: "/api/competitions/{competitionId}/agents/{agentId}", method: "post" },
5657
{ path: "/api/competitions/{competitionId}/agents/{agentId}", method: "delete" },
57-
{ path: "/api/competitions/{competitionId}/rules", method: "get" },
5858
{ path: "/api/competitions/{competitionId}/timeline", method: "get" },
5959
{ path: "/api/competitions/{competitionId}/trades", method: "get" },
6060
{ path: "/api/competitions/{competitionId}/agents/{agentId}/trades", method: "get" },

docs/reference/endpoints/health.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Health
3-
description: Health check endpoints to ensure the API is running
3+
description: Health check endpoints
44
full: true
55
_openapi:
66
toc: []

docs/reference/endpoints/leaderboard.mdx

Lines changed: 0 additions & 27 deletions
This file was deleted.

docs/reference/endpoints/price.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Price
3-
description: Price information endpoints for fetching token prices
3+
description: Price information endpoints
44
full: true
55
_openapi:
66
method: GET

docs/reference/endpoints/trade.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Trade
3-
description: Trading endpoints for executing trades as part of a competition
3+
description: Trading endpoints
44
full: true
55
_openapi:
66
toc: []

0 commit comments

Comments
 (0)