From 6777f423d8b81f27dfe684b53f698664ce634340 Mon Sep 17 00:00:00 2001 From: seb Date: Sun, 4 Oct 2026 20:47:16 +0200 Subject: [PATCH] u --- .cursor/rules/sibling-repos.mdc | 3 ++- AGENTS.md | 2 +- README.md | 2 +- scripts/generateApiDocs.js | 8 +++++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.cursor/rules/sibling-repos.mdc b/.cursor/rules/sibling-repos.mdc index 2bfc55f..3347a81 100644 --- a/.cursor/rules/sibling-repos.mdc +++ b/.cursor/rules/sibling-repos.mdc @@ -30,8 +30,9 @@ Wenn ein Vertrag unklar oder fehlt: **nicht weiterwursteln**. Human fragen, Vors | Repo | Pfad | Inhalt | |------|------|--------| | **dieses** | `docs/api/README.md` | HTTP-Routen, Auth, CORS | +| **dieses** | `docs/api/routes.md`, `docs/api/routes-all.md` | Endpoint-Übersicht | | **dieses** | `docs/api/routes/` | eine Markdown-Datei pro Endpoint | -| **dieses** | `docs/api/openapi.json` | maschinenlesbare Spec | +| **dieses** | `/docs/` (lokal) | interaktive Swagger-UI; Spec wird zur Laufzeit aus den `@openapi`-JSDoc gebaut (`src/api/openapiSpec.js`) — es gibt bewusst **keine** `openapi.json` auf Disk | | dashdbschema | `../dashdbschema/README.md` | Store-Übersicht, Konventionen, HTTP-Mapping | | dashdbschema | `../dashdbschema/API.md` | Store-API-Index (TOC → `API..md`) | | dashdbschema | `../dashdbschema/API..md` | pro Namespace (`entity`, `article`, …): Methoden, Signaturen, JSDoc-Beispiele | diff --git a/AGENTS.md b/AGENTS.md index f19c72b..f88ca84 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -18,7 +18,7 @@ ESM (`type: module`), Express 5, Node. Depends on `libdashstore` via `file:../da ```bash cp .env.example .env && npm install npm start # PORT 4208 (HTTPS 8443) -npm run docs:api # regenerates docs/api/routes.md + docs/api/routes-all.md + docs/api/routes/ + openapi.json +npm run docs:api # regenerates docs/api/routes.md + docs/api/routes-all.md + docs/api/routes/ (no openapi.json on disk — /docs/ builds it live) npm run manage-users # email allowlist ``` diff --git a/README.md b/README.md index d2bbfbc..3fec1cb 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Docs are generated from `@openapi` JSDoc on route handlers: npm run docs:api ``` -That writes `docs/api/routes.md`, `docs/api/routes-all.md`, and per-route Markdown under `docs/api/routes/`. +That writes `docs/api/routes.md`, `docs/api/routes-all.md`, and per-route Markdown under `docs/api/routes/`. There is no generated `openapi.json` on disk — the interactive Swagger UI at `/docs/` builds the spec from the same `@openapi` JSDoc at runtime (`src/api/openapiSpec.js`). ### Brands (company-scoped, `selectedCompanyId` aus der Session) diff --git a/scripts/generateApiDocs.js b/scripts/generateApiDocs.js index ab3340d..163dad8 100644 --- a/scripts/generateApiDocs.js +++ b/scripts/generateApiDocs.js @@ -1,5 +1,7 @@ /** - * Code-first API docs: scan `@openapi` JSDoc in routes → OpenAPI JSON + Markdown under docs/api/. + * Code-first API docs: scan `@openapi` JSDoc in routes → Markdown under docs/api/. + * The OpenAPI JSON is NOT written to disk; the interactive docs at /docs/ build it from + * source at runtime via getOpenApiSpec() (src/api/openapiSpec.js). * * Usage: npm run docs:api */ @@ -768,6 +770,6 @@ fs.writeFileSync( ); fs.writeFileSync(path.join(docsDir, 'routes-all.md'), renderRoutesOverview(operations, 'Dash API Routes Overview (All)')); fs.writeFileSync(path.join(docsDir, 'README.md'), renderReadme(operations)); -fs.writeFileSync(path.join(docsDir, 'openapi.json'), JSON.stringify(spec, null, 2)); -console.log(`Wrote ${operations.length} route docs + ${overviewOperations.length} in routes.md + ${operations.length} in routes-all.md + openapi.json → docs/api/`); +console.log(`Wrote ${operations.length} route docs + ${overviewOperations.length} in routes.md + ${operations.length} in routes-all.md → docs/api/`); +console.log('No openapi.json written — the interactive docs at /docs/ build it from source at runtime.');