Add document & comment for spec (#703)
* Add document & comment for spec * remove duplicate field * use alias
This commit is contained in:
@@ -5,27 +5,87 @@ func (t PrimitiveType) Name() string {
|
||||
return t.RawName
|
||||
}
|
||||
|
||||
// Comments returns the comments of struct
|
||||
func (t PrimitiveType) Comments() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Documents returns the documents of struct
|
||||
func (t PrimitiveType) Documents() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Name returns a structure string, such as User
|
||||
func (t DefineStruct) Name() string {
|
||||
return t.RawName
|
||||
}
|
||||
|
||||
// Comments returns the comments of struct
|
||||
func (t DefineStruct) Comments() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Documents returns the documents of struct
|
||||
func (t DefineStruct) Documents() []string {
|
||||
return t.Docs
|
||||
}
|
||||
|
||||
// Name returns a map string, such as map[string]int
|
||||
func (t MapType) Name() string {
|
||||
return t.RawName
|
||||
}
|
||||
|
||||
// Comments returns the comments of struct
|
||||
func (t MapType) Comments() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Documents returns the documents of struct
|
||||
func (t MapType) Documents() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Name returns a slice string, such as []int
|
||||
func (t ArrayType) Name() string {
|
||||
return t.RawName
|
||||
}
|
||||
|
||||
// Comments returns the comments of struct
|
||||
func (t ArrayType) Comments() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Documents returns the documents of struct
|
||||
func (t ArrayType) Documents() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Name returns a pointer string, such as *User
|
||||
func (t PointerType) Name() string {
|
||||
return t.RawName
|
||||
}
|
||||
|
||||
// Comments returns the comments of struct
|
||||
func (t PointerType) Comments() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Documents returns the documents of struct
|
||||
func (t PointerType) Documents() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Name returns a interface string, Its fixed value is interface{}
|
||||
func (t InterfaceType) Name() string {
|
||||
return t.RawName
|
||||
}
|
||||
|
||||
// Comments returns the comments of struct
|
||||
func (t InterfaceType) Comments() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Documents returns the documents of struct
|
||||
func (t InterfaceType) Documents() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ type (
|
||||
// ApiSyntax describes the syntax grammar
|
||||
ApiSyntax struct {
|
||||
Version string
|
||||
Doc Doc
|
||||
Comment Doc
|
||||
}
|
||||
|
||||
// ApiSpec describes a api file
|
||||
@@ -25,7 +27,9 @@ type (
|
||||
|
||||
// Import describes api import
|
||||
Import struct {
|
||||
Value string
|
||||
Value string
|
||||
Doc Doc
|
||||
Comment Doc
|
||||
}
|
||||
|
||||
// Group defines a set of routing information
|
||||
@@ -71,6 +75,10 @@ type (
|
||||
Docs Doc
|
||||
Handler string
|
||||
AtDoc AtDoc
|
||||
HandlerDoc Doc
|
||||
HandlerComment Doc
|
||||
Doc Doc
|
||||
Comment Doc
|
||||
}
|
||||
|
||||
// Service describes api service
|
||||
@@ -82,6 +90,8 @@ type (
|
||||
// Type defines api type
|
||||
Type interface {
|
||||
Name() string
|
||||
Comments() []string
|
||||
Documents() []string
|
||||
}
|
||||
|
||||
// DefineStruct describes api structure
|
||||
|
||||
Reference in New Issue
Block a user