Skip to content

Commit

Permalink
[Fix] Fix swagger docs missing schema attr for primitive body type @p…
Browse files Browse the repository at this point in the history
…aram annotation
  • Loading branch information
maxshine committed Apr 10, 2019
1 parent 36a17c4 commit 521e9a3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions generate/swaggergen/g_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 521e9a3

Please sign in to comment.