Swagger/OpenAPI-Doku unter /api-docs, Link im Footer, keine Überschneidung mit API-Endpunkten

This commit is contained in:
2025-07-25 12:14:22 +02:00
parent 77a6b5c2c2
commit d24f93d039
4 changed files with 256 additions and 0 deletions

223
static/swagger.json Normal file
View File

@@ -0,0 +1,223 @@
{
"openapi": "3.0.3",
"info": {
"title": "Elpatrons Datumsrechner API",
"version": "1.0.0",
"description": "REST-API für Datumsberechnungen."
},
"servers": [
{ "url": "/api" }
],
"paths": {
"/tage_werktage": {
"post": {
"summary": "Berechnet die Anzahl der Tage oder Werktage zwischen zwei Daten.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"start": { "type": "string", "format": "date" },
"end": { "type": "string", "format": "date" },
"werktage": { "type": "boolean", "default": false }
},
"required": ["start", "end"]
}
}
}
},
"responses": {
"200": {
"description": "Ergebnis der Berechnung.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result": { "type": "integer" }
}
}
}
}
},
"400": { "description": "Ungültige Eingabe" }
}
}
},
"/wochentag": {
"post": {
"summary": "Gibt den Wochentag zu einem Datum zurück.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"datum": { "type": "string", "format": "date" }
},
"required": ["datum"]
}
}
}
},
"responses": {
"200": {
"description": "Wochentag als Text.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result": { "type": "string" }
}
}
}
}
},
"400": { "description": "Ungültige Eingabe" }
}
}
},
"/kw_berechnen": {
"post": {
"summary": "Berechnet die Kalenderwoche zu einem Datum.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"datum": { "type": "string", "format": "date" }
},
"required": ["datum"]
}
}
}
},
"responses": {
"200": {
"description": "Kalenderwoche und Jahr.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result": { "type": "string" },
"kw": { "type": "integer" },
"jahr": { "type": "integer" }
}
}
}
}
},
"400": { "description": "Ungültige Eingabe" }
}
}
},
"/kw_datum": {
"post": {
"summary": "Berechnet Start- und Enddatum einer Kalenderwoche.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"jahr": { "type": "integer" },
"kw": { "type": "integer" }
},
"required": ["jahr", "kw"]
}
}
}
},
"responses": {
"200": {
"description": "Start- und Enddatum der Kalenderwoche.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result": { "type": "string" },
"start": { "type": "string", "format": "date" },
"end": { "type": "string", "format": "date" }
}
}
}
}
},
"400": { "description": "Ungültige Eingabe" }
}
}
},
"/plusminus": {
"post": {
"summary": "Berechnet ein Datum plus/minus X Tage, Wochen oder Monate.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"datum": { "type": "string", "format": "date" },
"anzahl": { "type": "integer" },
"einheit": { "type": "string", "enum": ["tage", "wochen", "monate"] },
"richtung": { "type": "string", "enum": ["add", "sub"], "default": "add" },
"werktage": { "type": "boolean", "default": false }
},
"required": ["datum", "anzahl", "einheit"]
}
}
}
},
"responses": {
"200": {
"description": "Berechnetes Datum.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result": { "type": "string", "format": "date" }
}
}
}
}
},
"400": { "description": "Ungültige Eingabe" }
}
}
},
"/monitor": {
"get": {
"summary": "Status- und Monitoring-Informationen zur App.",
"responses": {
"200": {
"description": "Status-Objekt mit Uptime und Pageviews.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": { "type": "string" },
"message": { "type": "string" },
"time": { "type": "string", "format": "date-time" },
"uptime_seconds": { "type": "integer" },
"pageviews_last_7_days": { "type": "integer" }
}
}
}
}
}
}
}
}
}
}