This commit is contained in:
seb
2026-10-04 20:47:16 +02:00
parent d56b3e5c23
commit 6777f423d8
4 changed files with 9 additions and 6 deletions

View File

@@ -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.<modul>.md`) |
| dashdbschema | `../dashdbschema/API.<modul>.md` | pro Namespace (`entity`, `article`, …): Methoden, Signaturen, JSDoc-Beispiele |

View File

@@ -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
```

View File

@@ -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)

View File

@@ -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.');