1
0
mirror of https://github.com/beego/bee.git synced 2024-12-22 10:00:50 +00:00

fix gen doc slice type bug

This commit is contained in:
guoshaowei 2017-05-05 11:31:03 +08:00
parent 3f63cd706f
commit 50ae47c61f

View File

@ -864,13 +864,8 @@ func parseObject(d *ast.Object, k string, m *swagger.Schema, realTypes *[]string
func typeAnalyser(f *ast.Field) (isSlice bool, realType, swaggerType string) {
if arr, ok := f.Type.(*ast.ArrayType); ok {
//arr.Len nil for slice types
if arr.Len == nil {
return true, fmt.Sprintf("[]%v", arr.Elt), basicTypes[fmt.Sprint(arr.Elt)]
}
if isBasicType(fmt.Sprint(arr.Elt)) {
return false, fmt.Sprintf("[]%v", arr.Elt), basicTypes[fmt.Sprint(arr.Elt)]
return true, fmt.Sprintf("[]%v", arr.Elt), basicTypes[fmt.Sprint(arr.Elt)]
}
if mp, ok := arr.Elt.(*ast.MapType); ok {
return false, fmt.Sprintf("map[%v][%v]", mp.Key, mp.Value), "object"