处理GET类请求文档生成,待完善
This commit is contained in:
@ -40,6 +40,11 @@ func Test_parser_Openapi3(t *testing.T) {
|
||||
Name string `json:"name" d:"zhang" desc:"用户姓名" binding:"required"`
|
||||
Age string `json:"age" d:"18" desc:"年龄" binding:"required,oneof=12 13 18 90"`
|
||||
}
|
||||
type UserGet struct {
|
||||
Meta `json:"-" deprecated:"false" path:"/user/detail/get/{put_user_id}" method:"GET" desc:"测试接口" tag:"用户,搜索" content_type:"application/json" output_content_type:"application/json"`
|
||||
Name string `json:"name" d:"zhang" desc:"用户姓名" binding:"required"`
|
||||
Age string `json:"age" d:"18" desc:"年龄" binding:"required,oneof=12 13 18 90"`
|
||||
}
|
||||
type List struct {
|
||||
Total int64 `json:"total" binding:"required"`
|
||||
UserList []User `json:"user_list"`
|
||||
@ -48,6 +53,7 @@ func Test_parser_Openapi3(t *testing.T) {
|
||||
var f User
|
||||
var fd UserDelete
|
||||
var up UserPut
|
||||
var ug UserGet
|
||||
g := NewOpenapiDoc(nil, []*define.ServerItem{
|
||||
&define.ServerItem{
|
||||
Url: "http://127.0.0.1/v1",
|
||||
@ -63,6 +69,7 @@ func Test_parser_Openapi3(t *testing.T) {
|
||||
g.AddApiFromInAndOut(reflect.TypeOf(f), reflect.TypeOf(o))
|
||||
g.AddApiFromInAndOut(reflect.TypeOf(fd), reflect.TypeOf(o))
|
||||
g.AddApiFromInAndOut(reflect.TypeOf(up), reflect.TypeOf(o))
|
||||
g.AddApiFromInAndOut(reflect.TypeOf(ug), reflect.TypeOf(o))
|
||||
byteData, _ := json.Marshal(g.docData)
|
||||
fmt.Println(string(byteData))
|
||||
}
|
||||
|
Reference in New Issue
Block a user