mirror of
https://github.com/zadam/trilium.git
synced 2025-10-09 23:18:46 +08:00
feat(docs): remove old json api docs
This commit is contained in:
parent
05c73011f5
commit
53ed510c92
2 changed files with 3 additions and 12 deletions
File diff suppressed because one or more lines are too long
|
@ -3,22 +3,14 @@ import swaggerUi from "swagger-ui-express";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import yaml from "js-yaml";
|
import yaml from "js-yaml";
|
||||||
import type { JsonObject } from "swagger-ui-express";
|
import type { JsonObject } from "swagger-ui-express";
|
||||||
import { readFileSync, existsSync } from "fs";
|
import { readFileSync } from "fs";
|
||||||
import { RESOURCE_DIR } from "../services/resource_dir";
|
import { RESOURCE_DIR } from "../services/resource_dir";
|
||||||
|
|
||||||
export default function register(app: Application) {
|
export default function register(app: Application) {
|
||||||
const etapiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "etapi.openapi.yaml"), "utf8")) as JsonObject;
|
const etapiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "etapi.openapi.yaml"), "utf8")) as JsonObject;
|
||||||
|
|
||||||
// Load the comprehensive API documentation (YAML) if available, otherwise fall back to JSON
|
// Load the comprehensive API documentation from YAML
|
||||||
const apiYamlPath = join(RESOURCE_DIR, "api-openapi.yaml");
|
const apiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "api-openapi.yaml"), "utf8")) as JsonObject;
|
||||||
const apiJsonPath = join(RESOURCE_DIR, "openapi.json");
|
|
||||||
|
|
||||||
let apiDocument: JsonObject;
|
|
||||||
if (existsSync(apiYamlPath)) {
|
|
||||||
apiDocument = yaml.load(readFileSync(apiYamlPath, "utf8")) as JsonObject;
|
|
||||||
} else {
|
|
||||||
apiDocument = JSON.parse(readFileSync(apiJsonPath, "utf-8"));
|
|
||||||
}
|
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
"/etapi/docs/",
|
"/etapi/docs/",
|
||||||
|
|
Loading…
Add table
Reference in a new issue