优化结构体定义

This commit is contained in:
2024-12-24 12:11:17 +08:00
parent 9df646324f
commit ff2fa198ee
4 changed files with 101 additions and 11 deletions

View File

@ -27,14 +27,15 @@ type DocParseResult struct {
//
// Date : 15:21 2024/8/14
type UriBaseConfig struct {
Uri string `json:"uri"` // 接口路由
Method string `json:"method"` // 接口请求方法
ContentType string `json:"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"` // 返回值列表
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"` // 返回值列表
}
// ParamConfig 参数配置
@ -48,6 +49,7 @@ type ParamConfig struct {
Type string `json:"type"` // 参数类型
Title string `json:"title"` // 参数标题
Description string `json:"description"` // 参数描述
IsRequired bool `json:"is_required"` // 是否必传
}
// ResultConfig 返回值配置

View File

@ -15,6 +15,8 @@ package define
type SwaggerPathConfig struct {
Description string `json:"description"` // 接口描述
Consumes []string `json:"consumes"` // 请求方式, application/json等
Produces []string `json:"produces"` // 请求方式, application/json等
OperationID string `json:"operationId"` // 操作ID
Tags []string `json:"tags"` // 接口标签
Summary string `json:"summary"` // 接口摘要
Parameters []*SwaggerPathConfigParameter `json:"parameters"` // 参数列表
@ -76,6 +78,8 @@ type SwaggerDefinitionProperty struct {
Type string `json:"type"` // 类型
Items map[string]string `json:"items,omitempty"` // 引用类型中的引用(数组)
AllOf []map[string]string `json:"allOf,omitempty"` // 引用类型中的引用(对象)
XGoName string `json:"x-go-name"` // go字段名称
XGoPackage string `json:"x-go-package"` // go 包路径
}
// Swagger 文档整体结构定义