template-monorepo/generate/api/normal.api

34 lines
743 B
Plaintext
Raw Normal View History

2026-05-19 11:00:28 +00:00
syntax = "v1"
// 業務 dataLogic returns 型別HTTP 外層 envelope 見 @respdoc
type PingData {
Pong string `json:"pong"`
}
// 文件用:成功回應 envelopecode=0, message=SUCCESS, data=PingData
type PingOKStatus {
Code int64 `json:"code"`
Message string `json:"message"`
Data PingData `json:"data"`
}
@server(
group: normal
prefix: /api/v1
schemes: https
timeout: 3s
)
service gateway {
@doc(
summary: "Ping"
description: "確認伺服器狀態"
)
/*
@respdoc-200 (PingOKStatus) // 成功
@respdoc-400 (APIErrorStatus) // 參數錯誤(如 httpx.Parse / 驗證失敗)
@respdoc-500 (APIErrorStatus) // 系統內部錯誤
*/
@handler ping
get /health () returns (PingData)
}