Files
UHD_Media_Tool/apps/server/src/http/routes/openapi.ts
T
umtandClaude Fable 5.1 b22c440139 chore: scaffold monorepo and migrate uhd_web design system (W0-A)
- pnpm workspace: apps/{web,server}, packages/{contracts,db,domain,adapters,tasks,agent,testkit}
- server: Hono + zod-openapi, API Key auth with scopes, redacting pino logger, SSE event bus with replay, worker heartbeat
- db: Kysely + pg, file migrator, 0001_init (settings/api_key/audit_event/outbox_event)
- web: React Router 7 SPA console shell with 12 workspace placeholders, uhd_web tokens/ui/guard scripts
- docs: ADR-001 (Node over Deno), dev runbook, design system rules

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-27 17:36:26 +08:00

19 lines
661 B
TypeScript

import { swaggerUI } from "@hono/swagger-ui";
import type { OpenAPIHono } from "@hono/zod-openapi";
/** 挂载 /api/openapi.json 与 /api/docs */
// biome-ignore lint/suspicious/noExplicitAny: 根 app 的 Env 泛型各异
export function mountOpenApi(app: OpenAPIHono<any>, version: string) {
app.openAPIRegistry.registerComponent("securitySchemes", "bearerAuth", {
type: "http",
scheme: "bearer",
description: "API Key",
});
app.doc31("/api/openapi.json", {
openapi: "3.1.0",
info: { title: "UHD Media Tool API", version },
security: [{ bearerAuth: [] }],
});
app.get("/api/docs", swaggerUI({ url: "/api/openapi.json" }));
}