Documentation
¶
Overview ¶
Package respec provides a fluent API for adding OpenAPI metadata to http.HandlerFuncs.
Index ¶
- type Builder
- func (b *Builder) Description(d string) *Builder
- func (b *Builder) GetDescription() string
- func (b *Builder) GetSecurity() []string
- func (b *Builder) GetSummary() string
- func (b *Builder) GetTags() []string
- func (b *Builder) Security(schemeName string) *Builder
- func (b *Builder) Summary(s string) *Builder
- func (b *Builder) Tag(tags ...string) *Builder
- func (b *Builder) Unwrap() http.HandlerFunc
- type GroupBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder holds the metadata and the original handler.
func GetByHandler ¶ added in v0.2.0
GetByHandler is called by the static analyzer.
func Handler ¶ added in v0.2.1
func Handler(handler http.HandlerFunc) *Builder
Handler wraps an http.HandlerFunc, allowing metadata to be chained to it. The chain must end with a call to .Unwrap() to return the original handler. Usage: r.Post("/users", respec.Handler(myHandler).Tag("Users").Unwrap())
func (*Builder) Description ¶
func (*Builder) GetDescription ¶
func (*Builder) GetSecurity ¶
func (*Builder) GetSummary ¶
Getters for the static analyzer to read the final values.
func (*Builder) Unwrap ¶ added in v0.2.4
func (b *Builder) Unwrap() http.HandlerFunc
Unwrap is the final method in the chain. It returns the original, undecorated http.HandlerFunc, satisfying the router's type requirements.
type GroupBuilder ¶ added in v0.2.1
type GroupBuilder struct {
// contains filtered or unexported fields
}
func Meta ¶ added in v0.2.2
func Meta(router interface{}) *GroupBuilder
Meta provides a way to attach metadata to a router instance within a specific scope. This is a marker for the static analyzer.
func NewGroupBuilder ¶ added in v0.2.2
func NewGroupBuilder() *GroupBuilder
func (*GroupBuilder) GetSecurity ¶ added in v0.2.2
func (b *GroupBuilder) GetSecurity() []string
func (*GroupBuilder) GetTags ¶ added in v0.2.2
func (b *GroupBuilder) GetTags() []string
func (*GroupBuilder) Security ¶ added in v0.2.1
func (b *GroupBuilder) Security(schemeName string) *GroupBuilder
func (*GroupBuilder) Tag ¶ added in v0.2.1
func (b *GroupBuilder) Tag(tags ...string) *GroupBuilder