Browse Source

feature: swagger 添加对 map 的识别、忽略 .DS_Store 文件夹

liuyaqi 2 years ago
parent
commit
93de26f6e0
1 changed files with 8 additions and 0 deletions
  1. 8 0
      opms_parent/swaggerui/swagger.go

+ 8 - 0
opms_parent/swaggerui/swagger.go

@@ -227,6 +227,9 @@ func main() {
 			if os.IsNotExist(err) {
 				continue
 			}
+			if f.Name() == ".DS_Store" {
+				continue
+			}
 			if info.IsDir() {
 				toload = append(toload, fmt.Sprintf("%s/%s/%s/internal", modname, d, f.Name()))
 			}
@@ -619,6 +622,11 @@ func buildFromType(tpe types.Type, declFile *ast.File, desc string) (error, *Swa
 			Type:        "object",
 			Description: desc,
 		}
+	case *types.Map:
+		return nil, &SwaggerModel{
+			Type:        "object",
+			Description: desc,
+		}
 
 	default:
 		panic(fmt.Sprintf("WARNING: can't determine refined type %s (%T)", titpe.String(), titpe))