|
|
@ -11,10 +11,11 @@ import (
|
|
|
|
const (
|
|
|
|
const (
|
|
|
|
bodyTagKey = "json"
|
|
|
|
bodyTagKey = "json"
|
|
|
|
formTagKey = "form"
|
|
|
|
formTagKey = "form"
|
|
|
|
|
|
|
|
pathTagKey = "path"
|
|
|
|
defaultSummaryKey = "summary"
|
|
|
|
defaultSummaryKey = "summary"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var definedKeys = []string{bodyTagKey, formTagKey, "path"}
|
|
|
|
var definedKeys = []string{bodyTagKey, formTagKey, pathTagKey}
|
|
|
|
|
|
|
|
|
|
|
|
// Routes returns all routes in api service
|
|
|
|
// Routes returns all routes in api service
|
|
|
|
func (s Service) Routes() []Route {
|
|
|
|
func (s Service) Routes() []Route {
|
|
|
@ -25,7 +26,7 @@ func (s Service) Routes() []Route {
|
|
|
|
return result
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Tags retuens all tags in Member
|
|
|
|
// Tags returns all tags in Member
|
|
|
|
func (m Member) Tags() []*Tag {
|
|
|
|
func (m Member) Tags() []*Tag {
|
|
|
|
tags, err := Parse(m.Tag)
|
|
|
|
tags, err := Parse(m.Tag)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -141,7 +142,7 @@ func (t DefineStruct) GetFormMembers() []Member {
|
|
|
|
return result
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetNonBodyMembers retruns all have no tag fields
|
|
|
|
// GetNonBodyMembers returns all have no tag fields
|
|
|
|
func (t DefineStruct) GetNonBodyMembers() []Member {
|
|
|
|
func (t DefineStruct) GetNonBodyMembers() []Member {
|
|
|
|
var result []Member
|
|
|
|
var result []Member
|
|
|
|
for _, member := range t.Members {
|
|
|
|
for _, member := range t.Members {
|
|
|
@ -162,16 +163,16 @@ func (r Route) JoinedDoc() string {
|
|
|
|
return strings.TrimSpace(doc)
|
|
|
|
return strings.TrimSpace(doc)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetAnnotation returns the value by specified key
|
|
|
|
// GetAnnotation returns the value by specified key from @server
|
|
|
|
func (r Route) GetAnnotation(key string) string {
|
|
|
|
func (r Route) GetAnnotation(key string) string {
|
|
|
|
if r.Annotation.Properties == nil {
|
|
|
|
if r.AtServerAnnotation.Properties == nil {
|
|
|
|
return ""
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return r.Annotation.Properties[key]
|
|
|
|
return r.AtServerAnnotation.Properties[key]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetAnnotation returns the value by specified key
|
|
|
|
// GetAnnotation returns the value by specified key from @server
|
|
|
|
func (g Group) GetAnnotation(key string) string {
|
|
|
|
func (g Group) GetAnnotation(key string) string {
|
|
|
|
if g.Annotation.Properties == nil {
|
|
|
|
if g.Annotation.Properties == nil {
|
|
|
|
return ""
|
|
|
|
return ""
|
|
|
|