代码拉取完成,页面将自动刷新
package core
import (
"fmt"
"gitee.com/fast_api/api/def"
)
var (
_ def.SwaggerOps = (*swaggerImpl)(nil)
)
type swaggerImpl struct {
mi *def.MethodInfo
SwaggerSecurit
}
type SwaggerSecurit struct {
Ops []def.Option
}
// SecuritApiHeader implements def.SwaggerOps.
func (s *SwaggerSecurit) SecuritApiHeader(name string, headerName string) {
for i := 0; i < len(s.Ops); i++ {
s.Ops[i].StoreKV("swagger.securit", SecuritApiHeader(name, headerName))
}
}
// SecuritCookie implements def.SwaggerOps.
func (s *SwaggerSecurit) SecuritCookie(name string, cookieName string) {
for i := 0; i < len(s.Ops); i++ {
s.Ops[i].StoreKV("swagger.securit", SecuritCookie(name, cookieName))
}
}
// SecuritJwt implements def.SwaggerOps.
func (s *SwaggerSecurit) SecuritJwt(name string) {
for i := 0; i < len(s.Ops); i++ {
s.Ops[i].StoreKV("swagger.securit", SecuritJwt(name))
}
}
// SetParameterDescription implements def.SwaggerOps.
func (s *swaggerImpl) SetParameterDescription(name string, description string) {
s.mi.KV.Store(fmt.Sprintf("swagger.parameter.%s", name), description)
}
func (s *swaggerImpl) SetSummary(title string) {
s.mi.KV.Store("swagger.summary", title)
}
func (s *swaggerImpl) SetTag(tag string) {
s.mi.KV.Store("swagger.tag", tag)
}
func (s *swaggerImpl) SetDescription(description string) {
s.mi.KV.Store("swagger.description", description)
}
// Security Scheme Object
type SecurityObject struct {
Typ string `json:"type,omitempty"`
In string `json:"in,omitempty"`
Name string `json:"name,omitempty"`
Scheme string `json:"scheme,omitempty"`
BearerFormat string `json:"bearerformat,omitempty"`
}
func SecuritCookie(name string, cookieName string) map[string]*SecurityObject {
return map[string]*SecurityObject{
name: {
Typ: "apiKey",
In: "cookie",
Name: cookieName,
},
}
}
func SecuritApiHeader(name string, headerName string) map[string]*SecurityObject {
return map[string]*SecurityObject{
name: {
Typ: "apiKey",
In: "header",
Name: headerName,
},
}
}
func SecuritJwt(name string) map[string]*SecurityObject {
return map[string]*SecurityObject{
name: {
Typ: "http",
Scheme: "bearer",
BearerFormat: "JWT",
},
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。