All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m32s
主要改进: 1. 新增 docs/api-documentation-guide.md 详细文档指南 2. 在 AGENTS.md 中添加路由注册规范章节 3. 更新 README.md 文档目录结构 路由注册改进: - 统一使用 Register() 函数注册路由并自动生成文档 - 所有接口必须指定 RouteSpec(Summary, Tags, Input, Output, Auth) - 修复 docs.go 和 gendocs/main.go 使用 RegisterRoutesWithDoc 统一注册 DTO 规范更新: - shop_dto.go 和 shop_account_dto.go 补充完整的 description 标签 - 所有枚举字段必须列出可能值和中文说明 文档生成优化: - admin-openapi.yaml 自动生成更新 - 健康检查和任务管理接口加入文档 - H5 认证接口完整文档化 规范文档管理: - 添加规范文档管理流程说明 - 详细文档放在 docs/ 目录 - AGENTS.md 只保留核心规则和引导链接
41 lines
988 B
Go
41 lines
988 B
Go
package routes
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
"github.com/break/junhong_cmp_fiber/pkg/openapi"
|
|
"github.com/break/junhong_cmp_fiber/pkg/response"
|
|
)
|
|
|
|
type HealthResponse struct {
|
|
Status string `json:"status" description:"健康状态"`
|
|
Service string `json:"service,omitempty" description:"服务名称"`
|
|
}
|
|
|
|
func registerHealthRoutes(app *fiber.App, doc *openapi.Generator) {
|
|
Register(app, doc, "", "GET", "/health", func(c *fiber.Ctx) error {
|
|
return response.Success(c, fiber.Map{
|
|
"status": "healthy",
|
|
"service": "junhong_cmp_fiber",
|
|
})
|
|
}, RouteSpec{
|
|
Summary: "健康检查",
|
|
Tags: []string{"系统"},
|
|
Input: nil,
|
|
Output: new(HealthResponse),
|
|
Auth: false,
|
|
})
|
|
|
|
Register(app, doc, "", "GET", "/ready", func(c *fiber.Ctx) error {
|
|
return response.Success(c, fiber.Map{
|
|
"status": "ready",
|
|
})
|
|
}, RouteSpec{
|
|
Summary: "就绪检查",
|
|
Tags: []string{"系统"},
|
|
Input: nil,
|
|
Output: new(HealthResponse),
|
|
Auth: false,
|
|
})
|
|
}
|