Documentation
¶
Overview ¶
Package respec provides a fluent API for adding OpenAPI metadata to handlers.
Index ¶
- type GroupBuilder
- type HandlerBuilder
- func (hb *HandlerBuilder[T]) Description(d string) *HandlerBuilder[T]
- func (hb *HandlerBuilder[T]) Security(schemeName string) *HandlerBuilder[T]
- func (hb *HandlerBuilder[T]) Summary(s string) *HandlerBuilder[T]
- func (hb *HandlerBuilder[T]) Tag(tags ...string) *HandlerBuilder[T]
- func (hb *HandlerBuilder[T]) Unwrap() T
- type HandlerMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GroupBuilder ¶ added in v0.2.1
type GroupBuilder struct {
// contains filtered or unexported fields
}
GroupBuilder stores metadata for a group of routes.
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
NewGroupBuilder creates a new GroupBuilder instance.
func (*GroupBuilder) GetSecurity ¶ added in v0.2.2
func (b *GroupBuilder) GetSecurity() []string
GetSecurity returns the security schemes for the group.
func (*GroupBuilder) GetTags ¶ added in v0.2.2
func (b *GroupBuilder) GetTags() []string
GetTags returns the tags for the group.
func (*GroupBuilder) Security ¶ added in v0.2.1
func (b *GroupBuilder) Security(schemeName string) *GroupBuilder
Security adds a security scheme to the group.
func (*GroupBuilder) Tag ¶ added in v0.2.1
func (b *GroupBuilder) Tag(tags ...string) *GroupBuilder
Tag adds tags to the group.
type HandlerBuilder ¶ added in v0.2.9
type HandlerBuilder[T any] struct { // contains filtered or unexported fields }
HandlerBuilder is a generic struct that holds a handler of any type `T` and the chainable metadata associated with it.
func Handler ¶ added in v0.2.1
func Handler[T any](handler T) *HandlerBuilder[T]
Handler is a generic function. It accepts a handler of any type `T` and returns a builder specialized for that type, `*HandlerBuilder[T]`.
func (*HandlerBuilder[T]) Description ¶ added in v0.2.9
func (hb *HandlerBuilder[T]) Description(d string) *HandlerBuilder[T]
Description sets the description for the operation.
func (*HandlerBuilder[T]) Security ¶ added in v0.2.9
func (hb *HandlerBuilder[T]) Security(schemeName string) *HandlerBuilder[T]
Security applies a security scheme to the operation.
func (*HandlerBuilder[T]) Summary ¶ added in v0.2.9
func (hb *HandlerBuilder[T]) Summary(s string) *HandlerBuilder[T]
Summary sets the summary for the operation.
func (*HandlerBuilder[T]) Tag ¶ added in v0.2.9
func (hb *HandlerBuilder[T]) Tag(tags ...string) *HandlerBuilder[T]
Tag adds one or more tags to the operation.
func (*HandlerBuilder[T]) Unwrap ¶ added in v0.2.9
func (hb *HandlerBuilder[T]) Unwrap() T
Unwrap returns the original handler, preserving its exact original type `T`. This makes the entire chain compatible with any Go web framework.