commit 45051f461de9ffc001a4b4a17c3174a214ae476b Author: eddy Date: Thu Mar 5 18:27:44 2026 +0100 api diff --git a/README.md b/README.md new file mode 100644 index 0000000..1315b3d --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Meine API-Dokumentation + +Diese Repository enthält eine interaktive API-Dokumentation mit Redoc für Gitea Pages. + +## Deployment + +1. Repository auf Gitea erstellen. +2. Dateien (`index.html` + `openapi.yaml`) hochladen. +3. Gitea Pages aktivieren: + - Branch: `main` + - Ordner: `/` (Root) +4. URL aufrufen: https:////pages/ \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..038fb7b --- /dev/null +++ b/index.html @@ -0,0 +1,18 @@ + + + + + Meine API-Dokumentation + + + + +
+

Meine API-Dokumentation

+
+ + + \ No newline at end of file diff --git a/openapi.yaml b/openapi.yaml new file mode 100644 index 0000000..e7eced5 --- /dev/null +++ b/openapi.yaml @@ -0,0 +1,221 @@ +openapi: 3.0.3 +info: + title: Example API + version: 1.0.0 + description: API für Auth, News und Attractions + +servers: + - url: http://localhost:8080 + +components: + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + + schemas: + LoginRequest: + type: object + required: + - email + - password + properties: + email: + type: string + example: user@example.com + password: + type: string + example: password123 + + RegisterRequest: + type: object + required: + - email + - password + - nickname + properties: + email: + type: string + password: + type: string + nickname: + type: string + + LoginResponse: + type: object + properties: + token: + type: string + example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... + + NewsDto: + type: object + properties: + id: + type: integer + example: 1 + title: + type: string + example: Neue Attraktion eröffnet + description: + type: string + example: Beschreibung der News + releaseDate: + type: string + format: date-time + picture: + type: string + example: https://example.com/image.jpg + author: + type: string + example: Admin + category: + type: string + example: Update + + AttractionDto: + type: object + properties: + id: + type: integer + example: 1 + title: + type: string + example: Achterbahn X + description: + type: string + example: Schnellste Achterbahn + pictures: + type: array + items: + type: string + address: + type: string + example: Parkstraße 1 + +paths: + + /auth/login: + post: + summary: Login + description: Gibt ein Bearer Token zurück + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/LoginRequest' + responses: + "200": + description: Erfolgreicher Login + content: + application/json: + schema: + $ref: '#/components/schemas/LoginResponse' + + /auth/register: + post: + summary: Registrierung + description: Erstellt einen neuen Benutzer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RegisterRequest' + responses: + "200": + description: Registrierung erfolgreich + + /public: + get: + summary: Public Endpoint + responses: + "200": + description: OK + + /public/news: + get: + summary: Alle News + description: Liefert alle News zurück (Vorsicht bei vielen Einträgen) + responses: + "200": + description: Liste aller News + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/NewsDto' + + /public/news/{id}: + get: + summary: News nach ID + parameters: + - name: id + in: path + required: true + schema: + type: integer + responses: + "200": + description: News gefunden + content: + application/json: + schema: + $ref: '#/components/schemas/NewsDto' + "404": + description: News nicht gefunden + + /public/news/newest/{amount}: + get: + summary: Neueste News + parameters: + - name: amount + in: path + required: true + schema: + type: integer + example: 5 + responses: + "200": + description: Liste der neuesten News + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/NewsDto' + + /public/attraction: + get: + summary: Alle Attractions + responses: + "200": + description: Liste aller Attractions + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/AttractionDto' + + /public/attraction/{id}: + get: + summary: Attraction nach ID + parameters: + - name: id + in: path + required: true + schema: + type: integer + responses: + "200": + description: Attraction gefunden + content: + application/json: + schema: + $ref: '#/components/schemas/AttractionDto' + "404": + description: Attraction nicht gefunden \ No newline at end of file