update swagger array items define

This commit is contained in:
tnextday 2016-08-18 21:30:57 +08:00
parent 2f85185bcc
commit 3ccffe087e
1 changed files with 5 additions and 5 deletions

View File

@ -603,17 +603,17 @@ func getModel(str string) (pkgpath, objectname string, m swagger.Schema, realTyp
// add type slice
if isSlice {
mp.Type = "array"
mp.Properties = make(map[string]swagger.Propertie)
if isBasicType(realType) {
typeFormat := strings.Split(sType, ":")
mp.Properties["items"] = swagger.Propertie{
mp.Items = []swagger.Propertie{{
Type: typeFormat[0],
Format: typeFormat[1],
}
}}
} else {
mp.Properties["items"] = swagger.Propertie{
mp.Items = []swagger.Propertie{{
Ref: "#/definitions/" + realType,
}
}}
}
} else {
if isBasicType(realType) {