mirror of
https://github.com/go-home-admin/toolset.git
synced 2026-04-23 00:27:03 +08:00
fix: 修复swagger文档中的枚举值错误
This commit is contained in:
@@ -446,13 +446,13 @@ func enumToMessage(pge string, enum parser.Enum) (string, *openapi.Schema) {
|
||||
schema := &openapi.Schema{}
|
||||
schema.Description = enum.Doc
|
||||
properties := make(map[string]*openapi.Schema)
|
||||
for i, opt := range enum.Opt {
|
||||
for _, opt := range enum.Opt {
|
||||
attr := &openapi.Schema{
|
||||
Description: "enum|" + getTitle(opt.Doc),
|
||||
Type: "number",
|
||||
Format: "uint",
|
||||
}
|
||||
properties[strconv.Itoa(i)] = attr
|
||||
properties[fmt.Sprint(opt.Num)] = attr
|
||||
}
|
||||
schema.Properties = properties
|
||||
schema.Format = "number"
|
||||
|
||||
Reference in New Issue
Block a user