{
  "openapi": "3.0.3",
  "info": {
    "title": "食安健康检查响应契约修复",
    "version": "2026-09-24"
  },
  "servers": [
    {
      "url": "http://127.0.0.1:3300"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "tags": ["公共与系统"],
        "operationId": "HealthController_ping",
        "summary": "HealthController.ping",
        "responses": {
          "200": {
            "description": "网关健康检查成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/health/db": {
      "get": {
        "tags": ["公共与系统"],
        "operationId": "DbHealthController_health",
        "summary": "DbHealthController.health",
        "responses": {
          "200": {
            "description": "数据库健康检查完成",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DbHealthEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/health/routes": {
      "get": {
        "tags": ["公共与系统"],
        "operationId": "RoutesController_list",
        "summary": "RoutesController.list",
        "responses": {
          "200": {
            "description": "网关路由清单",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutesEnvelope"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "BaseEnvelope": {
        "type": "object",
        "required": ["code", "message", "data"],
        "properties": {
          "code": { "type": "integer", "example": 200 },
          "message": { "type": "string", "example": "OK" },
          "data": { "type": "object" }
        }
      },
      "HealthEnvelope": {
        "allOf": [
          { "$ref": "#/components/schemas/BaseEnvelope" },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "required": ["ok", "service", "time", "timestamp", "timezone"],
                "properties": {
                  "ok": { "type": "boolean", "example": true },
                  "service": { "type": "string", "example": "gateway-service" },
                  "time": { "type": "string", "example": "2026-09-24 17:57:33" },
                  "timestamp": { "type": "integer", "format": "int64" },
                  "timezoneOffsetMinutes": { "type": "integer", "example": -480 },
                  "timezone": { "type": "string", "example": "Asia/Shanghai" }
                }
              }
            }
          }
        ]
      },
      "DbHealthEnvelope": {
        "allOf": [
          { "$ref": "#/components/schemas/BaseEnvelope" },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "required": ["ok"],
                "properties": {
                  "ok": { "type": "boolean", "example": true },
                  "error": { "type": "string" }
                }
              }
            }
          }
        ]
      },
      "RoutesEnvelope": {
        "allOf": [
          { "$ref": "#/components/schemas/BaseEnvelope" },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "required": ["ok", "count", "routes"],
                "properties": {
                  "ok": { "type": "boolean", "example": true },
                  "count": { "type": "integer", "minimum": 0, "example": 572 },
                  "routes": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": ["method", "path"],
                      "properties": {
                        "method": { "type": "string", "example": "GET" },
                        "path": { "type": "string", "example": "/health" }
                      }
                    }
                  }
                }
              }
            }
          }
        ]
      }
    }
  }
}
