Documentation
¶
Index ¶
- func GetHost() string
- func GetKvType(k string, isArray, isType bool) string
- func SetBasePath(b string)
- func SetExternalDocs(e ExternalDocs)
- func SetHost(h string)
- func SetInfo(i Info)
- func SetReqCtxType(isJSON, isXML bool)
- func SetRespCtxType(isJSON, isXML bool)
- func SetSchemes(isHTTP, isHTTPS bool)
- func SetVersion(v string)
- type APIBody
- type Definition
- type DocSwagger
- type Element
- type ExternalDocs
- type Head
- type Info
- type Param
- type Property
- type Schema
- type SecurityDefinition
- type Tag
- type XML
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIBody ¶
type APIBody struct {
Head
Info Info `json:"info"`
Host string `json:"host"` // http host
BasePath string `json:"basePath"` // 根级别
Tags []Tag `json:"tags"`
Schemes []string `json:"schemes"` // http/https
Paths map[string]map[string]Param `json:"paths"` // API 路径
SecurityDefinition SecurityDefinition `json:"securityDefinitions,omitempty"` // 安全验证
Definitions map[string]Definition `json:"definitions"` // 通用结构体定义
ExternalDocs ExternalDocs `json:"externalDocs"` // 外部链接
}
APIBody swagger api body info
type Definition ¶
type Definition struct {
Type string `json:"type"` // 类型 object
Properties map[string]Property `json:"properties"` // 属性列表
XML XML `json:"xml"`
}
Definition 通用结构体定义
type DocSwagger ¶
type DocSwagger struct {
// contains filtered or unexported fields
}
DocSwagger ...
func (*DocSwagger) AddDefinitions ¶
func (doc *DocSwagger) AddDefinitions(key string, def Definition)
AddDefinitions 添加 通用结构体定义
type Element ¶
type Element struct {
In string `json:"in"` // 入参
Name string `json:"name"` // 参数名字
Description string `json:"description"` // 描述
Required bool `json:"required"` // 是否必须
Type string `json:"type,omitempty"` // 类型
Schema Schema `json:"schema"` // 引用
}
Element 元素定义
type ExternalDocs ¶
type ExternalDocs struct {
Description string `json:"description,omitempty"` // 描述
URL string `json:"url,omitempty"` // url addr
}
ExternalDocs tags of group
type Info ¶
type Info struct {
Description string `json:"description"`
Version string `json:"version"`
Title string `json:"title"`
}
Info 指定 API 的 info-title
type Param ¶
type Param struct {
Tags []string `json:"tags"` // 分组标记
Summary string `json:"summary"` // 摘要
Description string `json:"description"` // 描述
OperationID string `json:"operationId,omitempty"` // 操作id
Consumes []string `json:"consumes"` // Parameter content type
Produces []string `json:"produces"` // Response content type
Parameters []Element `json:"parameters"` // 请求参数
Responses map[string]map[string]string `json:"responses"` // 返回参数
Security interface{} `json:"security,omitempty"` // 认证信息
}
Param API 路径 paths 和操作在 API 规范的全局部分定义
type Property ¶
type Property struct {
Type string `json:"type,omitempty"` // 类型
Format string `json:"format"` // format 类型
Description string `json:"description"` // 描述
Enum interface{} `json:"enum,omitempty"` // enum
Ref string `json:"$ref,omitempty"` // 主体模式和响应主体模式中引用
}
Property 属性
type SecurityDefinition ¶
type SecurityDefinition struct {
PetstoreAuth interface{} `json:"petstore_auth,omitempty"` // 安全验证定义
AIPKey interface{} `json:"api_key,omitempty"` // api key
}
SecurityDefinition 安全验证
type Tag ¶
type Tag struct {
Name string `json:"name"` // tags name
Description string `json:"description"` // 描述
ExternalDocs *ExternalDocs `json:"externalDocs,omitempty"` // doc group of tags
}
Tag group of tags
Click to show internal directories.
Click to hide internal directories.