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) GetParamModifiers() map[string]ParamModifier
- func (b *Builder) GetSecurity() []string
- func (b *Builder) GetSummary() string
- func (b *Builder) GetTags() []string
- func (b *Builder) OverrideParam(name string, modifier ParamModifier) *Builder
- func (b *Builder) Security(schemeName string) *Builder
- func (b *Builder) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (b *Builder) Summary(s string) *Builder
- func (b *Builder) Tag(tags ...string) *Builder
- type GroupBuilder
- type ParamModifier
- type ResponseModifier
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
}
func GetByHandler ¶ added in v0.2.0
func Handler ¶ added in v0.2.1
func Handler(handler http.HandlerFunc) *Builder
Handler wraps an http.HandlerFunc to allow for metadata decoration. This is the main entry point for developers adding endpoint-specific metadata. Usage: r.Post("/users", respec.Handler(myHandler).Tag("Users"))
func (*Builder) Description ¶
func (*Builder) GetDescription ¶
func (*Builder) GetParamModifiers ¶
func (b *Builder) GetParamModifiers() map[string]ParamModifier
func (*Builder) GetSecurity ¶
func (*Builder) GetSummary ¶
func (*Builder) OverrideParam ¶
func (b *Builder) OverrideParam(name string, modifier ParamModifier) *Builder
type GroupBuilder ¶ added in v0.2.1
type GroupBuilder struct {
// contains filtered or unexported fields
}
func Group ¶
func Group(groupFunc func()) *GroupBuilder
Group is a marker function used to apply metadata to a block of routes. At runtime, it simply executes the provided function to register the routes. Its primary purpose is to serve as a detectable anchor for the static analyzer.
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
type ParamModifier ¶
type ResponseModifier ¶
Click to show internal directories.
Click to hide internal directories.