Documentation ¶
Index ¶
- func BodyParam(name string, schema *spec.Schema) *spec.Parameter
- func HeaderParam(name string, typ, format string) *spec.Parameter
- func NewBindResponse(i interface{}, description string) *spec.Response
- func NewResponse(description string) *spec.Response
- func PathParam(name string, typ, format string) *spec.Parameter
- type DefinitionField
- type Operation
- func (o *Operation) AddParam(param *spec.Parameter) *Operation
- func (o *Operation) BindParam(i interface{}, description string) *Operation
- func (o *Operation) Deprecate() *Operation
- func (o *Operation) Process() error
- func (o *Operation) RemoveParam(name, in string) *Operation
- func (o *Operation) RespondsWith(code int, response *spec.Response) *Operation
- func (o *Operation) SecuredWith(name string, scopes ...string) *Operation
- func (o *Operation) Undeprecate() *Operation
- func (o *Operation) WithConsumes(mediaTypes ...string) *Operation
- func (o *Operation) WithDefaultResponse(response *spec.Response) *Operation
- func (o *Operation) WithDescription(description string) *Operation
- func (o *Operation) WithExternalDocs(description, url string) *Operation
- func (o *Operation) WithID(id string) *Operation
- func (o *Operation) WithProduces(mediaTypes ...string) *Operation
- func (o *Operation) WithSchemes(schemes ...string) *Operation
- func (o *Operation) WithSummary(summary string) *Operation
- func (o *Operation) WithTags(tags ...string) *Operation
- type Swagger
- func (s *Swagger) AddApiKeySecurityDefinition(name string, in string) *Swagger
- func (s *Swagger) AddBasicSecurityDefinition() *Swagger
- func (s *Swagger) AddDefinition(name string, schema *spec.Schema) *Swagger
- func (s *Swagger) AddOauth2AccessCodeSecurityDefinition(name string, authorizationUrl string, tokenUrl string, ...) *Swagger
- func (s *Swagger) AddOauth2ApplicationSecurityDefinition(name string, tokenUrl string, scopes map[string]string) *Swagger
- func (s *Swagger) AddOauth2ImplicitSecurityDefinition(name string, authorizationUrl string, scopes map[string]string) *Swagger
- func (s *Swagger) AddOauth2PasswordSecurityDefinition(name string, tokenUrl string, scopes map[string]string) *Swagger
- func (s *Swagger) AddPath(path string, method string, op web.Operation)
- func (s *Swagger) BindDefinitionWithTags(i interface{}, attachFields map[string]DefinitionField) *Swagger
- func (s *Swagger) BindDefinitions(i ...interface{}) *Swagger
- func (s *Swagger) ReadDoc() string
- func (s *Swagger) WithBasePath(basePath string) *Swagger
- func (s *Swagger) WithConsumes(consumes ...string) *Swagger
- func (s *Swagger) WithContact(name string, url string, email string) *Swagger
- func (s *Swagger) WithDescription(description string) *Swagger
- func (s *Swagger) WithExternalDocs(externalDocs *spec.ExternalDocumentation) *Swagger
- func (s *Swagger) WithHost(host string) *Swagger
- func (s *Swagger) WithID(id string) *Swagger
- func (s *Swagger) WithLicense(name string, url string) *Swagger
- func (s *Swagger) WithProduces(produces ...string) *Swagger
- func (s *Swagger) WithSchemes(schemes ...string) *Swagger
- func (s *Swagger) WithTags(tags ...spec.Tag) *Swagger
- func (s *Swagger) WithTermsOfService(termsOfService string) *Swagger
- func (s *Swagger) WithTitle(title string) *Swagger
- func (s *Swagger) WithVersion(version string) *Swagger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HeaderParam ¶
HeaderParam creates a header parameter, this is always required by default
func NewBindResponse ¶
NewBindResponse creates a new response instance
func NewResponse ¶
NewResponse creates a new response instance
Types ¶
type DefinitionField ¶
type DefinitionField struct { Description string Example interface{} Enums []interface{} }
type Operation ¶
Operation 封装 *spec.Operation 对象,提供更多功能
func NewOperation ¶
NewOperation creates a new operation instance.
func (*Operation) RemoveParam ¶
RemoveParam removes a parameter from the operation
func (*Operation) RespondsWith ¶
RespondsWith adds a status code response to the operation.
func (*Operation) SecuredWith ¶
SecuredWith adds a security scope to this operation.
func (*Operation) Undeprecate ¶
Undeprecate marks the operation as not deprecated
func (*Operation) WithConsumes ¶
WithConsumes adds media types for incoming body values
func (*Operation) WithDefaultResponse ¶
WithDefaultResponse adds a default response to the operation.
func (*Operation) WithDescription ¶
WithDescription sets the description on this operation, allows for chaining
func (*Operation) WithExternalDocs ¶
WithExternalDocs sets/removes the external docs for/from this operation.
func (*Operation) WithProduces ¶
WithProduces adds media types for outgoing body values
func (*Operation) WithSchemes ¶
SetSchemes 设置服务协议
func (*Operation) WithSummary ¶
WithSummary sets the summary on this operation, allows for chaining
type Swagger ¶
Swagger 封装 spec.Swagger 对象,提供流式调用
func (*Swagger) AddApiKeySecurityDefinition ¶
AddApiKeySecurityDefinition 添加 ApiKey 方式认证
func (*Swagger) AddBasicSecurityDefinition ¶
AddBasicSecurityDefinition 添加 Basic 方式认证
func (*Swagger) AddDefinition ¶
AddDefinition 添加一个定义
func (*Swagger) AddOauth2AccessCodeSecurityDefinition ¶
func (s *Swagger) AddOauth2AccessCodeSecurityDefinition(name string, authorizationUrl string, tokenUrl string, scopes map[string]string) *Swagger
AddOauth2AccessCodeSecurityDefinition 添加 OAuth2 AccessCode 方式认证
func (*Swagger) AddOauth2ApplicationSecurityDefinition ¶
func (s *Swagger) AddOauth2ApplicationSecurityDefinition(name string, tokenUrl string, scopes map[string]string) *Swagger
AddOauth2ApplicationSecurityDefinition 添加 OAuth2 Application 方式认证
func (*Swagger) AddOauth2ImplicitSecurityDefinition ¶
func (s *Swagger) AddOauth2ImplicitSecurityDefinition(name string, authorizationUrl string, scopes map[string]string) *Swagger
AddOauth2ImplicitSecurityDefinition 添加 OAuth2 Implicit 方式认证
func (*Swagger) AddOauth2PasswordSecurityDefinition ¶
func (s *Swagger) AddOauth2PasswordSecurityDefinition(name string, tokenUrl string, scopes map[string]string) *Swagger
AddOauth2PasswordSecurityDefinition 添加 OAuth2 Password 方式认证
func (*Swagger) BindDefinitionWithTags ¶
func (s *Swagger) BindDefinitionWithTags(i interface{}, attachFields map[string]DefinitionField) *Swagger
BindDefinitionWithTags 绑定一个定义
func (*Swagger) BindDefinitions ¶
BindDefinitions 绑定一个定义
func (*Swagger) WithBasePath ¶
WithBasePath 设置 API 路径的前缀
func (*Swagger) WithConsumes ¶
WithConsumes 设置消费协议
func (*Swagger) WithContact ¶
WithContact 设置作者的名字、主页地址、邮箱
func (*Swagger) WithDescription ¶
WithDescription 设置服务描述
func (*Swagger) WithExternalDocs ¶
func (s *Swagger) WithExternalDocs(externalDocs *spec.ExternalDocumentation) *Swagger
WithExternalDocs
func (*Swagger) WithLicense ¶
WithLicense 设置开源协议的名称、地址
func (*Swagger) WithProduces ¶
WithProduces 设置生产协议
func (*Swagger) WithSchemes ¶
WithSchemes 设置服务协议
func (*Swagger) WithTermsOfService ¶
WithTermsOfService 设置服务条款地址
func (*Swagger) WithVersion ¶
WithVersion 设置 API 版本号