Move Swagger entry into Help

This commit is contained in:
mmckeen
2026-04-28 15:57:21 +00:00
parent 9317a2bf7b
commit 5dfd88a1c7
3 changed files with 37 additions and 17 deletions
+6 -2
View File
@@ -4,11 +4,12 @@ import path from 'node:path'
const root = process.cwd()
const [specSource, routeSource, pageSource, sidebarSource] = await Promise.all([
const [specSource, routeSource, pageSource, sidebarSource, helpSource] = await Promise.all([
readFile(path.join(root, 'app/lib/openapiSpec.ts'), 'utf8'),
readFile(path.join(root, 'app/api/openapi/route.ts'), 'utf8'),
readFile(path.join(root, 'app/swagger/page.tsx'), 'utf8'),
readFile(path.join(root, 'app/components/Sidebar.tsx'), 'utf8'),
readFile(path.join(root, 'app/components/HelpPanel.tsx'), 'utf8'),
])
assert.match(specSource, /openapi:\s*"3\.1\.0"/, 'OpenAPI spec must declare version 3.1.0')
@@ -21,6 +22,9 @@ assert.match(routeSource, /buildOpenApiSpec/, 'OpenAPI API route must return gen
assert.match(pageSource, /OpenAPI JSON/, 'Swagger page must link to the JSON spec')
assert.match(pageSource, /Endpoints/, 'Swagger page must render endpoint docs')
assert.match(pageSource, /Schemas/, 'Swagger page must render schema docs')
assert.match(sidebarSource, /href="\/swagger"/, 'sidebar must link to Swagger page')
assert.doesNotMatch(sidebarSource, /href="\/swagger"/, 'Swagger must not be a top-level sidebar item')
assert.match(helpSource, /API Reference/, 'Help must expose an API reference section')
assert.match(helpSource, /href="\/swagger"/, 'Help must link to the Swagger page')
assert.match(helpSource, /target="_blank"/, 'Help must open Swagger in a separate page')
console.log('swagger-openapi-check: PASS swagger/openapi assertions')