优化接口基础信息解析 + 支持设置接口是否弃用

This commit is contained in:
2025-02-13 21:57:18 +08:00
parent 45a25e0018
commit e2da9231a1
6 changed files with 107 additions and 22 deletions

View File

@ -37,6 +37,8 @@ type UriBaseConfig struct {
Description string `json:"description"` // 接口详细描述
ParamList []*ParamConfig `json:"param_list"` // 参数列表
ResultList []*ResultConfig `json:"result_list"` // 返回值列表
Deprecated bool `json:"deprecated"` // 是否弃用
OutputStrict bool `json:"output_strict"` // 严格模式
}
// ParamConfig 参数配置

View File

@ -21,4 +21,18 @@ const (
TagDescription = "description"
TagD = "d"
TagDefault = "default"
TagDeprecated = "deprecated"
)
const (
TagNamePath = "path" // 接口的请求路径
TagNameMethod = "method" // 接口的请求方法
TagNameUriTag = "tag" // 接口的tag
TagNameDesc = "desc" // 接口的描述
TagNameOutputStrict = "output_strict" // 接口数据是否为严格模式 : 严格模式, 响应数据必须是结构体/map非严格模式返回任意值
TagNameBinding = "binding" // gin 内置的验证规则tag
TagNameValidate = "validate" // validator v10 默认的验证规则tag
TagNameErrMsg = "err" // 验证失败错误信息tag
TagNameContentType = "content_type"
TagNameOutputContentType = "output_content_type"
)

20
define/uri.go Normal file
View File

@ -0,0 +1,20 @@
// Package define ...
//
// Description : define ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2025-02-13 21:29
package define
// UriConfig 接口基础配置
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 21:29 2025/2/13
type UriConfig struct {
Path string `json:"path"` // 接口路由, 必须配置
RequestMethod string `json:"request_method"` // 接口请求方法, 必须配置
TagList []string `json:"tag_list"` // 接口分组
Desc string `json:"desc"` // 接口描述
}