Move Swagger entry into Help
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user