2024-08-14 15:43:22 +08:00
|
|
|
// Package define ...
|
|
|
|
//
|
|
|
|
// Description : define ...
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 2024-08-14 15:20
|
|
|
|
package define
|
|
|
|
|
2024-12-24 11:18:15 +08:00
|
|
|
import "regexp"
|
|
|
|
|
2024-12-24 10:34:28 +08:00
|
|
|
// DocParseResult 文档解析结果
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 10:30 2024/12/24
|
|
|
|
type DocParseResult struct {
|
2024-12-24 11:18:15 +08:00
|
|
|
Domain string `json:"domain"` // 域名
|
|
|
|
Title string `json:"title"` // 标题
|
|
|
|
Description string `json:"description"` // 描述
|
|
|
|
UriList []*UriBaseConfig `json:"uri_list"` // 接口列表
|
2024-12-24 10:34:28 +08:00
|
|
|
}
|
|
|
|
|
2024-08-14 15:43:22 +08:00
|
|
|
// UriBaseConfig 添加接口时的基础配置
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 15:21 2024/8/14
|
|
|
|
type UriBaseConfig struct {
|
2024-12-24 12:11:17 +08:00
|
|
|
Uri string `json:"uri"` // 接口路由
|
|
|
|
Method string `json:"method"` // 接口请求方法
|
|
|
|
ContentType string `json:"content_type"` // 接口请求类型
|
|
|
|
OutputContentType string `json:"output_content_type"` // 输出数据类型
|
|
|
|
TagList []string `json:"tag_list"` // 接口标签列表
|
|
|
|
Summary string `json:"summary"` // 接口摘要描述
|
|
|
|
Description string `json:"description"` // 接口详细描述
|
|
|
|
ParamList []*ParamConfig `json:"param_list"` // 参数列表
|
|
|
|
ResultList []*ResultConfig `json:"result_list"` // 返回值列表
|
2024-08-14 15:43:22 +08:00
|
|
|
}
|
2024-08-19 16:32:51 +08:00
|
|
|
|
|
|
|
// ParamConfig 参数配置
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 16:23 2024/8/19
|
|
|
|
type ParamConfig struct {
|
|
|
|
Location string `json:"location"` // 参数位置
|
|
|
|
Path string `json:"path"` // 参数路径
|
|
|
|
Type string `json:"type"` // 参数类型
|
|
|
|
Title string `json:"title"` // 参数标题
|
|
|
|
Description string `json:"description"` // 参数描述
|
2024-12-24 12:33:50 +08:00
|
|
|
Required bool `json:"required"` // 是否必传
|
2024-08-19 16:32:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// ResultConfig 返回值配置
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 16:23 2024/8/19
|
|
|
|
type ResultConfig struct {
|
|
|
|
Location string `json:"location"` // 返回值位置
|
|
|
|
Path string `json:"path"` // 返回值路径
|
|
|
|
Type string `json:"type"` // 返回值类型
|
|
|
|
Title string `json:"title"` // 返回值标题
|
|
|
|
Description string `json:"description"` // 返回值描述
|
|
|
|
}
|
2024-12-24 11:18:15 +08:00
|
|
|
|
|
|
|
var (
|
|
|
|
UriParamRegexp = regexp.MustCompile("({.*?})") // uri路径中参数提取的正则表达式
|
|
|
|
)
|