1
0
mirror of https://github.com/beego/bee.git synced 2024-12-22 04:50:49 +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:
Faissal Elamraoui 2019-04-10 18:08:26 +02:00 committed by GitHub
commit 6f1ff54713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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{