feat: add OpenAPI documentation with Swagger UI

- Install payload-oapi plugin for automatic API documentation
- Configure OpenAPI 3.1 specification at /api/openapi.json
- Add Swagger UI interface at /api/docs
- Update documentation with new API endpoints

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Martin Porwoll 2025-12-10 15:14:13 +00:00
parent 3ca2bc6fb5
commit 1005b1c52a
5 changed files with 383 additions and 195 deletions

View file

@ -218,6 +218,8 @@ PGPASSWORD=Finden55 psql -h 10.10.181.101 -U payload -d payload_db -c "\dt *_loc
- **Admin Panel:** https://pl.c2sgmbh.de/admin - **Admin Panel:** https://pl.c2sgmbh.de/admin
- **API:** https://pl.c2sgmbh.de/api - **API:** https://pl.c2sgmbh.de/api
- **API-Dokumentation (Swagger UI):** https://pl.c2sgmbh.de/api/docs
- **OpenAPI JSON:** https://pl.c2sgmbh.de/api/openapi.json
- **E-Mail API:** https://pl.c2sgmbh.de/api/send-email (POST, Auth erforderlich) - **E-Mail API:** https://pl.c2sgmbh.de/api/send-email (POST, Auth erforderlich)
- **Test-E-Mail:** https://pl.c2sgmbh.de/api/test-email (POST, Admin erforderlich) - **Test-E-Mail:** https://pl.c2sgmbh.de/api/test-email (POST, Admin erforderlich)
- **E-Mail Stats:** https://pl.c2sgmbh.de/api/email-logs/stats (GET, Auth erforderlich) - **E-Mail Stats:** https://pl.c2sgmbh.de/api/email-logs/stats (GET, Auth erforderlich)

View file

@ -445,7 +445,10 @@
- [ ] TypeScript Strict Mode aktivieren - [ ] TypeScript Strict Mode aktivieren
- [ ] Unit Tests für Access Control - [ ] Unit Tests für Access Control
- [ ] E2E Tests für kritische Flows - [ ] E2E Tests für kritische Flows
- [ ] API-Dokumentation automatisch generieren (OpenAPI) - [x] API-Dokumentation automatisch generieren (OpenAPI) (Erledigt: 10.12.2025)
- [x] payload-oapi Plugin installiert und konfiguriert
- [x] OpenAPI 3.1 Spezifikation unter `/api/openapi.json`
- [x] Swagger UI unter `/api/docs`
- [ ] Code-Review für Security-relevante Bereiche - [ ] Code-Review für Security-relevante Bereiche
- [ ] Performance-Audit der Datenbank-Queries - [ ] Performance-Audit der Datenbank-Queries
@ -516,7 +519,7 @@
--- ---
*Letzte Aktualisierung: 09.12.2025* *Letzte Aktualisierung: 10.12.2025*
--- ---
@ -534,6 +537,9 @@
### 10.12.2025 ### 10.12.2025
- **Audit-Fixes:** Vitest auf 3.2.4 aktualisiert, Payload-Mocks im Security-Test ergänzt - **Audit-Fixes:** Vitest auf 3.2.4 aktualisiert, Payload-Mocks im Security-Test ergänzt
- **OpenAPI-Dokumentation:** payload-oapi Plugin für automatische API-Dokumentation
- OpenAPI 3.1 Spezifikation unter `/api/openapi.json`
- Swagger UI unter `/api/docs`
### 09.12.2025 (Fortsetzung) ### 09.12.2025 (Fortsetzung)
- **Full-Text-Search:** PostgreSQL FTS mit GIN-Indexes aktiviert - **Full-Text-Search:** PostgreSQL FTS mit GIN-Indexes aktiviert

View file

@ -37,12 +37,13 @@
"dotenv": "16.4.7", "dotenv": "16.4.7",
"graphql": "^16.8.1", "graphql": "^16.8.1",
"ioredis": "^5.8.2", "ioredis": "^5.8.2",
"next": "15.4.7", "next": "15.4.8",
"node-cron": "^4.2.1", "node-cron": "^4.2.1",
"nodemailer": "^7.0.11", "nodemailer": "^7.0.11",
"payload": "3.65.0", "payload": "3.65.0",
"react": "19.1.0", "payload-oapi": "^0.2.5",
"react-dom": "19.1.0", "react": "19.2.1",
"react-dom": "19.2.1",
"sharp": "0.34.2" "sharp": "0.34.2"
}, },
"devDependencies": { "devDependencies": {

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,7 @@ import { seoPlugin } from '@payloadcms/plugin-seo'
import { nestedDocsPlugin } from '@payloadcms/plugin-nested-docs' import { nestedDocsPlugin } from '@payloadcms/plugin-nested-docs'
import { formBuilderPlugin } from '@payloadcms/plugin-form-builder' import { formBuilderPlugin } from '@payloadcms/plugin-form-builder'
import { redirectsPlugin } from '@payloadcms/plugin-redirects' import { redirectsPlugin } from '@payloadcms/plugin-redirects'
import { openapi, swaggerUI } from 'payload-oapi'
import { de } from '@payloadcms/translations/languages/de' import { de } from '@payloadcms/translations/languages/de'
import { en } from '@payloadcms/translations/languages/en' import { en } from '@payloadcms/translations/languages/en'
import path from 'path' import path from 'path'
@ -259,5 +260,20 @@ export default buildConfig({
}, },
}, },
}), }),
// OpenAPI Documentation
openapi({
openapiVersion: '3.1',
metadata: {
title: 'Payload CMS API',
version: '1.0.0',
description: 'Multi-Tenant CMS API für porwoll.de, complexcaresolutions.de, gunshin.de und zweitmein.ng',
contact: {
name: 'C2S GmbH',
url: 'https://complexcaresolutions.de',
},
},
}),
// Swagger UI unter /api/docs
swaggerUI({}),
], ],
}) })