docs: add OpenAPI responses={} to all router endpoints
Add explicit HTTP status code documentation to every endpoint across 15 router files. Each endpoint now declares all possible response codes (200/201/204/400/401/404/409/429/502/503) with descriptions so frontend can distinguish error types. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -56,6 +56,11 @@ _DEFAULT_RANGE: TimeRange = "24h"
|
||||
"/status",
|
||||
response_model=ServerStatusResponse,
|
||||
summary="Return the cached fail2ban server status",
|
||||
responses={
|
||||
200: {"description": "Server status returned", "model": ServerStatusResponse},
|
||||
401: {"description": "Session missing, expired, or invalid"},
|
||||
502: {"description": "fail2ban unreachable"},
|
||||
},
|
||||
)
|
||||
async def get_server_status(
|
||||
server_status: ServerStatusDep,
|
||||
@@ -84,6 +89,11 @@ async def get_server_status(
|
||||
"/bans",
|
||||
response_model=DashboardBanListResponse,
|
||||
summary="Return a paginated list of recent bans",
|
||||
responses={
|
||||
200: {"description": "Ban list returned", "model": DashboardBanListResponse},
|
||||
401: {"description": "Session missing, expired, or invalid"},
|
||||
502: {"description": "fail2ban unreachable"},
|
||||
},
|
||||
)
|
||||
async def get_dashboard_bans(
|
||||
_auth: AuthDep,
|
||||
@@ -145,6 +155,11 @@ async def get_dashboard_bans(
|
||||
"/bans/by-country",
|
||||
response_model=BansByCountryResponse,
|
||||
summary="Return ban counts aggregated by country",
|
||||
responses={
|
||||
200: {"description": "Ban counts by country returned", "model": BansByCountryResponse},
|
||||
401: {"description": "Session missing, expired, or invalid"},
|
||||
502: {"description": "fail2ban unreachable"},
|
||||
},
|
||||
)
|
||||
async def get_bans_by_country(
|
||||
_auth: AuthDep,
|
||||
@@ -205,6 +220,11 @@ async def get_bans_by_country(
|
||||
"/bans/trend",
|
||||
response_model=BanTrendResponse,
|
||||
summary="Return ban counts aggregated into time buckets",
|
||||
responses={
|
||||
200: {"description": "Ban trend data returned", "model": BanTrendResponse},
|
||||
401: {"description": "Session missing, expired, or invalid"},
|
||||
502: {"description": "fail2ban unreachable"},
|
||||
},
|
||||
)
|
||||
async def get_ban_trend(
|
||||
_auth: AuthDep,
|
||||
@@ -259,6 +279,11 @@ async def get_ban_trend(
|
||||
"/bans/by-jail",
|
||||
response_model=BansByJailResponse,
|
||||
summary="Return ban counts aggregated by jail",
|
||||
responses={
|
||||
200: {"description": "Ban counts by jail returned", "model": BansByJailResponse},
|
||||
401: {"description": "Session missing, expired, or invalid"},
|
||||
502: {"description": "fail2ban unreachable"},
|
||||
},
|
||||
)
|
||||
async def get_bans_by_jail(
|
||||
_auth: AuthDep,
|
||||
|
||||
Reference in New Issue
Block a user