Phase 10: Fix API documentation routing and add schema download link
- Fix /docs/api route to go directly to API docs page instead of redirecting - Fix docs.ts link to point to /compete/docs/api instead of itself - Add download button for replay-schema-v1.json in API docs - Reorder router routes to ensure /docs/api is matched before /docs The API documentation at /docs/api now correctly shows the OpenAPI-style endpoint documentation for all static JSON file paths on Pages, R2, and B2, including the versioned replay format specification. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
c5557016cd
commit
bc857d10bc
4 changed files with 5 additions and 3 deletions
|
|
@ -1 +1 @@
|
|||
02338375440c4ead8fd7156f034ee29a334daef3
|
||||
5024353c1e10455091d07cadbec2fd5be4c69ba4
|
||||
|
|
|
|||
|
|
@ -272,8 +272,8 @@ router
|
|||
.on('/sandbox', redirect('/compete/sandbox'))
|
||||
.on('/register', redirect('/compete/register'))
|
||||
.on('/bots', redirect('/leaderboard'))
|
||||
.on('/docs/api', lazyRoute(loadDocsApiPage))
|
||||
.on('/docs', redirect('/compete/docs'))
|
||||
.on('/docs/api', redirect('/compete/docs'))
|
||||
.on('/clip-maker', redirect('/watch/replays'))
|
||||
.on('/rivalries', lazyRoute(loadRivalriesPage))
|
||||
.on('/feedback', lazyRoute(loadFeedbackPage))
|
||||
|
|
|
|||
|
|
@ -489,6 +489,8 @@ export function renderDocsApiPage(): void {
|
|||
<section id="replay-schema" class="schema-section">
|
||||
<h2>Replay JSON Schema</h2>
|
||||
<p>The replay format is versioned. The current version is <code>v1</code>.</p>
|
||||
<p><a href="/replay-schema-v1.json" target="_blank" class="btn secondary">Download replay-schema-v1.json</a></p>
|
||||
<p>The schema can be used with JSON Schema validators to ensure replay files conform to the expected format.</p>
|
||||
<pre><code>${escapeHtml(replaySchema)}</code></pre>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ export function renderDocsPage(): void {
|
|||
<section>
|
||||
<h2>Data & API</h2>
|
||||
<p>All match data (leaderboards, replays, bot profiles) is exposed as static JSON files served from CDN.</p>
|
||||
<p><a href="#/compete/docs" class="btn secondary">View API Reference</a></p>
|
||||
<p><a href="#/compete/docs/api" class="btn secondary">View API Reference</a></p>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue