Documentation ¶
Index ¶
- Constants
- Variables
- func Build(data interface{}) *spec.Schema
- func BuildOpenAPIWebService(wss []*restful.WebService, path string, postfun func(swagger *spec.Swagger)) *restful.WebService
- func CompilePathPattern(pattern string) ([][]Element, error)
- func IntFmtProperty(format string) *spec.Schema
- func MatchSection(compiled []Element, sections []string) (bool, bool, map[string]string)
- func ObjectProperty() *spec.Schema
- func ParamIn(kind int) string
- func ParsePathTokens(path string) []string
- func TypeName(t reflect.Type) string
- type Builder
- type CompileError
- type Element
- type ElementKind
- type Function
- type Group
- type InterfaceBuildOption
- type Param
- type ParamKind
- type PathTokens
- type ResponseMeta
- type Route
- type Router
- func (m *Router) ANY(path string, handler gin.HandlerFunc)
- func (m *Router) DELETE(path string, handler gin.HandlerFunc)
- func (m *Router) GET(path string, handler gin.HandlerFunc)
- func (m *Router) Match(c *gin.Context) gin.HandlerFunc
- func (m *Router) MustRegister(method, path string, handler gin.HandlerFunc)
- func (m *Router) PATCH(path string, handler gin.HandlerFunc)
- func (m *Router) POST(path string, handler gin.HandlerFunc)
- func (m *Router) PUT(path string, handler gin.HandlerFunc)
- func (m *Router) Register(method, path string, handler gin.HandlerFunc) error
- type SchemaBuildFunc
- type ServeMux
- type SwaggerBuilder
- type Tree
Constants ¶
View Source
const DefinitionsRoot = "#/definitions/"
Variables ¶
View Source
var ContextKeyPathVars = struct{ name string }{/* contains filtered or unexported fields */}
using get pathvars from context.Context returns map[string]string{}
View Source
var DefaultBuilder = NewBuilder(InterfaceBuildOptionOverride)
View Source
var DefaultNotFoundHandler = gin.WrapF(http.NotFound)
Functions ¶
func BuildOpenAPIWebService ¶
func CompilePathPattern ¶
func IntFmtProperty ¶
StrFmtProperty creates a property for the named string format
func MatchSection ¶
func ObjectProperty ¶
func ParsePathTokens ¶
Types ¶
type Builder ¶
type Builder struct { InterfaceBuildOption InterfaceBuildOption Definitions map[string]spec.Schema }
func NewBuilder ¶
func NewBuilder(interfaceOption InterfaceBuildOption) *Builder
type CompileError ¶
func (CompileError) Error ¶
func (e CompileError) Error() string
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
func CompileSection ¶
func MustCompileSection ¶
type ElementKind ¶
type ElementKind string
const ( ElementKindNone ElementKind = "" ElementKindConst ElementKind = "const" ElementKindVariable ElementKind = "{}" ElementKindStar ElementKind = "*" ElementKindSplit ElementKind = "/" )
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func (*Group) AddSubGroup ¶
func (*Group) Parameters ¶
type InterfaceBuildOption ¶
type InterfaceBuildOption string
const ( InterfaceBuildOptionDefault InterfaceBuildOption = "" // default as an 'object{}' InterfaceBuildOptionOverride InterfaceBuildOption = "override" // override using interface's value if exist InterfaceBuildOptionIgnore InterfaceBuildOption = "ignore" // ignore interface field InterfaceBuildOptionMerge InterfaceBuildOption = "merge" // anyOf 'object{}' type and interface's value type )
type Param ¶
type Param struct { Name string Kind ParamKind Type string IsOptional bool Description string Example interface{} }
func BodyParameter ¶
func FormParameter ¶
func PathParameter ¶
func QueryParameter ¶
type PathTokens ¶
type PathTokens struct {
Tokens []string
}
type ResponseMeta ¶
type Route ¶
type Route struct { Summary string Path string Method string Func Function Params []Param Responses []ResponseMeta Properties map[string]interface{} }
func (*Route) Parameters ¶
func (*Route) SetProperty ¶
type Router ¶
type Router struct { Notfound gin.HandlerFunc // contains filtered or unexported fields }
func (*Router) MustRegister ¶
func (m *Router) MustRegister(method, path string, handler gin.HandlerFunc)
type ServeMux ¶
type ServeMux struct {
// contains filtered or unexported fields
}
ServeMux is a http.ServeMux like library,but support path variable
func NewServeMux ¶
func NewServeMux() *ServeMux
func (*ServeMux) HandlerFunc ¶
type SwaggerBuilder ¶
type SwaggerBuilder struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.