Documentation ¶
Index ¶
- Variables
- func Deprecated(deprecated bool) func(*openapi.OperationInfo)
- func Description(desc string) func(*openapi.OperationInfo)
- func Descriptionf(format string, a ...interface{}) func(*openapi.OperationInfo)
- func Header(name, desc string, model interface{}) func(*openapi.OperationInfo)
- func ID(id string) func(*openapi.OperationInfo)
- func InputModel(model interface{}) func(*openapi.OperationInfo)
- func NoSecurity() func(*openapi.OperationInfo)
- func OperationFromContext(c *gin.Context) (*openapi.Operation, error)
- func Response(statusCode, desc string, model interface{}, headers []*openapi.ResponseHeader, ...) func(*openapi.OperationInfo)
- func ResponseWithExamples(statusCode, desc string, model interface{}, headers []*openapi.ResponseHeader, ...) func(*openapi.OperationInfo)
- func Security(security *openapi.SecurityRequirement) func(*openapi.OperationInfo)
- func StatusDescription(desc string) func(*openapi.OperationInfo)
- func Summary(summary string) func(*openapi.OperationInfo)
- func Summaryf(format string, a ...interface{}) func(*openapi.OperationInfo)
- func XCodeSample(cs *openapi.XCodeSample) func(*openapi.OperationInfo)
- type Fizz
- type OperationOption
- type RouterGroup
- func (g *RouterGroup) DELETE(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
- func (g *RouterGroup) GET(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
- func (g *RouterGroup) Group(path, name, description string, handlers ...gin.HandlerFunc) *RouterGroup
- func (g *RouterGroup) HEAD(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
- func (g *RouterGroup) Handle(path, method string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
- func (g *RouterGroup) OPTIONS(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
- func (g *RouterGroup) PATCH(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
- func (g *RouterGroup) POST(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
- func (g *RouterGroup) PUT(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
- func (g *RouterGroup) TRACE(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
- func (g *RouterGroup) Use(handlers ...gin.HandlerFunc)
Constants ¶
This section is empty.
Variables ¶
var ( Integer int32 Long int64 Float float32 Double float64 String string Byte []byte Binary []byte Boolean bool DateTime time.Time )
Primitive type helpers.
Functions ¶
func Deprecated ¶
func Deprecated(deprecated bool) func(*openapi.OperationInfo)
Deprecated marks the operation as deprecated.
func Description ¶
func Description(desc string) func(*openapi.OperationInfo)
Description adds a description to an operation.
func Descriptionf ¶
func Descriptionf(format string, a ...interface{}) func(*openapi.OperationInfo)
Descriptionf adds a description to an operation according to a format specifier.
func Header ¶
func Header(name, desc string, model interface{}) func(*openapi.OperationInfo)
Header adds a header to the operation.
func InputModel ¶
func InputModel(model interface{}) func(*openapi.OperationInfo)
InputModel overrides the binding model of the operation.
func NoSecurity ¶
func NoSecurity() func(*openapi.OperationInfo)
NoSecurity explicitly removes all security.
func OperationFromContext ¶
OperationFromContext returns the OpenAPI operation from the givent Gin context or an error if none is found.
func Response ¶
func Response(statusCode, desc string, model interface{}, headers []*openapi.ResponseHeader, example interface{}) func(*openapi.OperationInfo)
Response adds an additional response to the operation.
func ResponseWithExamples ¶
func ResponseWithExamples(statusCode, desc string, model interface{}, headers []*openapi.ResponseHeader, examples map[string]interface{}) func(*openapi.OperationInfo)
ResponseWithExamples is a variant of Response that accept many examples.
func Security ¶
func Security(security *openapi.SecurityRequirement) func(*openapi.OperationInfo)
Security adds a security definition to an operation.
func StatusDescription ¶
func StatusDescription(desc string) func(*openapi.OperationInfo)
StatusDescription sets the default status description of the operation.
func Summary ¶
func Summary(summary string) func(*openapi.OperationInfo)
Summary adds a summary to an operation.
func Summaryf ¶
func Summaryf(format string, a ...interface{}) func(*openapi.OperationInfo)
Summaryf adds a summary to an operation according to a format specifier.
func XCodeSample ¶
func XCodeSample(cs *openapi.XCodeSample) func(*openapi.OperationInfo)
XCodeSample adds a code sample to the operation.
Types ¶
type Fizz ¶
type Fizz struct { *RouterGroup // contains filtered or unexported fields }
Fizz is an abstraction of a Gin engine that wraps the routes handlers with Tonic and generates an OpenAPI 3.0 specification from it.
func NewFromEngine ¶
NewFromEngine creates a new Fizz wrapper from an existing Gin engine.
type OperationOption ¶
type OperationOption func(*openapi.OperationInfo)
OperationOption represents an option-pattern function used to add informations to an operation.
type RouterGroup ¶
type RouterGroup struct { Name string Description string // contains filtered or unexported fields }
RouterGroup is an abstraction of a Gin router group.
func (*RouterGroup) DELETE ¶
func (g *RouterGroup) DELETE(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
DELETE is a shortcut to register a new handler with the DELETE method.
func (*RouterGroup) GET ¶
func (g *RouterGroup) GET(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
GET is a shortcut to register a new handler with the GET method.
func (*RouterGroup) Group ¶
func (g *RouterGroup) Group(path, name, description string, handlers ...gin.HandlerFunc) *RouterGroup
Group creates a new group of routes.
func (*RouterGroup) HEAD ¶
func (g *RouterGroup) HEAD(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
HEAD is a shortcut to register a new handler with the HEAD method.
func (*RouterGroup) Handle ¶
func (g *RouterGroup) Handle(path, method string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
Handle registers a new request handler that is wrapped with Tonic and documented in the OpenAPI specification.
func (*RouterGroup) OPTIONS ¶
func (g *RouterGroup) OPTIONS(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
OPTIONS is a shortcut to register a new handler with the OPTIONS method.
func (*RouterGroup) PATCH ¶
func (g *RouterGroup) PATCH(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
PATCH is a shortcut to register a new handler with the PATCH method.
func (*RouterGroup) POST ¶
func (g *RouterGroup) POST(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
POST is a shortcut to register a new handler with the POST method.
func (*RouterGroup) PUT ¶
func (g *RouterGroup) PUT(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
PUT is a shortcut to register a new handler with the PUT method.
func (*RouterGroup) TRACE ¶
func (g *RouterGroup) TRACE(path string, infos []OperationOption, handlers ...gin.HandlerFunc) *RouterGroup
TRACE is a shortcut to register a new handler with the TRACE method.
func (*RouterGroup) Use ¶
func (g *RouterGroup) Use(handlers ...gin.HandlerFunc)
Use adds middleware to the group.