mirror of
https://github.com/beego/bee.git
synced 2024-11-22 10:10:53 +00:00
Merge pull request #595 from maxshine/develop
Fix swagger docs missing schema attr for primitive body type param
This commit is contained in:
commit
6f1ff54713
@ -791,10 +791,21 @@ func setParamType(para *swagger.Parameter, typ string, pkgpath, controllerName s
|
|||||||
if typ == "string" || typ == "number" || typ == "integer" || typ == "boolean" ||
|
if typ == "string" || typ == "number" || typ == "integer" || typ == "boolean" ||
|
||||||
typ == astTypeArray || typ == "file" {
|
typ == astTypeArray || typ == "file" {
|
||||||
paraType = typ
|
paraType = typ
|
||||||
|
if para.In == "body" {
|
||||||
|
para.Schema = &swagger.Schema{
|
||||||
|
Type: paraType,
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if sType, ok := basicTypes[typ]; ok {
|
} else if sType, ok := basicTypes[typ]; ok {
|
||||||
typeFormat := strings.Split(sType, ":")
|
typeFormat := strings.Split(sType, ":")
|
||||||
paraType = typeFormat[0]
|
paraType = typeFormat[0]
|
||||||
paraFormat = typeFormat[1]
|
paraFormat = typeFormat[1]
|
||||||
|
if para.In == "body" {
|
||||||
|
para.Schema = &swagger.Schema{
|
||||||
|
Type: paraType,
|
||||||
|
Format: paraFormat,
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
m, mod, realTypes := getModel(typ)
|
m, mod, realTypes := getModel(typ)
|
||||||
para.Schema = &swagger.Schema{
|
para.Schema = &swagger.Schema{
|
||||||
|
Loading…
Reference in New Issue
Block a user