mirror of
				https://github.com/beego/bee.git
				synced 2025-10-23 08:22:18 +00:00 
			
		
		
		
	Merge pull request #428 from futureskywei/develop
slice type generate swgger doc error fix
This commit is contained in:
		| @@ -762,7 +762,7 @@ func parseObject(d *ast.Object, k string, m *swagger.Schema, realTypes *[]string | |||||||
| 			mp := swagger.Propertie{} | 			mp := swagger.Propertie{} | ||||||
| 			if isSlice { | 			if isSlice { | ||||||
| 				mp.Type = "array" | 				mp.Type = "array" | ||||||
| 				if isBasicType(realType) { | 				if isBasicType(strings.Replace(realType, "[]", "", -1)) { | ||||||
| 					typeFormat := strings.Split(sType, ":") | 					typeFormat := strings.Split(sType, ":") | ||||||
| 					mp.Items = &swagger.Propertie{ | 					mp.Items = &swagger.Propertie{ | ||||||
| 						Type:   typeFormat[0], | 						Type:   typeFormat[0], | ||||||
| @@ -865,7 +865,7 @@ func parseObject(d *ast.Object, k string, m *swagger.Schema, realTypes *[]string | |||||||
| func typeAnalyser(f *ast.Field) (isSlice bool, realType, swaggerType string) { | func typeAnalyser(f *ast.Field) (isSlice bool, realType, swaggerType string) { | ||||||
| 	if arr, ok := f.Type.(*ast.ArrayType); ok { | 	if arr, ok := f.Type.(*ast.ArrayType); ok { | ||||||
| 		if isBasicType(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 { | 		if mp, ok := arr.Elt.(*ast.MapType); ok { | ||||||
| 			return false, fmt.Sprintf("map[%v][%v]", mp.Key, mp.Value), "object" | 			return false, fmt.Sprintf("map[%v][%v]", mp.Key, mp.Value), "object" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sergey Lanzman
					Sergey Lanzman