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

[Fix] Fix swagger docs missing schema attr for primitive body type @Param annotation

This commit is contained in:
Yang, Gao 2019-04-10 23:32:55 +08:00
parent 36a17c40b0
commit 521e9a3bc0

View File

@ -791,10 +791,21 @@ func setParamType(para *swagger.Parameter, typ string, pkgpath, controllerName s
if typ == "string" || typ == "number" || typ == "integer" || typ == "boolean" ||
typ == astTypeArray || typ == "file" {
paraType = typ
if para.In == "body" {
para.Schema = &swagger.Schema{
Type: paraType,
}
}
} else if sType, ok := basicTypes[typ]; ok {
typeFormat := strings.Split(sType, ":")
paraType = typeFormat[0]
paraFormat = typeFormat[1]
if para.In == "body" {
para.Schema = &swagger.Schema{
Type: paraType,
Format: paraFormat,
}
}
} else {
m, mod, realTypes := getModel(typ)
para.Schema = &swagger.Schema{