mirror of
https://github.com/beego/bee.git
synced 2024-11-22 10:10:53 +00:00
add support time.Time and int16
This commit is contained in:
parent
77acc749e4
commit
3b5e381a48
18
g_docs.go
18
g_docs.go
@ -61,7 +61,7 @@ var basicTypes = map[string]string{
|
|||||||
"uint64": "integer:int64",
|
"uint64": "integer:int64",
|
||||||
"int": "integer:int64",
|
"int": "integer:int64",
|
||||||
"int8": "integer:int32",
|
"int8": "integer:int32",
|
||||||
"int16:int32": "integer:int32",
|
"int16": "integer:int32",
|
||||||
"int32": "integer:int32",
|
"int32": "integer:int32",
|
||||||
"int64": "integer:int64",
|
"int64": "integer:int64",
|
||||||
"uintptr": "integer:int64",
|
"uintptr": "integer:int64",
|
||||||
@ -72,6 +72,12 @@ var basicTypes = map[string]string{
|
|||||||
"complex128": "number:double",
|
"complex128": "number:double",
|
||||||
"byte": "string:byte",
|
"byte": "string:byte",
|
||||||
"rune": "string:byte",
|
"rune": "string:byte",
|
||||||
|
// builtin golang objects
|
||||||
|
"time.Time": "string:string",
|
||||||
|
}
|
||||||
|
|
||||||
|
var stdlibObject = map[string]string{
|
||||||
|
"&{time Time}": "time.Time",
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -872,10 +878,14 @@ func typeAnalyser(f *ast.Field) (isSlice bool, realType, swaggerType string) {
|
|||||||
}
|
}
|
||||||
return false, val, "object"
|
return false, val, "object"
|
||||||
}
|
}
|
||||||
if k, ok := basicTypes[fmt.Sprint(f.Type)]; ok {
|
basicType := fmt.Sprint(f.Type)
|
||||||
return false, fmt.Sprint(f.Type), k
|
if object, isStdLibObject := stdlibObject[basicType]; isStdLibObject {
|
||||||
|
basicType = object
|
||||||
}
|
}
|
||||||
return false, fmt.Sprint(f.Type), "object"
|
if k, ok := basicTypes[basicType]; ok {
|
||||||
|
return false, basicType, k
|
||||||
|
}
|
||||||
|
return false, basicType, "object"
|
||||||
}
|
}
|
||||||
|
|
||||||
func isBasicType(Type string) bool {
|
func isBasicType(Type string) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user