Files
api-doku/openapi.yaml
2026-03-05 18:27:44 +01:00

221 lines
4.8 KiB
YAML

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