Compare commits
13 Commits
66e5b00562
...
master
Author | SHA1 | Date | |
---|---|---|---|
259b89656a | |||
37a980afc3 | |||
66d115847a | |||
03d10208ec | |||
a3b0c5f701 | |||
90ca1f853f | |||
bac8242f5e | |||
14e56e4caf | |||
e02098e643 | |||
de49c7e1d6 | |||
9a881e3bf2 | |||
5afe9bed09 | |||
0899ad9fe6 |
54
common.go
54
common.go
@ -9,9 +9,11 @@ package api_doc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.zhangdeman.cn/gateway/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"strings"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/enums"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
)
|
||||
|
||||
// GetUriPathParamList 获取uri参数列表
|
||||
@ -47,25 +49,35 @@ func GetUriPathParamList(uriPath string) []*define.ParamConfig {
|
||||
// Date : 11:52 2024/12/24
|
||||
func GetDataType(docParamType string, formatType string) string {
|
||||
docParamType = strings.ToLower(docParamType)
|
||||
formatType = strings.ToLower(formatType)
|
||||
formatType = strings.ReplaceAll(strings.ToLower(formatType), "interface{}", "any") // 内置支持的类型统一使用any, 不使用 interface{}
|
||||
if len(formatType) == 0 {
|
||||
formatType = docParamType
|
||||
}
|
||||
// format type 和内置的支持数据类型一致, 直接返回对应类型
|
||||
for _, itemType := range consts.DataTypeList {
|
||||
if itemType.Value.String() == formatType {
|
||||
return itemType.Value.String()
|
||||
}
|
||||
}
|
||||
|
||||
// format type 和内置的支持数据类型不一致, 根据文档类型进行转换
|
||||
switch docParamType {
|
||||
case consts.SwaggerDataTypeInteger:
|
||||
if formatType == "int64" {
|
||||
case enums.SwaggerDataTypeInteger.String():
|
||||
if formatType == consts.DataTypeInt.String() {
|
||||
return consts.DataTypeInt.String()
|
||||
}
|
||||
return consts.DataTypeUint.String()
|
||||
case "string", "apikey":
|
||||
return consts.DataTypeInt.String()
|
||||
case enums.SwaggerDataTypeString.String(), enums.SwaggerDataTypeString.String():
|
||||
return consts.DataTypeString.String()
|
||||
case "object":
|
||||
case enums.SwaggerDataTypeObject.String():
|
||||
return consts.DataTypeMapStrAny.String()
|
||||
case "boolean":
|
||||
case enums.SwaggerDataTypeObject.String():
|
||||
return consts.DataTypeBool.String()
|
||||
case "number", "float", "double", "float32", "float64":
|
||||
case enums.SwaggerDataTypeNumber.String(), "float", "double", "float64":
|
||||
return consts.DataTypeFloat64.String()
|
||||
case "array":
|
||||
case "float32":
|
||||
return consts.DataTypeFloat32.String()
|
||||
case enums.SwaggerDataTypeArray.String():
|
||||
if formatType == "integer" {
|
||||
return consts.DataTypeSliceInt.String()
|
||||
} else if formatType == "string" {
|
||||
@ -79,22 +91,18 @@ func GetDataType(docParamType string, formatType string) string {
|
||||
}
|
||||
|
||||
// GetParamLocation 获取参数位置
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:02 2024/12/24
|
||||
func GetParamLocation(docParamLocation string) consts.RequestDataLocation {
|
||||
docParamLocation = strings.ToLower(docParamLocation)
|
||||
switch docParamLocation {
|
||||
case "query":
|
||||
case enums.DocParamLocationQuery.String():
|
||||
return consts.RequestDataLocationQuery
|
||||
case "header":
|
||||
case enums.DocParamLocationHeader.String():
|
||||
return consts.RequestDataLocationHeader
|
||||
case "cookie":
|
||||
case enums.DocParamLocationCookie.String():
|
||||
return consts.RequestDataLocationCookie
|
||||
case "body":
|
||||
case enums.DocParamLocationBody.String():
|
||||
return consts.RequestDataLocationBody
|
||||
case "path":
|
||||
case enums.DocParamLocationPath.String():
|
||||
return consts.RequestDataLocationUriPath
|
||||
default:
|
||||
return consts.RequestDataLocationQuery
|
||||
@ -103,12 +111,12 @@ func GetParamLocation(docParamLocation string) consts.RequestDataLocation {
|
||||
|
||||
// GetRealDefinitionsKey 通过schema下的 $ref 获取真实的 definitions key
|
||||
func GetRealDefinitionsKey(ref string) string {
|
||||
return strings.TrimPrefix(ref, "#/definitions/")
|
||||
return strings.TrimPrefix(ref, enums.RefPrefixSchemaDefinition.String())
|
||||
}
|
||||
|
||||
// GetRealResponseKey 通过schema下的 $ref 获取真实的 response key
|
||||
func GetRealResponseKey(ref string) string {
|
||||
return strings.TrimPrefix(ref, "#/responses/")
|
||||
return strings.TrimPrefix(ref, enums.RefPrefixSchemaResponse.String())
|
||||
}
|
||||
|
||||
// GetSuccessResponseConfig 获取成功的响应配置
|
||||
@ -123,7 +131,7 @@ func GetSuccessResponseConfig(resultConfig map[string]*define.SwaggerPathConfigR
|
||||
|
||||
// DataTypeIsArray 判断数据类型是否为数组
|
||||
func DataTypeIsArray(docDataType string) bool {
|
||||
return strings.ToLower(docDataType) == "array"
|
||||
return strings.ToLower(docDataType) == enums.SwaggerDataTypeArray.String()
|
||||
}
|
||||
|
||||
// ExpandArrayParam 展开详细的数组配置
|
||||
|
@ -7,11 +7,9 @@
|
||||
// Date : 2024-04-23 22:16
|
||||
package define
|
||||
|
||||
import "git.zhangdeman.cn/zhangdeman/api-doc/enums"
|
||||
|
||||
// OpenapiDoc openapi文档结构, 文档规范参见 : https://openapi.apifox.cn/
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:16 2024/7/19
|
||||
type OpenapiDoc struct {
|
||||
Openapi string `json:"openapi" required:"true"` // 必选. 这个字符串必须是开放 API 规范版本号提到的符合语义化版本号规范的版本号。openapi字段应该被工具或者客户端用来解释 OpenAPI 文档.
|
||||
Info *Info `json:"info,omitempty" required:"true"` // 必选。此字段提供 API 相关的元数据。相关工具可能需要这个字段。
|
||||
@ -22,19 +20,11 @@ type OpenapiDoc struct {
|
||||
}
|
||||
|
||||
// Components 数据结构定义
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 21:22 2024/7/19
|
||||
type Components struct {
|
||||
Schemas map[string]*Schema `json:"schemas"` // 数据结构定义
|
||||
}
|
||||
|
||||
// PathConfig ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 18:06 2024/7/19
|
||||
type PathConfig struct {
|
||||
Get *PathItemOperationConfig `json:"get,omitempty"` // 定义适用于此路径的 GET 操作。
|
||||
Put *PathItemOperationConfig `json:"put,omitempty"` // 定义适用于此路径的 PUT 操作。
|
||||
@ -51,10 +41,6 @@ type PathConfig struct {
|
||||
// 描述对一个路径可执行的有效操作。
|
||||
// 依赖与 ACL constraints 的设置,一个Path Item可以是一个空对象,
|
||||
// 文档的读者仍然可以看到这个路径,但是他们将无法了解到对这个路径可用的任何操作和参数。
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:22 2024/7/19
|
||||
type PathItemConfig struct {
|
||||
Ref string `json:"$ref"` // 指定对此路径的外部定义的引用,引用的格式必须符合 Path Item 对象 的格式,如果引用的外部定义和此对象内的其他定义有冲突,该如何处理冲突尚未被定义。
|
||||
Summary string `json:"summary"` // 一个可选的简要总结字符串,用来描述此路径内包含的所有操作。
|
||||
@ -65,10 +51,6 @@ type PathItemConfig struct {
|
||||
}
|
||||
|
||||
// PathItemOperationConfig 描述对路径的某个操作。
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:20 2024/7/19
|
||||
type PathItemOperationConfig struct {
|
||||
Tags []string `json:"tags"` // 用于控制API文档的标签列表,标签可以用于在逻辑上分组对资源的操作或作为其它用途的先决条件。
|
||||
Summary string `json:"summary"` // 对此操作行为的简短描述。
|
||||
@ -85,20 +67,12 @@ type PathItemOperationConfig struct {
|
||||
}
|
||||
|
||||
// ExternalDocs 外部文档配置
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:30 2024/7/19
|
||||
type ExternalDocs struct {
|
||||
Url string `json:"url"` // 必选. 外部文档的URL地址,这个值必须是URL地址格式。
|
||||
Description string `json:"description"` // 对引用的外部文档的简短描述。CommonMark syntax可以被用来呈现富文本格式.
|
||||
}
|
||||
|
||||
// PathConfigParameter 参数配置
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:29 2024/7/19
|
||||
type PathConfigParameter struct {
|
||||
Name string `json:"name"` // 参数名称
|
||||
In string `json:"in"` // 必选. 参数的位置,可能的值有 "query", "header", "path" 或 "cookie"。
|
||||
@ -114,10 +88,6 @@ type PathConfigParameter struct {
|
||||
}
|
||||
|
||||
// Schema ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:32 2024/7/19
|
||||
type Schema struct {
|
||||
Nullable bool `json:"nullable,omitempty"` // 对于定义的schema,允许发送 null 值。默认值是 false.
|
||||
Discriminator *SchemaDiscriminator `json:"discriminator,omitempty"` // 说白了, 就是一个字段可能是不同的数据结构。。。
|
||||
@ -145,10 +115,6 @@ type Schema struct {
|
||||
}
|
||||
|
||||
// Property 是从 JSON Schema 提取出来的,但是做了一些调整以适应 OpenAPI Specification。
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 17:05 2024/7/19
|
||||
type Property struct {
|
||||
Type any `json:"type,omitempty"` // 数据类型(string | []string), swagger本身的定义
|
||||
Format string `json:"format,omitempty"` // 对应编程语言中的数据类型描述
|
||||
@ -171,10 +137,6 @@ type Property struct {
|
||||
}
|
||||
|
||||
// PropertyXOf ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 17:13 2024/7/19
|
||||
type PropertyXOf struct {
|
||||
Type string `json:"type,omitempty"` // 基础类型
|
||||
Format string `json:"format,omitempty"` // 真实类型
|
||||
@ -186,20 +148,12 @@ type PropertyXOf struct {
|
||||
|
||||
// SchemaDiscriminator 当一个 request bodies 或 response payloads 可以是多种 schemas 时,可以使用一个 discriminator 对象来帮助序列化、反序列化和校验
|
||||
// discriminator 属性仅在与 oneOf, anyOf, allOf 这几个复合关键字之一一起使用时才合法.
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:48 2024/7/19
|
||||
type SchemaDiscriminator struct {
|
||||
PropertyName string `json:"propertyName"` // 必选. 在 payload 中表示 discriminator 值的属性的名称。
|
||||
Mapping map[string]string `json:"mapping"` // 一个映射 payload 中的值和 schema 名称或引用的对象。
|
||||
}
|
||||
|
||||
// XML 一个为 XML 模型定义微调过的元数据对象。
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:56 2024/7/19
|
||||
type XML struct {
|
||||
Name string `json:"name"` // 替换用于描述元素/属性的结构特性的名称。当在 items 内定义时将会影响处于此列表中的每个元素的名称。当定义于 items 之上时将会影响它说包裹的元素且仅当 wrapped 是 true 时,如果 wrapped 是 false 时它将会被忽略
|
||||
Namespace string `json:"namespace"` // 命名空间定义的 URI。其值必须是绝对 URI。
|
||||
@ -209,10 +163,6 @@ type XML struct {
|
||||
}
|
||||
|
||||
// RequestBody 定义请求体
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 17:17 2024/7/19
|
||||
type RequestBody struct {
|
||||
Required bool `json:"required"` // 指定请求体是不是应该被包含在请求中,默认值是false。
|
||||
Description string `json:"description,omitempty"` // 对请求体的简要描述,可以包含使用示例,CommonMark syntax可以被用来呈现富文本格式
|
||||
@ -221,10 +171,6 @@ type RequestBody struct {
|
||||
}
|
||||
|
||||
// Media 本质即为不一样 content_type 对应的数据结构定义
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 17:21 2024/7/19
|
||||
type Media struct {
|
||||
Schema *Schema `json:"schema,omitempty"` // 定义此媒体类型的结构。
|
||||
Example map[string]any `json:"example,omitempty"` // 媒体类型的示例。示例对象应该符合此媒体类型的格式, 这里指定的example对象 object is mutually exclusive of the examples object. 而且如果引用的schema也包含示例,在这里指定的example值将会覆盖schema提供的示例。
|
||||
@ -233,10 +179,6 @@ type Media struct {
|
||||
}
|
||||
|
||||
// Encoding 一个编码定义仅适用于一个结构属性
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 17:28 2024/7/19
|
||||
type Encoding struct {
|
||||
ContentType string `json:"content_type,omitempty"` // 对具体属性的 Content-Type的编码。默认值取决于属性的类型:application/octet-stream编码适用于binary格式的string;text/plain适用于其他原始值;application/json适用于object;对于array值类型的默认值取决于数组内元素的类型,默认值可以是明确的媒体类型(比如application/json), 或者通配符类型的媒体类型(比如image/*), 又或者是用分号分隔的两种媒体类型。
|
||||
Headers map[string]*Header `json:"headers,omitempty"` // 提供附加信息的请求头键值对映射。比如Content-Disposition、Content-Type各自描述了不同的信息而且在这里将会被忽略,如果请求体的媒体类型不是multipart,这个属性将会被忽略。
|
||||
@ -257,10 +199,6 @@ type Encoding struct {
|
||||
type Header PathConfigParameter
|
||||
|
||||
// Example ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 17:24 2024/7/19
|
||||
type Example struct {
|
||||
Summary string `json:"summary,omitempty"` // example 的简要描述。
|
||||
Description string `json:"description,omitempty"` // example 的详细描述。CommonMark syntax可以被用来呈现富文本格式.
|
||||
@ -269,10 +207,6 @@ type Example struct {
|
||||
}
|
||||
|
||||
// Response 响应的数据结构
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 17:38 2024/7/19
|
||||
type Response struct {
|
||||
Description string `json:"description" required:"true"` // 必选. 对响应的简短描述。CommonMark syntax可以被用来呈现富文本格式.
|
||||
Headers map[string]*Header `json:"headers,omitempty"` // 映射HTTP头名称到其定义。RFC7230 规定了HTTP头名称不区分大小写。如果一个响应头使用"Content-Type"作为HTTP头名称,它会被忽略。
|
||||
@ -281,10 +215,6 @@ type Response struct {
|
||||
}
|
||||
|
||||
// Info 信息
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:10 2024/4/19
|
||||
type Info struct {
|
||||
Description string `json:"description,omitempty"` // 对应用的简短描述。 CommonMark syntax 可以被用来表示富文本呈现。
|
||||
Title string `json:"title,omitempty" required:"true"` // 必选. 应用的名称。
|
||||
@ -295,10 +225,6 @@ type Info struct {
|
||||
}
|
||||
|
||||
// Contact 联系人信息
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:08 2024/4/19
|
||||
type Contact struct {
|
||||
Name string `json:"name,omitempty"` // 人或组织的名称。
|
||||
Url string `json:"url,omitempty"` // 指向联系人信息的 URL 地址,必须是 URL 地址格式。
|
||||
@ -306,20 +232,12 @@ type Contact struct {
|
||||
}
|
||||
|
||||
// License 开源协议
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:09 2024/4/19
|
||||
type License struct {
|
||||
Name string `json:"name,omitempty"` // 开源协议名
|
||||
Url string `json:"url,omitempty"` // 开源协议地址
|
||||
Name enums.License `json:"name,omitempty"` // 开源协议名
|
||||
Url string `json:"url,omitempty"` // 开源协议地址
|
||||
}
|
||||
|
||||
// ServerItem server 对象结构
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:18 2024/7/19
|
||||
type ServerItem struct {
|
||||
Url string `json:"url,omitempty" required:"true"` // 必选. 指向目标主机的 URL 地址。这个 URL 地址支持服务器变量而且可能是相对路径,表示主机路径是相对于本文档所在的路径。当一个变量被命名为类似{brackets}时需要替换此变量。
|
||||
Description string `json:"description,omitempty"` // 一个可选的字符串,用来描述此 URL 地址。CommonMark syntax可以被用来呈现富文本格式.
|
||||
@ -327,10 +245,6 @@ type ServerItem struct {
|
||||
}
|
||||
|
||||
// ServerItemVariable ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:22 2024/7/19
|
||||
type ServerItemVariable struct {
|
||||
Default string `json:"default,omitempty"` // 变量默认值
|
||||
Description string `json:"description,omitempty"` // 变量描述
|
||||
@ -338,10 +252,6 @@ type ServerItemVariable struct {
|
||||
}
|
||||
|
||||
// TagItem 每一个标签数据结构
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:18 2024/7/19
|
||||
type TagItem struct {
|
||||
Name string `json:"name,omitempty"` // 标签名称
|
||||
Description string `json:"description,omitempty"` // 标签描述
|
||||
|
@ -1,15 +0,0 @@
|
||||
// Package define ...
|
||||
//
|
||||
// Description : define ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2025-02-16 13:18
|
||||
package define
|
||||
|
||||
const (
|
||||
SwaggerUIThemeDefault = "swaggerUI" // 文档默认主题
|
||||
SwaggerUIThemeKnife4go = "knife4go" // knife4go 主题
|
||||
SwaggerUIThemeYDocLucky = "ydoc-lucky-ui" // YDoc Lucky UI 主题: https://github.com/NoBugBoy/LuckyUI
|
||||
SwaggerUIThemeRedocFree = "redoc-free" // redoc UI 主题, 开源免费版: https://github.com/Redocly/redoc
|
||||
)
|
22
enums/data_location.go
Normal file
22
enums/data_location.go
Normal file
@ -0,0 +1,22 @@
|
||||
// Package enums ...
|
||||
//
|
||||
// Description : enums ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2025-08-23 00:34
|
||||
package enums
|
||||
|
||||
type DocParamLocation string
|
||||
|
||||
func (dpl DocParamLocation) String() string {
|
||||
return string(dpl)
|
||||
}
|
||||
|
||||
const (
|
||||
DocParamLocationQuery DocParamLocation = "query"
|
||||
DocParamLocationHeader DocParamLocation = "header"
|
||||
DocParamLocationCookie DocParamLocation = "cookie"
|
||||
DocParamLocationBody DocParamLocation = "body"
|
||||
DocParamLocationPath DocParamLocation = "path"
|
||||
)
|
46
enums/data_type.go
Normal file
46
enums/data_type.go
Normal file
@ -0,0 +1,46 @@
|
||||
// Package enums ...
|
||||
//
|
||||
// Description : enums ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2025-08-22 23:58
|
||||
package enums
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type SwaggerDataType string
|
||||
|
||||
func (sdt SwaggerDataType) String() string {
|
||||
return string(sdt)
|
||||
}
|
||||
|
||||
// MarshalJSON 支持序列化
|
||||
func (sdt SwaggerDataType) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`"` + sdt.String() + `"`), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON 支持反序列化
|
||||
func (sdt *SwaggerDataType) UnmarshalJSON(d []byte) error {
|
||||
*sdt = SwaggerDataType(strings.Trim(string(d), `"`))
|
||||
return nil
|
||||
}
|
||||
|
||||
const (
|
||||
SwaggerDataTypeInteger SwaggerDataType = "integer" // 32 位有符号
|
||||
SwaggerDataTypeLong SwaggerDataType = "long" // 64 位有符号
|
||||
SwaggerDataTypeFloat SwaggerDataType = "number"
|
||||
SwaggerDataTypeDouble SwaggerDataType = "number"
|
||||
SwaggerDataTypeNumber SwaggerDataType = "number"
|
||||
SwaggerDataTypeByte SwaggerDataType = "string"
|
||||
SwaggerDataTypeBinary SwaggerDataType = "binary" // 任意 8 进制序列
|
||||
SwaggerDataTypeString SwaggerDataType = "string"
|
||||
SwaggerDataTypeDate SwaggerDataType = "string"
|
||||
SwaggerDataTypePassword SwaggerDataType = "password"
|
||||
SwaggerDataTypeBoolean SwaggerDataType = "boolean"
|
||||
SwaggerDataTypeArray SwaggerDataType = "array"
|
||||
SwaggerDataTypeObject SwaggerDataType = "object"
|
||||
SwaggerDataTypeApiKey SwaggerDataType = "apikey"
|
||||
)
|
116
enums/license.go
Normal file
116
enums/license.go
Normal file
@ -0,0 +1,116 @@
|
||||
// Package enums ...
|
||||
//
|
||||
// Description : enums ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2025-08-23 09:40
|
||||
package enums
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type License string
|
||||
|
||||
func (l License) String() string {
|
||||
return string(l)
|
||||
}
|
||||
|
||||
// MarshalJSON 支持序列化
|
||||
func (l License) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`"` + l.String() + `"`), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON 支持反序列化
|
||||
func (l *License) UnmarshalJSON(d []byte) error {
|
||||
*l = License(strings.Trim(string(d), `"`))
|
||||
return nil
|
||||
}
|
||||
|
||||
const (
|
||||
LicenseAfl30 License = "AFL-3.0"
|
||||
LicenseAgpl30 License = "AGPL-3.0"
|
||||
LicenseApache10 License = "Apache-1.0"
|
||||
LicenseApache11 License = "Apache-1.1"
|
||||
LicenseApache20 License = "Apache-2.0"
|
||||
LicenseArtistic20 License = "Artistic-2.0"
|
||||
LicenseBsd2Clause License = "BSD-2-Clause"
|
||||
LicenseBsd3Clause License = "BSD-3-Clause"
|
||||
LicenseBsd4Clause License = "BSD-4-Clause"
|
||||
LicenseBsl10 License = "BSL-1.0"
|
||||
LicenseCcBy40 License = "CC-BY-4.0"
|
||||
LicenseCcBySa40 License = "CC-BY-SA-4.0"
|
||||
LicenseCc010 License = "CC0-1.0"
|
||||
LicenseEcl20 License = "ECL-2.0"
|
||||
LicenseEpl10 License = "EPL-1.0"
|
||||
LicenseEpl20 License = "EPL-2.0"
|
||||
LicenseEupl11 License = "EUPL-1.1"
|
||||
LicenseEupl12 License = "EUPL-1.2"
|
||||
LicenseGpl20 License = "GPL-2.0"
|
||||
LicenseGpl30 License = "GPL-3.0"
|
||||
LicenseIsc License = "ISC"
|
||||
LicenseLgpl21 License = "LGPL-2.1"
|
||||
LicenseLgpl30 License = "LGPL-3.0"
|
||||
LicenseLppl13c License = "LPPL-1.3c"
|
||||
LicenseMit License = "MIT"
|
||||
LicenseMpl20 License = "MPL-2.0"
|
||||
LicenseMsPl License = "MS-PL"
|
||||
LicenseMsRl License = "MS-RL"
|
||||
LicenseMulanpsl10 License = "MulanPSL-1.0"
|
||||
LicenseMulanpubl10 License = "MulanPubL-1.0"
|
||||
LicenseMulanpubl20 License = "MulanPubL-2.0"
|
||||
LicenseNcsa License = "NCSA"
|
||||
LicenseOfl11 License = "OFL-1.1"
|
||||
LicenseOsl30 License = "OSL-3.0"
|
||||
LicensePostgresql License = "PostgreSQL"
|
||||
LicenseUpl10 License = "UPL-1.0"
|
||||
LicenseUnlicense License = "Unlicense"
|
||||
LicenseWtfpl License = "WTFPL"
|
||||
LicenseZlib License = "Zlib"
|
||||
)
|
||||
|
||||
var (
|
||||
// LicenseUrlTable 洗衣链接表
|
||||
LicenseUrlTable = map[License]string{
|
||||
LicenseAfl30: "https://spdx.org/licenses/AFL-3.0",
|
||||
LicenseAgpl30: "https://www.gnu.org/licenses/agpl-3.0.txt",
|
||||
LicenseApache10: "https://www.apache.org/licenses/LICENSE-1.0",
|
||||
LicenseApache11: "https://www.apache.org/licenses/LICENSE-1.1",
|
||||
LicenseApache20: "https://www.apache.org/licenses/LICENSE-2.0.txt",
|
||||
LicenseArtistic20: "https://spdx.org/licenses/Artistic-2.0",
|
||||
LicenseBsd2Clause: "https://opensource.org/license/BSD-2-Clause",
|
||||
LicenseBsd3Clause: "https://opensource.org/license/BSD-3-Clause",
|
||||
LicenseBsd4Clause: "https://directory.fsf.org/wiki/License:BSD-4-Clause",
|
||||
LicenseBsl10: "https://www.boost.org/LICENSE_1_0.txt",
|
||||
LicenseCcBy40: "https://creativecommons.org/licenses/by/4.0/legalcode.txt",
|
||||
LicenseCcBySa40: "https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt",
|
||||
LicenseCc010: "https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt",
|
||||
LicenseEcl20: "https://opensource.org/license/ecl-2-0",
|
||||
LicenseEpl10: "https://www.eclipse.org/org/documents/epl-1.0/EPL-1.0.txt",
|
||||
LicenseEpl20: "https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt",
|
||||
LicenseEupl11: "https://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/eupl1.1.-licence-en_0.pdf",
|
||||
LicenseEupl12: "https://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/eupl_v1.2_en.pdf",
|
||||
LicenseGpl20: "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html#SEC1",
|
||||
LicenseGpl30: "https://www.gnu.org/licenses/gpl-3.0.html#license-text",
|
||||
LicenseIsc: "https://spdx.org/licenses/ISC",
|
||||
LicenseLgpl21: "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html",
|
||||
LicenseLgpl30: "https://www.gnu.org/licenses/lgpl-3.0-standalone.html",
|
||||
LicenseLppl13c: "https://www.latex-project.org/lppl/lppl-1-3c.txt",
|
||||
LicenseMit: "https://spdx.org/licenses/MIT",
|
||||
LicenseMpl20: "https://www.mozilla.org/en-US/MPL/2.0/",
|
||||
LicenseMsPl: "https://opensource.org/license/ms-pl-html",
|
||||
LicenseMsRl: "https://opensource.org/license/ms-rl-html",
|
||||
LicenseMulanpsl10: "http://license.coscl.org.cn/MulanPSL",
|
||||
LicenseMulanpubl10: "http://license.coscl.org.cn/MulanPubL-1.0",
|
||||
LicenseMulanpubl20: "http://license.coscl.org.cn/MulanPubL-2.0",
|
||||
LicenseNcsa: "https://spdx.org/licenses/NCSA",
|
||||
LicenseOfl11: "https://openfontlicense.org/documents/OFL.txt",
|
||||
LicenseOsl30: "https://opensource.org/license/osl-3-0-php",
|
||||
LicensePostgresql: "https://www.postgresql.org/about/licence/",
|
||||
LicenseUpl10: "https://spdx.org/licenses/UPL-1.0",
|
||||
LicenseUnlicense: "https://unlicense.org/",
|
||||
LicenseWtfpl: "https://spdx.org/licenses/WTFPL",
|
||||
LicenseZlib: "https://www.zlib.net/zlib_license.html",
|
||||
}
|
||||
)
|
20
enums/ref.go
Normal file
20
enums/ref.go
Normal file
@ -0,0 +1,20 @@
|
||||
// Package enums ...
|
||||
//
|
||||
// Description : enums ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2025-08-23 00:40
|
||||
package enums
|
||||
|
||||
// RefPrefix 各种ref引用的前缀定义
|
||||
type RefPrefix string
|
||||
|
||||
func (rp RefPrefix) String() string {
|
||||
return string(rp)
|
||||
}
|
||||
|
||||
const (
|
||||
RefPrefixSchemaDefinition RefPrefix = "#/definitions/" // schema下的 $ref 下 definitions 的前缀
|
||||
RefPrefixSchemaResponse RefPrefix = "#/responses/" // schema下的 $ref 下 response 的前缀
|
||||
)
|
21
enums/ui_theme.go
Normal file
21
enums/ui_theme.go
Normal file
@ -0,0 +1,21 @@
|
||||
// Package enums ...
|
||||
//
|
||||
// Description : enums ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2025-08-23 01:03
|
||||
package enums
|
||||
|
||||
type SwaggerUITheme string
|
||||
|
||||
func (sut SwaggerUITheme) String() string {
|
||||
return string(sut)
|
||||
}
|
||||
|
||||
const (
|
||||
SwaggerUIThemeDefault SwaggerUITheme = "swaggerUI" // 文档默认主题
|
||||
SwaggerUIThemeKnife4go SwaggerUITheme = "knife4go" // knife4go 主题
|
||||
SwaggerUIThemeYDocLucky SwaggerUITheme = "ydoc-lucky-ui" // YDoc Lucky UI 主题: https://github.com/NoBugBoy/LuckyUI
|
||||
SwaggerUIThemeRedocFree SwaggerUITheme = "redoc-free" // redoc UI 主题, 开源免费版: https://github.com/Redocly/redoc
|
||||
)
|
19
enums/version.go
Normal file
19
enums/version.go
Normal file
@ -0,0 +1,19 @@
|
||||
// Package enums ...
|
||||
//
|
||||
// Description : enums ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2025-08-23 00:50
|
||||
package enums
|
||||
|
||||
type SwaggerVersion string
|
||||
|
||||
func (sv SwaggerVersion) String() string {
|
||||
return string(sv)
|
||||
}
|
||||
|
||||
const (
|
||||
SwaggerDocVersion2 SwaggerVersion = "2.0"
|
||||
SwaggerDocVersion3 SwaggerVersion = "3.0.0"
|
||||
)
|
95
geerate_option.go
Normal file
95
geerate_option.go
Normal file
@ -0,0 +1,95 @@
|
||||
// Package api_doc ...
|
||||
//
|
||||
// Description : api_doc ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2025-08-23 09:30
|
||||
package api_doc
|
||||
|
||||
import (
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/enums"
|
||||
)
|
||||
|
||||
// SetGenerateOption 设置文档生成选项
|
||||
type SetGenerateOption func(opt *define.OpenapiDoc)
|
||||
|
||||
// generateOption 生成文档的一些配置选项
|
||||
type generateOption struct {
|
||||
license enums.License // 文档的license
|
||||
description string // 文档的描述
|
||||
title string // 文档的标题
|
||||
}
|
||||
|
||||
// WithDocLicense 设置文档协议名称 + 协议链接
|
||||
func WithDocLicense(l enums.License) SetGenerateOption {
|
||||
return func(opt *define.OpenapiDoc) {
|
||||
if l == "" {
|
||||
return
|
||||
}
|
||||
opt.Info.License.Name = l
|
||||
opt.Info.License.Url = enums.LicenseUrlTable[l]
|
||||
}
|
||||
}
|
||||
|
||||
// WithDocDescription 设置文档描述
|
||||
func WithDocDescription(desc string) SetGenerateOption {
|
||||
return func(opt *define.OpenapiDoc) {
|
||||
if desc == "" {
|
||||
return
|
||||
}
|
||||
opt.Info.Description = desc
|
||||
}
|
||||
}
|
||||
|
||||
// WithDocTitle 设置文档标题
|
||||
func WithDocTitle(title string) SetGenerateOption {
|
||||
return func(opt *define.OpenapiDoc) {
|
||||
if len(title) == 0 {
|
||||
return
|
||||
}
|
||||
opt.Info.Title = title
|
||||
}
|
||||
}
|
||||
|
||||
// WithDocVersion 设置文档版本
|
||||
func WithDocVersion(version string) SetGenerateOption {
|
||||
return func(opt *define.OpenapiDoc) {
|
||||
opt.Info.Version = version
|
||||
}
|
||||
}
|
||||
|
||||
// WithDocContactName 设置文档联系人名称
|
||||
func WithDocContactName(name string) SetGenerateOption {
|
||||
return func(opt *define.OpenapiDoc) {
|
||||
if name == "" {
|
||||
return
|
||||
}
|
||||
opt.Info.Contact.Name = name
|
||||
}
|
||||
}
|
||||
|
||||
// WithDocContactEmail 设置文档联系人邮箱
|
||||
func WithDocContactEmail(email string) SetGenerateOption {
|
||||
return func(opt *define.OpenapiDoc) {
|
||||
opt.Info.Contact.Email = email
|
||||
}
|
||||
}
|
||||
|
||||
// WithDocContactHomePage 设置文档联系人主页
|
||||
func WithDocContactHomePage(url string) SetGenerateOption {
|
||||
return func(opt *define.OpenapiDoc) {
|
||||
opt.Info.Contact.Url = url
|
||||
}
|
||||
}
|
||||
|
||||
// WithDocServers 设置文档服务器列表
|
||||
func WithDocServers(serverList []*define.ServerItem) SetGenerateOption {
|
||||
return func(opt *define.OpenapiDoc) {
|
||||
if len(serverList) == 0 {
|
||||
return
|
||||
}
|
||||
opt.Servers = serverList
|
||||
}
|
||||
}
|
145
generate.go
145
generate.go
@ -10,12 +10,14 @@ package api_doc
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.zhangdeman.cn/gateway/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/enums"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper"
|
||||
)
|
||||
|
||||
// NewOpenapiDoc ...
|
||||
@ -23,48 +25,39 @@ import (
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:56 2024/7/22
|
||||
func NewOpenapiDoc(info *define.Info, servers []*define.ServerItem) *Generate {
|
||||
if nil == info {
|
||||
info = &define.Info{
|
||||
func NewOpenapiDoc(ofs ...SetGenerateOption) *Generate {
|
||||
// 初始默认值
|
||||
docCfg := &define.OpenapiDoc{
|
||||
Openapi: consts.SwaggerDocVersion3,
|
||||
Info: &define.Info{
|
||||
Description: "openapi接口文档",
|
||||
Title: "openapi接口文档",
|
||||
TermsOfService: "",
|
||||
Contact: nil,
|
||||
License: nil,
|
||||
Version: "0.0.1",
|
||||
}
|
||||
Contact: &define.Contact{
|
||||
Name: "研发人员(developer)",
|
||||
Url: "",
|
||||
Email: "",
|
||||
},
|
||||
License: &define.License{
|
||||
Name: enums.LicenseApache20,
|
||||
Url: enums.LicenseUrlTable[consts.LicenseApache20],
|
||||
},
|
||||
Version: "0.0.1",
|
||||
},
|
||||
Servers: []*define.ServerItem{},
|
||||
Components: &define.Components{Schemas: map[string]*define.Schema{}},
|
||||
Tags: make([]*define.TagItem, 0),
|
||||
Paths: make(map[string]*define.PathConfig),
|
||||
}
|
||||
if len(info.Version) == 0 {
|
||||
info.Version = "0.0.1"
|
||||
}
|
||||
if nil == info.License {
|
||||
info.License = &define.License{
|
||||
Name: consts.LicenseApache20,
|
||||
Url: consts.LicenseUrlTable[consts.LicenseApache20],
|
||||
}
|
||||
}
|
||||
if nil == info.Contact {
|
||||
info.Contact = &define.Contact{
|
||||
Name: "研发人员(developer)",
|
||||
Url: "",
|
||||
Email: "",
|
||||
}
|
||||
}
|
||||
if nil == servers {
|
||||
servers = []*define.ServerItem{}
|
||||
|
||||
for _, option := range ofs {
|
||||
option(docCfg)
|
||||
}
|
||||
return &Generate{
|
||||
readMethodList: []string{
|
||||
http.MethodGet, http.MethodHead, http.MethodConnect, http.MethodOptions, http.MethodTrace,
|
||||
},
|
||||
docData: &define.OpenapiDoc{
|
||||
Openapi: consts.SwaggerDocVersion3,
|
||||
Info: info,
|
||||
Servers: servers,
|
||||
Components: &define.Components{Schemas: map[string]*define.Schema{}},
|
||||
Tags: make([]*define.TagItem, 0),
|
||||
Paths: make(map[string]*define.PathConfig),
|
||||
},
|
||||
docData: docCfg,
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,45 +75,7 @@ func (g *Generate) Doc() *define.OpenapiDoc {
|
||||
return g.docData
|
||||
}
|
||||
|
||||
// SetLicense 设置文档协议
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:56 2024/8/14
|
||||
func (g *Generate) SetLicense(name string, url string) {
|
||||
g.docData.Info.License.Name = name
|
||||
g.docData.Info.License.Url = url
|
||||
}
|
||||
|
||||
// AddTag 新增tag
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:23 2024/8/14
|
||||
func (g *Generate) AddTag(tagName string, tagDesc string) {
|
||||
isHasTag := false
|
||||
for _, item := range g.docData.Tags {
|
||||
if item.Name == tagName {
|
||||
if len(tagDesc) > 0 {
|
||||
item.Description = tagDesc
|
||||
}
|
||||
isHasTag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !isHasTag {
|
||||
g.docData.Tags = append(g.docData.Tags, &define.TagItem{
|
||||
Name: tagName,
|
||||
Description: tagDesc,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// AddServer 添加server
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:45 2024/8/14
|
||||
func (g *Generate) AddServer(serverDomain string, serverDesc string, serverVariable map[string]*define.ServerItemVariable) {
|
||||
if nil == serverVariable {
|
||||
serverVariable = make(map[string]*define.ServerItemVariable)
|
||||
@ -149,35 +104,7 @@ func (g *Generate) AddServer(serverDomain string, serverDesc string, serverVaria
|
||||
}
|
||||
}
|
||||
|
||||
// AddApi 新增Api
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:04 2024/8/14
|
||||
//
|
||||
// baseCfg : 接口基础配置, 示例数据
|
||||
//
|
||||
// &define.UriBaseConfig{
|
||||
// Uri: "/foo/bar",
|
||||
// Method: http.MethodPost,
|
||||
// ContentType: ["application/json"],
|
||||
// TagList: []string{"测试标签"},
|
||||
// Summary: "这是一份示例基础配置",
|
||||
// Description: "这是一份示例基础配置",
|
||||
// }
|
||||
//
|
||||
// paramList : 参数列表
|
||||
//
|
||||
// resultList : 返回值列表
|
||||
func (g *Generate) AddApi(baseCfg *define.UriBaseConfig, paramList []*define.ParamConfig, resultList []*define.ResultConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddApiFromInAndOut 通过请求参数的
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:22 2025/2/9
|
||||
func (g *Generate) AddApiFromInAndOut(uriPrefix string, paramType reflect.Type, resultType reflect.Type) error {
|
||||
if paramType.Kind() == reflect.Ptr {
|
||||
paramType = paramType.Elem()
|
||||
@ -260,10 +187,6 @@ func (g *Generate) setApiDoc(baseCfg *define.UriBaseConfig, apiDocCfg *define.Pa
|
||||
}
|
||||
|
||||
// getApiDocBaseCfg 获取接口文档的基础配置
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:10 2025/2/14
|
||||
func (g *Generate) getApiDocBaseCfg(baseCfg *define.UriBaseConfig, paramType reflect.Type) *define.PathItemOperationConfig {
|
||||
cfg := &define.PathItemOperationConfig{
|
||||
Tags: baseCfg.TagList,
|
||||
@ -279,7 +202,7 @@ func (g *Generate) getApiDocBaseCfg(baseCfg *define.UriBaseConfig, paramType ref
|
||||
Ref: "",
|
||||
},
|
||||
Responses: map[string]*define.Response{
|
||||
fmt.Sprintf("%v", http.StatusOK): &define.Response{
|
||||
fmt.Sprintf("%v", http.StatusOK): {
|
||||
Content: map[string]*define.Media{},
|
||||
},
|
||||
},
|
||||
@ -295,12 +218,12 @@ func (g *Generate) getApiDocBaseCfg(baseCfg *define.UriBaseConfig, paramType ref
|
||||
param = strings.TrimSuffix(param, "}")
|
||||
cfg.Parameters = append(cfg.Parameters, &define.PathConfigParameter{
|
||||
Name: param,
|
||||
In: consts.SwaggerParameterInPath,
|
||||
In: enums.DocParamLocationPath.String(),
|
||||
Description: param,
|
||||
Required: true,
|
||||
Deprecated: false,
|
||||
Schema: &define.Schema{
|
||||
Type: consts.SwaggerDataTypeString,
|
||||
Type: enums.SwaggerDataTypeString.String(),
|
||||
Format: consts.DataTypeString.String(),
|
||||
},
|
||||
AllowEmptyValue: false,
|
||||
@ -311,10 +234,6 @@ func (g *Generate) getApiDocBaseCfg(baseCfg *define.UriBaseConfig, paramType ref
|
||||
}
|
||||
|
||||
// ParseReadConfigParam 解析get类请求参数
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 11:55 2025/2/14
|
||||
func (g *Generate) ParseReadConfigParam(requestCfg *define.UriBaseConfig, baseReqCfg *define.PathItemOperationConfig, inputType reflect.Type) {
|
||||
if inputType.Kind() == reflect.Ptr {
|
||||
inputType = inputType.Elem()
|
||||
|
30
go.mod
30
go.mod
@ -1,18 +1,16 @@
|
||||
module git.zhangdeman.cn/gateway/api-doc
|
||||
module git.zhangdeman.cn/zhangdeman/api-doc
|
||||
|
||||
go 1.23.0
|
||||
|
||||
toolchain go1.24.1
|
||||
|
||||
require (
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250328040304-7e4a6f9f148c
|
||||
git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241223084948-de2e49144fcd
|
||||
git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20250504055908-8d68e6106ea9
|
||||
git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20250321102712-1cbfbe959740
|
||||
github.com/gin-gonic/gin v1.10.0
|
||||
github.com/gin-gonic/gin v1.10.1
|
||||
github.com/go-webtools/knife4go v1.0.4
|
||||
github.com/swaggo/files v1.0.1
|
||||
github.com/swaggo/gin-swagger v1.6.0
|
||||
github.com/tidwall/gjson v1.18.0
|
||||
)
|
||||
|
||||
require (
|
||||
@ -20,14 +18,11 @@ require (
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20240618042405-6ee2c904644e // indirect
|
||||
github.com/BurntSushi/toml v1.5.0 // indirect
|
||||
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||
github.com/PuerkitoBio/purell v1.2.1 // indirect
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
||||
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 // indirect
|
||||
github.com/bytedance/sonic v1.13.2 // indirect
|
||||
github.com/bytedance/sonic/loader v0.2.4 // indirect
|
||||
github.com/cloudwego/base64x v0.1.5 // indirect
|
||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
|
||||
github.com/gin-contrib/sse v1.1.0 // indirect
|
||||
github.com/go-ini/ini v1.67.0 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.1 // indirect
|
||||
@ -47,19 +42,20 @@ require (
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||
github.com/sbabiv/xml2map v1.2.1 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/swaggo/swag v1.16.4 // indirect
|
||||
github.com/tidwall/gjson v1.18.0 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
golang.org/x/arch v0.16.0 // indirect
|
||||
golang.org/x/crypto v0.37.0 // indirect
|
||||
golang.org/x/net v0.39.0 // indirect
|
||||
golang.org/x/sys v0.32.0 // indirect
|
||||
golang.org/x/text v0.24.0 // indirect
|
||||
golang.org/x/tools v0.32.0 // indirect
|
||||
github.com/ugorji/go/codec v1.2.14 // indirect
|
||||
golang.org/x/arch v0.17.0 // indirect
|
||||
golang.org/x/crypto v0.38.0 // indirect
|
||||
golang.org/x/net v0.40.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
golang.org/x/text v0.25.0 // indirect
|
||||
golang.org/x/tools v0.33.0 // indirect
|
||||
google.golang.org/protobuf v1.36.6 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
184
go.sum
184
go.sum
@ -1,83 +1,46 @@
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250208020330-a50062af46a1 h1:vv4X72I6s6XcTi0ykj2v/cgMZyseFyE2LkS4WloICCs=
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250208020330-a50062af46a1/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250321102241-d6e86b64f7ca h1:uxjzbY5fDozjyK6jkoQtuQouVTcVfXjbe3chARYSjRM=
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250321102241-d6e86b64f7ca/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250328040304-7e4a6f9f148c h1:cl3gQGXQpJ8ugDs0C/hQLfcvF4lGBm5BeABLvROFDoM=
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20250328040304-7e4a6f9f148c/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
|
||||
git.zhangdeman.cn/zhangdeman/api-doc/enums v0.0.0-20250425024726-cc17224cb995 h1:LmPRAf0AsxRVFPibdpZR89ajlsz8hof2IvMMyTqiEq4=
|
||||
git.zhangdeman.cn/zhangdeman/api-doc/enums v0.0.0-20250425024726-cc17224cb995/go.mod h1:5p8CEKGBxi7qPtTXDI3HDmqKAfIm5i/aBWdrbkbdNjc=
|
||||
git.zhangdeman.cn/zhangdeman/op_type v0.0.0-20240122104027-4928421213c0 h1:gUDlQMuJ4xNfP2Abl1Msmpa3fASLWYkNlqDFF/6GN0Y=
|
||||
git.zhangdeman.cn/zhangdeman/op_type v0.0.0-20240122104027-4928421213c0/go.mod h1:VHb9qmhaPDAQDcS6vUiDCamYjZ4R5lD1XtVsh55KsMI=
|
||||
git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241223084948-de2e49144fcd h1:q7GG14qgXKB4MEXQFOe7/UYebsqMfPaSX80TcPdOosI=
|
||||
git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241223084948-de2e49144fcd/go.mod h1:+D6uPSljwHywjVY5WSBY4TRVMj26TN5f5cFGEYMldjs=
|
||||
git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20250504055908-8d68e6106ea9 h1:/GLQaFoLb+ciHOtAS2BIyPNnf4O5ME3AC5PUaJY9kfs=
|
||||
git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20250504055908-8d68e6106ea9/go.mod h1:ABJ655C5QenQNOzf7LjCe4sSB52CXvaWLX2Zg4uwDJY=
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20240618042405-6ee2c904644e h1:Q973S6CcWr1ICZhFI1STFOJ+KUImCl2BaIXm6YppBqI=
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20240618042405-6ee2c904644e/go.mod h1:VpPjBlwz8U+OxZuxzHQBv1aEEZ3pStH6bZvT21ADEbI=
|
||||
git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20250124091620-c757e551a8c9 h1:yF770WIDNwyiKL0nwmBGmjZvNCLXtHQL4xJyffPjTMU=
|
||||
git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20250124091620-c757e551a8c9/go.mod h1:I76wxEsWq7KnMQ84elpwTjEqq4I49QFw60tp5h7iGBs=
|
||||
git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20250321102712-1cbfbe959740 h1:zPUoylfJTbc0EcxW+NEzOTBmoeFZ2I/rLFBnEzxb4Wk=
|
||||
git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20250321102712-1cbfbe959740/go.mod h1:1ct92dbVc49pmXusA/iGfcQUJzcYmJ+cjAhgc3sDv1I=
|
||||
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
|
||||
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
|
||||
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
||||
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
||||
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
|
||||
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
github.com/PuerkitoBio/purell v1.2.1 h1:QsZ4TjvwiMpat6gBCBxEQI0rcS9ehtkKtSpiUnd9N28=
|
||||
github.com/PuerkitoBio/purell v1.2.1/go.mod h1:ZwHcC/82TOaovDi//J/804umJFFmbOHPngi8iYYv/Eo=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 h1:OYA+5W64v3OgClL+IrOD63t4i/RW7RqrAVl9LTZ9UqQ=
|
||||
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394/go.mod h1:Q8n74mJTIgjX4RBBcHnJ05h//6/k6foqmgE45jTQtxg=
|
||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||
github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ=
|
||||
github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
|
||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
|
||||
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
|
||||
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
|
||||
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
|
||||
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY=
|
||||
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
|
||||
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
|
||||
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E=
|
||||
github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0=
|
||||
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
|
||||
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
|
||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ=
|
||||
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
|
||||
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
||||
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
|
||||
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/jsonpointer v0.21.1 h1:whnzv/pNXtK2FbX/W9yJfRmE2gsmkfahjMKB0fZvcic=
|
||||
github.com/go-openapi/jsonpointer v0.21.1/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk=
|
||||
github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs=
|
||||
github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns=
|
||||
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
|
||||
github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4=
|
||||
github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M=
|
||||
github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I=
|
||||
github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY=
|
||||
github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk=
|
||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
|
||||
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
||||
github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZU=
|
||||
github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
@ -86,85 +49,72 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/go-playground/validator/v10 v10.25.0 h1:5Dh7cjvzR7BRZadnsVOzPhWsrwUr0nmsZJxEAnFLNO8=
|
||||
github.com/go-playground/validator/v10 v10.25.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=
|
||||
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
|
||||
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
|
||||
github.com/go-webtools/knife4go v1.0.4 h1:p32SApmM0sx2/Y5p0QfeaGv5KD96R1mj2CaHdyH8jy8=
|
||||
github.com/go-webtools/knife4go v1.0.4/go.mod h1:trOlXN1tqBJ7R44sHON3exGvzCwjbsVriIHEenry3d8=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g=
|
||||
github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
|
||||
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
|
||||
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
||||
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
|
||||
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/sbabiv/xml2map v1.2.1 h1:1lT7t0hhUvXZCkdxqtq4n8/ZCnwLWGq4rDuDv5XOoFE=
|
||||
github.com/sbabiv/xml2map v1.2.1/go.mod h1:2TPoAfcaM7+Sd4iriPvzyntb2mx7GY+kkQpB/GQa/eo=
|
||||
github.com/smarty/assertions v1.15.0 h1:cR//PqUBUiQRakZWqBiFFQ9wb8emQGDb0HeGdqGByCY=
|
||||
github.com/smarty/assertions v1.15.0/go.mod h1:yABtdzeQs6l1brC900WlRNwj6ZR55d7B+E8C6HtKdec=
|
||||
github.com/smartystreets/goconvey v1.8.1 h1:qGjIddxOk4grTu9JPOU31tVfq3cNdBlNa5sSznIX1xY=
|
||||
github.com/smartystreets/goconvey v1.8.1/go.mod h1:+/u4qLyY6x1jReYOp7GOM2FSt8aP9CzCZL03bI28W60=
|
||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
|
||||
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
|
||||
github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M=
|
||||
github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo=
|
||||
github.com/swaggo/swag v1.8.12 h1:pctzkNPu0AlQP2royqX3apjKCQonAnf7KGoxeO4y64w=
|
||||
github.com/swaggo/swag v1.8.12/go.mod h1:lNfm6Gg+oAq3zRJQNEMBE66LIJKM44mxFqhEEgy2its=
|
||||
github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A=
|
||||
github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg=
|
||||
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
|
||||
@ -176,98 +126,58 @@ github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
||||
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/ugorji/go/codec v1.2.14 h1:yOQvXCBc3Ij46LRkRoh4Yd5qK6LVOgi0bYOXfb7ifjw=
|
||||
github.com/ugorji/go/codec v1.2.14/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
||||
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw=
|
||||
golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=
|
||||
golang.org/x/arch v0.16.0 h1:foMtLTdyOmIniqWCHjY6+JxuC54XP1fDwx4N0ASyW+U=
|
||||
golang.org/x/arch v0.16.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=
|
||||
golang.org/x/arch v0.17.0 h1:4O3dfLzd+lQewptAHqjewQZQDyEdejz3VwgeYwkZneU=
|
||||
golang.org/x/arch v0.17.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
||||
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
||||
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
|
||||
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
|
||||
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
|
||||
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
|
||||
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
|
||||
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
|
||||
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
||||
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
|
||||
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
|
||||
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
||||
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
||||
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
|
||||
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
||||
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
||||
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
|
||||
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
|
||||
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
||||
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
|
||||
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
|
||||
golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
|
||||
golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
|
||||
golang.org/x/tools v0.32.0 h1:Q7N1vhpkQv7ybVzLFtTjvQya2ewbwNDZzUgfXGqtMWU=
|
||||
golang.org/x/tools v0.32.0/go.mod h1:ZxrU41P/wAbZD8EDa6dDCa6XfpkhJ7HFMjHJXfBDu8s=
|
||||
golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc=
|
||||
golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
||||
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
||||
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
|
@ -9,7 +9,8 @@ package api_doc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"git.zhangdeman.cn/gateway/api-doc/define"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/serialize"
|
||||
)
|
||||
|
||||
|
@ -10,9 +10,10 @@ package api_doc
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.zhangdeman.cn/gateway/api-doc/define"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/define"
|
||||
)
|
||||
|
||||
type Meta struct {
|
||||
@ -69,22 +70,22 @@ func Test_parser_Openapi3(t *testing.T) {
|
||||
var ug *UserGet
|
||||
var uh *UserHead
|
||||
g := NewOpenapiDoc(nil, []*define.ServerItem{
|
||||
&define.ServerItem{
|
||||
{
|
||||
Url: "http://127.0.0.1/v1",
|
||||
Description: "v1接口",
|
||||
Variables: map[string]*define.ServerItemVariable{
|
||||
"test": &define.ServerItemVariable{
|
||||
"test": {
|
||||
Default: "123456",
|
||||
Description: "1111",
|
||||
Enum: nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
&define.ServerItem{
|
||||
},
|
||||
},
|
||||
{
|
||||
Url: "http://127.0.0.1/v2",
|
||||
Description: "v2接口",
|
||||
Variables: nil,
|
||||
},
|
||||
},
|
||||
})
|
||||
g.AddApiFromInAndOut("", reflect.TypeOf(f), reflect.TypeOf(o))
|
||||
g.AddApiFromInAndOut("", reflect.TypeOf(fd), reflect.TypeOf(o))
|
||||
|
@ -8,10 +8,11 @@
|
||||
package api_doc
|
||||
|
||||
import (
|
||||
"git.zhangdeman.cn/gateway/api-doc/define"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/define"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -9,11 +9,12 @@ package api_doc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"git.zhangdeman.cn/gateway/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/serialize"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/serialize"
|
||||
)
|
||||
|
||||
// ParseSwagger2 解析swagger2.0版本文档
|
||||
|
@ -10,12 +10,13 @@ package swagger
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
apiDocDefine "git.zhangdeman.cn/gateway/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper"
|
||||
"net/http"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
apiDocDefine "git.zhangdeman.cn/zhangdeman/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper"
|
||||
)
|
||||
|
||||
// HandleOpenapiDocRes ...
|
||||
|
@ -8,12 +8,14 @@
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"git.zhangdeman.cn/gateway/api-doc/define"
|
||||
"git.zhangdeman.cn/gateway/api-doc/util"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/enums"
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/util"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper"
|
||||
)
|
||||
|
||||
// Generate 生成文档
|
||||
@ -25,7 +27,7 @@ func Generate(docConfig *define.SwaggerInput) (*define.Swagger, error) {
|
||||
formatDocConfig(docConfig)
|
||||
swaggerInfo := &define.Swagger{
|
||||
Schemes: docConfig.Schemes,
|
||||
Swagger: consts.SwaggerDocVersion2,
|
||||
Swagger: enums.SwaggerDocVersion2.String(),
|
||||
Host: docConfig.Host,
|
||||
BasePath: docConfig.BasePath,
|
||||
Info: docConfig.Info,
|
||||
@ -228,7 +230,7 @@ func generateParameterDefinitions(swaggerInfo *define.Swagger, uri string, paren
|
||||
if subPathArr[1] == "[]" {
|
||||
swaggerInfo.Definitions[parentPath].Properties[subPathArr[0]] = &define.SwaggerDefinitionProperty{
|
||||
Description: paramConfig.Description,
|
||||
Type: consts.SwaggerDataTypeArray,
|
||||
Type: enums.SwaggerDataTypeArray.String(),
|
||||
Items: &define.SwaggerDefinitionPropertyItem{
|
||||
Type: util.GetSwaggerType(paramConfig.Type),
|
||||
Ref: "",
|
||||
@ -242,7 +244,7 @@ func generateParameterDefinitions(swaggerInfo *define.Swagger, uri string, paren
|
||||
} else {
|
||||
swaggerInfo.Definitions[parentPath].Properties[subPathArr[0]] = &define.SwaggerDefinitionProperty{
|
||||
Description: "参数描述",
|
||||
Type: consts.SwaggerDataTypeObject,
|
||||
Type: enums.SwaggerDataTypeObject.String(),
|
||||
AllOf: []map[string]string{
|
||||
{
|
||||
consts.SwaggerRefKey: getRefValue(parentPath + "." + subPathArr[0]),
|
||||
@ -288,7 +290,7 @@ func generateParameterDefinitions(swaggerInfo *define.Swagger, uri string, paren
|
||||
AllOf: nil,
|
||||
}
|
||||
if itemSwaggerDefinition.Type == consts.SwaggerDataTypeObject {
|
||||
itemSwaggerDefinition.AllOf = []map[string]string{map[string]string{
|
||||
itemSwaggerDefinition.AllOf = []map[string]string{{
|
||||
consts.SwaggerRefKey: getRefValue(parentPath + "." + subPathArr[0]),
|
||||
}}
|
||||
} else if itemSwaggerDefinition.Type == consts.SwaggerDataTypeArray {
|
||||
|
@ -10,10 +10,10 @@ package swagger
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.zhangdeman.cn/gateway/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/define"
|
||||
)
|
||||
|
||||
func TestGenerate(t *testing.T) {
|
||||
@ -37,7 +37,7 @@ func TestGenerate(t *testing.T) {
|
||||
Version: "",
|
||||
},
|
||||
PathConfigList: []*define.SwaggerPathInput{
|
||||
&define.SwaggerPathInput{
|
||||
{
|
||||
Uri: "/test",
|
||||
Method: http.MethodPost,
|
||||
ContentType: consts.MimeTypeJson,
|
||||
@ -45,7 +45,7 @@ func TestGenerate(t *testing.T) {
|
||||
Description: "测试接口",
|
||||
TagList: []string{"测试接口生成"},
|
||||
ParameterList: []*define.SwaggerParameterInput{
|
||||
&define.SwaggerParameterInput{
|
||||
{
|
||||
Type: consts.DataTypeString.String(),
|
||||
Description: "姓名",
|
||||
Name: "name",
|
||||
@ -53,7 +53,7 @@ func TestGenerate(t *testing.T) {
|
||||
Required: true,
|
||||
EnumList: []interface{}{"zhang", "de", "man"},
|
||||
},
|
||||
&define.SwaggerParameterInput{
|
||||
{
|
||||
Type: consts.DataTypeString.String(),
|
||||
Description: "性别",
|
||||
Name: "person.sex",
|
||||
@ -61,7 +61,7 @@ func TestGenerate(t *testing.T) {
|
||||
Required: true,
|
||||
EnumList: []interface{}{"man", "woman", "other"},
|
||||
},
|
||||
&define.SwaggerParameterInput{
|
||||
{
|
||||
Type: consts.DataTypeString.String(),
|
||||
Description: "性别",
|
||||
Name: "person.job.list.[]",
|
||||
@ -69,7 +69,7 @@ func TestGenerate(t *testing.T) {
|
||||
Required: true,
|
||||
EnumList: nil,
|
||||
},
|
||||
&define.SwaggerParameterInput{
|
||||
{
|
||||
Type: consts.DataTypeInt.String(),
|
||||
Description: "年份",
|
||||
Name: "person.job.year.[]",
|
||||
@ -77,7 +77,7 @@ func TestGenerate(t *testing.T) {
|
||||
Required: true,
|
||||
EnumList: nil,
|
||||
},
|
||||
&define.SwaggerParameterInput{
|
||||
{
|
||||
Type: consts.DataTypeInt.String(),
|
||||
Description: "测试工作",
|
||||
Name: "person.job.test",
|
||||
@ -85,7 +85,7 @@ func TestGenerate(t *testing.T) {
|
||||
Required: true,
|
||||
EnumList: nil,
|
||||
},
|
||||
&define.SwaggerParameterInput{
|
||||
{
|
||||
Type: consts.DataTypeInt.String(),
|
||||
Description: "年龄",
|
||||
Name: "age",
|
||||
@ -93,7 +93,7 @@ func TestGenerate(t *testing.T) {
|
||||
Required: true,
|
||||
EnumList: []interface{}{18, 19, 20},
|
||||
},
|
||||
&define.SwaggerParameterInput{
|
||||
{
|
||||
Type: consts.DataTypeInt.String(),
|
||||
Description: "年龄",
|
||||
Name: "test_list.[].age",
|
||||
@ -101,7 +101,7 @@ func TestGenerate(t *testing.T) {
|
||||
Required: true,
|
||||
EnumList: []interface{}{18, 19, 20},
|
||||
},
|
||||
&define.SwaggerParameterInput{
|
||||
{
|
||||
Type: consts.DataTypeString.String(),
|
||||
Description: "年龄",
|
||||
Name: "test_list.[].name",
|
||||
@ -109,7 +109,7 @@ func TestGenerate(t *testing.T) {
|
||||
Required: true,
|
||||
EnumList: nil,
|
||||
},
|
||||
&define.SwaggerParameterInput{
|
||||
{
|
||||
Type: consts.DataTypeMapAnyAny.String(),
|
||||
Description: "测试global_map",
|
||||
Name: "obj",
|
||||
@ -119,23 +119,23 @@ func TestGenerate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
ResponseList: []*define.SwaggerResponseInput{
|
||||
&define.SwaggerResponseInput{
|
||||
{
|
||||
Code: "200",
|
||||
Description: "成功",
|
||||
List: []*define.SwaggerResponseItemInput{
|
||||
&define.SwaggerResponseItemInput{
|
||||
{
|
||||
Type: consts.DataTypeString.String(),
|
||||
Description: "姓名",
|
||||
Field: "nick_name",
|
||||
IsRequired: false,
|
||||
},
|
||||
&define.SwaggerResponseItemInput{
|
||||
{
|
||||
Type: consts.DataTypeString.String(),
|
||||
Description: "昵称",
|
||||
Field: "person.nick_name",
|
||||
IsRequired: false,
|
||||
},
|
||||
&define.SwaggerResponseItemInput{
|
||||
{
|
||||
Type: consts.DataTypeMapAnyAny.String(),
|
||||
Description: "测试返回生成map",
|
||||
Field: "obj",
|
||||
|
@ -8,31 +8,24 @@
|
||||
package api_doc
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"git.zhangdeman.cn/gateway/api-doc/define"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/define"
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/enums"
|
||||
"git.zhangdeman.cn/zhangdeman/api-doc/theme"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"github.com/gin-gonic/gin"
|
||||
knife4goFiles "github.com/go-webtools/knife4go"
|
||||
knife4goGin "github.com/go-webtools/knife4go/gin"
|
||||
swaggerFiles "github.com/swaggo/files"
|
||||
ginSwagger "github.com/swaggo/gin-swagger"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//go:embed ydoc-lucky-ui/*
|
||||
var ydocUIFiles embed.FS
|
||||
|
||||
//go:embed redoc-free/index.html
|
||||
var redocFreeIndexContent string
|
||||
|
||||
// NewSwaggerUI ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 21:21 2025/2/15
|
||||
func NewSwaggerUI(info *define.Info, servers []*define.ServerItem, uiTheme string) *SwaggerUI {
|
||||
func NewSwaggerUI(info *define.Info, servers []*define.ServerItem, uiTheme enums.SwaggerUITheme) *SwaggerUI {
|
||||
return &SwaggerUI{
|
||||
docInstance: NewOpenapiDoc(info, servers),
|
||||
uiTheme: uiTheme,
|
||||
@ -40,26 +33,18 @@ func NewSwaggerUI(info *define.Info, servers []*define.ServerItem, uiTheme strin
|
||||
}
|
||||
|
||||
type SwaggerUI struct {
|
||||
docInstance *Generate // 文档实例
|
||||
uiTheme string // 文档主题, swaggerUI / knife4go, 默认 knife4go
|
||||
docInstance *Generate // 文档实例
|
||||
uiTheme enums.SwaggerUITheme // 文档主题, swaggerUI / knife4go, 默认 knife4go
|
||||
router *gin.Engine
|
||||
baseUri string
|
||||
}
|
||||
|
||||
// DocInstance 文档实例
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 13:23 2025/2/16
|
||||
func (su *SwaggerUI) DocInstance() *Generate {
|
||||
return su.docInstance
|
||||
}
|
||||
|
||||
// RegisterHandler ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:00 2025/2/16
|
||||
func (su *SwaggerUI) RegisterHandler(router *gin.Engine, baseUri string) {
|
||||
su.router = router
|
||||
baseUri = strings.TrimRight(baseUri, "/")
|
||||
@ -79,7 +64,7 @@ func (su *SwaggerUI) RegisterHandler(router *gin.Engine, baseUri string) {
|
||||
{
|
||||
"name": "服务文档",
|
||||
"url": "doc.json",
|
||||
"swaggerVersion": consts.SwaggerDocVersion3,
|
||||
"swaggerVersion": enums.SwaggerDocVersion3.String(),
|
||||
},
|
||||
})
|
||||
ctx.Abort()
|
||||
@ -91,7 +76,7 @@ func (su *SwaggerUI) RegisterHandler(router *gin.Engine, baseUri string) {
|
||||
{
|
||||
"name": "服务文档",
|
||||
"url": baseUri + "/doc.json",
|
||||
"swaggerVersion": consts.SwaggerDocVersion3,
|
||||
"swaggerVersion": enums.SwaggerDocVersion3.String(),
|
||||
},
|
||||
})
|
||||
// ctx.JSON(http.StatusOK, swaggerInstance.docInstance.Data())
|
||||
@ -99,20 +84,16 @@ func (su *SwaggerUI) RegisterHandler(router *gin.Engine, baseUri string) {
|
||||
}
|
||||
|
||||
// Handler 访问文档的接口处理
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 21:34 2025/2/15
|
||||
func (su *SwaggerUI) Handler() func(ctx *gin.Context) {
|
||||
switch su.uiTheme {
|
||||
case define.SwaggerUIThemeKnife4go:
|
||||
case enums.SwaggerUIThemeKnife4go:
|
||||
return su.HandleKnife4goUI()
|
||||
case define.SwaggerUIThemeYDocLucky:
|
||||
case enums.SwaggerUIThemeYDocLucky:
|
||||
// YDoc-Lucky-UI 主题处理
|
||||
return su.HandleLuckyUI()
|
||||
case define.SwaggerUIThemeDefault:
|
||||
case enums.SwaggerUIThemeDefault:
|
||||
return su.HandleSwaggerUI()
|
||||
case define.SwaggerUIThemeRedocFree:
|
||||
case enums.SwaggerUIThemeRedocFree:
|
||||
// redoc免费版
|
||||
return su.HandleRedocFreeUI()
|
||||
default:
|
||||
@ -121,15 +102,11 @@ func (su *SwaggerUI) Handler() func(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// HandleLuckyUI ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:04 2025/2/16
|
||||
func (su *SwaggerUI) HandleLuckyUI() func(ctx *gin.Context) {
|
||||
// su.router.StaticFS(su.baseUri+"/assets", http.FS(ydocUIFiles))
|
||||
return func(ctx *gin.Context) {
|
||||
fileRealPath := strings.TrimPrefix(ctx.Request.RequestURI, su.baseUri)
|
||||
byteData, _ := ydocUIFiles.ReadFile(define.SwaggerUIThemeYDocLucky + fileRealPath)
|
||||
byteData, _ := theme.YdocUIFiles.ReadFile(filepath.Join(enums.SwaggerUIThemeYDocLucky.String(), fileRealPath))
|
||||
if strings.HasSuffix(ctx.Request.RequestURI, "html") {
|
||||
byteData = []byte(strings.ReplaceAll(string(byteData), "{{BASE_URI}}", su.baseUri))
|
||||
}
|
||||
@ -140,17 +117,13 @@ func (su *SwaggerUI) HandleLuckyUI() func(ctx *gin.Context) {
|
||||
} else if strings.HasSuffix(ctx.Request.RequestURI, "js") {
|
||||
contentType = "application/javascript"
|
||||
}
|
||||
ctx.Header("Content-Type", contentType)
|
||||
ctx.Header(consts.HeaderKeyContentType.String(), contentType)
|
||||
ctx.String(http.StatusOK, string(byteData))
|
||||
ctx.Abort()
|
||||
}
|
||||
}
|
||||
|
||||
// HandleKnife4goUI ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 21:38 2025/2/15
|
||||
func (su *SwaggerUI) HandleKnife4goUI() func(ctx *gin.Context) {
|
||||
resetOption := func(cfg *knife4goGin.Config) {
|
||||
if nil == cfg {
|
||||
@ -162,19 +135,11 @@ func (su *SwaggerUI) HandleKnife4goUI() func(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// HandleSwaggerUI ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 21:41 2025/2/15
|
||||
func (su *SwaggerUI) HandleSwaggerUI() func(ctx *gin.Context) {
|
||||
return ginSwagger.WrapHandler(swaggerFiles.Handler)
|
||||
}
|
||||
|
||||
// HandleRedocFreeUI 处理redoc_free主题
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:40 2025/2/18
|
||||
func (su *SwaggerUI) HandleRedocFreeUI() func(ctx *gin.Context) {
|
||||
return func(ctx *gin.Context) {
|
||||
// TODO : 这部分数据支持外部传参替换
|
||||
@ -185,10 +150,10 @@ func (su *SwaggerUI) HandleRedocFreeUI() func(ctx *gin.Context) {
|
||||
"{{REDOC_STANDALONE_JS}}": "https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js",
|
||||
}
|
||||
for k, v := range replaceTable {
|
||||
redocFreeIndexContent = strings.ReplaceAll(redocFreeIndexContent, k, v)
|
||||
theme.RedocFreeIndexContent = strings.ReplaceAll(theme.RedocFreeIndexContent, k, v)
|
||||
}
|
||||
ctx.Header("Content-Type", "text/html; charset=utf-8")
|
||||
ctx.String(http.StatusOK, redocFreeIndexContent)
|
||||
ctx.Header(consts.HeaderKeyContentType.String(), "text/html; charset=utf-8")
|
||||
ctx.String(http.StatusOK, theme.RedocFreeIndexContent)
|
||||
ctx.Abort()
|
||||
}
|
||||
}
|
||||
|
16
theme/embed.go
Normal file
16
theme/embed.go
Normal file
@ -0,0 +1,16 @@
|
||||
// Package theme ...
|
||||
//
|
||||
// Description : theme ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2025-08-23 09:23
|
||||
package theme
|
||||
|
||||
import "embed"
|
||||
|
||||
//go:embed ydoc-lucky-ui/*
|
||||
var YdocUIFiles embed.FS
|
||||
|
||||
//go:embed redoc-free/index.html
|
||||
var RedocFreeIndexContent string
|
Before Width: | Height: | Size: 156 B After Width: | Height: | Size: 156 B |
Before Width: | Height: | Size: 340 KiB After Width: | Height: | Size: 340 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
@ -8,9 +8,10 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
)
|
||||
|
||||
// GetParameterDefaultLocation 获取参数的默认位置
|
||||
|
@ -8,10 +8,11 @@
|
||||
package api_doc
|
||||
|
||||
import (
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -33,10 +34,6 @@ func (r validateRule) IsRequired(structField reflect.StructField) bool {
|
||||
}
|
||||
|
||||
// Enum 获取枚举值
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 17:23 2025/2/13
|
||||
func (r validateRule) Enum(structField reflect.StructField) []any {
|
||||
ruleTable := r.getValidateRuleTable(structField)
|
||||
oneOfValue, _ := ruleTable[consts.ValidatorRuleCommonOneOf.String()]
|
||||
@ -79,10 +76,6 @@ func (r validateRule) Enum(structField reflect.StructField) []any {
|
||||
}
|
||||
|
||||
// Minimum 最小值
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 21:51 2025/2/18
|
||||
func (r validateRule) Minimum(structField reflect.StructField) *int64 {
|
||||
ruleTable := r.getValidateRuleTable(structField)
|
||||
var (
|
||||
@ -118,10 +111,6 @@ func (r validateRule) Minimum(structField reflect.StructField) *int64 {
|
||||
}
|
||||
|
||||
// Maximum 最大值
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 22:00 2025/2/18
|
||||
func (r validateRule) Maximum(structField reflect.StructField) *int64 {
|
||||
ruleTable := r.getValidateRuleTable(structField)
|
||||
var (
|
||||
@ -157,10 +146,6 @@ func (r validateRule) Maximum(structField reflect.StructField) *int64 {
|
||||
}
|
||||
|
||||
// getValidateRuleTable 解析验证规则表
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:29 2025/2/13
|
||||
func (r validateRule) getValidateRuleTable(structField reflect.StructField) map[string]string {
|
||||
res := map[string]string{}
|
||||
ruleStr := ParseStructFieldTag.GetValidateRule(structField)
|
||||
|
Reference in New Issue
Block a user