fix: 修复swagger文档中的枚举值错误

This commit is contained in:
Zodial
2023-05-16 17:37:34 +08:00
parent 5983bf44ed
commit da42461eda
+2 -2
View File
@@ -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"