Refactor health check API to include OpenAPI tagging and enhance HealthInfo schema documentation

This commit is contained in:
GW_MC
2025-12-05 18:17:29 +08:00
parent 8875122e1b
commit 81fbf8281f
3 changed files with 45 additions and 25 deletions

View File

@@ -12,22 +12,11 @@
"/api/health/info": {
"get": {
"tags": [
"crate::routes::api::health::info"
"Health"
],
"summary": "Health check endpoint",
"description": "Returns the health status, version, uptime, and any errors if unhealthy.",
"operationId": "get_health_info",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Pet database id to get Pet for",
"required": true,
"schema": {
"type": "integer",
"format": "int64",
"minimum": 0
}
}
],
"responses": {
"200": {
"description": "Health information retrieved successfully",
@@ -50,6 +39,7 @@
"schemas": {
"HealthInfo": {
"type": "object",
"description": "System health information",
"required": [
"status",
"version",
@@ -63,20 +53,30 @@
],
"items": {
"type": "string"
}
},
"description": "List of error messages if unhealthy"
},
"status": {
"type": "string"
"type": "string",
"description": "Health status: \"healthy\" or \"unhealthy\""
},
"up_since": {
"type": "string",
"format": "date-time"
"format": "date-time",
"description": "RFC 3339 formatted timestamp"
},
"version": {
"type": "string"
"type": "string",
"description": "Application version"
}
}
}
}
}
},
"tags": [
{
"name": "Health",
"description": "Health information API"
}
]
}