API Overview System
Purpose
This document explains how API overview pages and descriptions are managed.
Two-Tier Approach
- Basic descriptions in
swagger_files/markdown_descriptions/descriptions.json→ synced to OpenAPI specs - Rich markdown content in
swagger_files/markdown_descriptions/*.md→ converted to overview MDX pages
Why Not Inject Into Swagger Before Generation?
OpenAPI tag.description fields are limited to plain text/basic markdown and cannot use:
- Docusaurus admonitions (
:::note,:::warning) - React components
- Complex formatting
- Internal links with proper routing
The current approach gives us both OpenAPI compatibility AND documentation flexibility.
File Structure
swagger_files/
├── v2/{api}.json # OpenAPI specs with basic tag descriptions
└── markdown_descriptions/
├── descriptions.json # Tag-level descriptions for OpenAPI specs
└── {api}.md # Rich markdown for documentation overview pages
Build Process
-
Validation & Sync (
update-v2-descriptions.js)- Validates all APIs have markdown files
- Syncs basic descriptions to OpenAPI specs
-
Docusaurus Generation
yarn docusaurus gen-api-docs all- Generates MDX files from OpenAPI specs
-
Overview Pages (
generate-overview-pages.js)- Creates
{api}-overview.mdxfiles from markdown - Positioned first in each API category
- Creates
-
Post-Processing (
update-v2-descriptions.js)- Updates titles, labels, frontmatter
- Injects markdown content into MDX files
Adding a New API
- Create
swagger_files/v2/{api}.json - Add entry to
swagger_files/markdown_descriptions/descriptions.json - Create
swagger_files/markdown_descriptions/{api}.md - Run build:
bash rundocs.sh
Scripts
scripts/update-v2-descriptions.js- Main script (validation, sync, MDX updates)scripts/generate-overview-pages.js- Creates overview MDX filesscripts/main.js- Build orchestration
Troubleshooting
"No markdown file found" error:
Create {api}.md in markdown_descriptions/
"Orphaned markdown file" warning: Either add the missing OpenAPI spec or remove the markdown file
Overview page not appearing:
Clear cache: yarn docusaurus clear and rebuild