Documentation ¶
Index ¶
- Constants
- func InitializeApiRoutes(r kelly.Kelly, config *Config, docLoader DocLoader)
- func SetGlobalParam(extra *StructParam) kelly.AnnotationHandlerFunc
- func SliceContain(s []string, e string) bool
- func Swagger(extra *StructParam) kelly.AnnotationHandlerFunc
- func SwaggerFile(entry string) kelly.AnnotationHandlerFunc
- type Config
- type DocLoader
- type JsonSchemaObj
- type SecurityDefinition
- type StructParam
- type SuccessResp
- type SwaggerDocFile
- type SwaggerEntry
- type SwaggerMethodEntry
- type SwaggerMethodParameter
Constants ¶
View Source
const SwaggerGlobalParam = "_swaggerGlobalParamKey"
Variables ¶
This section is empty.
Functions ¶
func InitializeApiRoutes ¶
func SetGlobalParam ¶
func SetGlobalParam(extra *StructParam) kelly.AnnotationHandlerFunc
func SliceContain ¶
func Swagger ¶
func Swagger(extra *StructParam) kelly.AnnotationHandlerFunc
func SwaggerFile ¶
func SwaggerFile(entry string) kelly.AnnotationHandlerFunc
Types ¶
type Config ¶
type Config struct { // "api前缀,例如/api/v1",默认为空 BasePath string // swagger文档标题 Title string // swagger文档描述 Description string // 文档版本 DocVersion string // swagger ui的地址 SwaggerUiUrl string // 文档Url地址,例如开发服务器http://baidu.com // 如果本值是doc,那么http://baidu.com/doc就可以重定向到@SwaggerUiUrl SwaggerUrlPrefix string // swagger文档的地址,用于调试,release直接打包到二进制里面。默认为空 DocFilePath string // 用于支持swagger ui认证头的参数 Headers []SecurityDefinition // 是否调试模式 Debug bool }
type JsonSchemaObj ¶
type JsonSchemaObj struct { Description string `json:"description,omitempty" yaml:"description"` Type string `json:"type,omitempty" yaml:"type" binding:"required,min=1"` Items *JsonSchemaObj `json:"items,omitempty" yaml:"items"` Properties map[string]*JsonSchemaObj `json:"properties,omitempty" yaml:"properties"` Required []string `json:"required,omitempty" yaml:"required"` Schema *JsonSchemaObj `json:"schema,omitempty" yaml:"schema"` }
func (*JsonSchemaObj) ParseObject ¶
func (obj *JsonSchemaObj) ParseObject(variable interface{})
type SecurityDefinition ¶
type StructParam ¶
type SuccessResp ¶
type SwaggerDocFile ¶
type SwaggerDocFile map[string]SwaggerMethodEntry
type SwaggerEntry ¶
type SwaggerEntry struct { Post *SwaggerMethodEntry `json:"post,omitempty"` Get *SwaggerMethodEntry `json:"get,omitempty"` Put *SwaggerMethodEntry `json:"put,omitempty"` Delete *SwaggerMethodEntry `json:"delete,omitempty"` Patch *SwaggerMethodEntry `json:"patch,omitempty"` }
func (*SwaggerEntry) SetMethod ¶
func (sentry *SwaggerEntry) SetMethod(method string, entry SwaggerMethodEntry)
type SwaggerMethodEntry ¶
type SwaggerMethodEntry struct { Description string `json:"description,omitempty" yaml:"description"` Summary string `json:"summary" yaml:"summary"` Tags []string `json:"tags" yaml:"tags" binding:"required,dive,required"` Parameters []*SwaggerMethodParameter `json:"parameters" yaml:"parameters" binding:"dive"` Produces []string `json:"produces,omitempty" yaml:"produces"` Responses map[int]*JsonSchemaObj `json:"responses" yaml:"responses" binding:"required"` }
func NewSwaggerMethodEntry ¶
func NewSwaggerMethodEntry(param *StructParam) *SwaggerMethodEntry
type SwaggerMethodParameter ¶
type SwaggerMethodParameter struct { Description string `json:"description,omitempty" yaml:"description"` In string `json:"in" yaml:"in" binding:"eq=query|eq=path|eq=formData|eq=body|eq=header"` Name string `json:"name" yaml:"name" binding:"required,max=100,min=1"` Required bool `json:"required" yaml:"required"` Type string `json:"type" yaml:"type" binding:"eq=string|eq=integer|eq=number|eq=boolean|eq=array|eq=object|eq=file"` Schema *JsonSchemaObj `json:"schema,omitempty" yaml:"schema"` }
Click to show internal directories.
Click to hide internal directories.