feat(docs): implement swagger ui endpoint for internal api (#6719)

This commit is contained in:
Elian Doran 2025-08-20 21:36:21 +03:00 committed by GitHub
commit 8abd3ed3f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4672 additions and 3 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -8,7 +8,9 @@ import { RESOURCE_DIR } from "../services/resource_dir";
export default function register(app: Application) {
const etapiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "etapi.openapi.yaml"), "utf8")) as JsonObject;
const apiDocument = JSON.parse(readFileSync(join(RESOURCE_DIR, "openapi.json"), "utf-8"));
// Load the comprehensive API documentation from YAML
const apiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "api-openapi.yaml"), "utf8")) as JsonObject;
app.use(
"/etapi/docs/",
@ -24,7 +26,8 @@ export default function register(app: Application) {
swaggerUi.serveFiles(apiDocument),
swaggerUi.setup(apiDocument, {
explorer: true,
customSiteTitle: "TriliumNext Internal API Documentation"
customSiteTitle: "TriliumNext Internal API Documentation",
customCss: '.swagger-ui .topbar { display: none }'
})
);
}