Documentation
¶
Overview ¶
Package respec provides a fluent API for adding OpenAPI metadata to http.HandlerFuncs.
Index ¶
- type BuilderMetadata
- type GroupBuilder
- type RouteBuilder
- func (rb *RouteBuilder[T]) Description(d string) *RouteBuilder[T]
- func (rb *RouteBuilder[T]) OverrideParam(name string, modifier func(*openapi3.Parameter)) *RouteBuilder[T]
- func (rb *RouteBuilder[T]) Security(schemeName string) *RouteBuilder[T]
- func (rb *RouteBuilder[T]) Summary(s string) *RouteBuilder[T]
- func (rb *RouteBuilder[T]) Tag(tags ...string) *RouteBuilder[T]
- func (rb *RouteBuilder[T]) Unwrap() T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuilderMetadata ¶ added in v0.2.8
type BuilderMetadata struct {
Summary string
Description string
Tags []string
Security []string
OverrideParams map[string]func(*openapi3.Parameter)
}
BuilderMetadata holds the parsed metadata for a single operation.
type GroupBuilder ¶ added in v0.2.1
type GroupBuilder struct {
// contains filtered or unexported fields
}
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
type RouteBuilder ¶ added in v0.2.8
type RouteBuilder[T any] struct { // contains filtered or unexported fields }
RouteBuilder is a generic struct that can hold a handler of any type `T`, along with its associated metadata.
func Route ¶
func Route[T any](handler T) *RouteBuilder[T]
Route is a generic function. It accepts a handler of any type `T` and returns a builder specialized for that type, `*RouteBuilder[T]`.
func (*RouteBuilder[T]) Description ¶ added in v0.2.8
func (rb *RouteBuilder[T]) Description(d string) *RouteBuilder[T]
Description sets the description for the operation.
func (*RouteBuilder[T]) OverrideParam ¶ added in v0.2.8
func (rb *RouteBuilder[T]) OverrideParam(name string, modifier func(*openapi3.Parameter)) *RouteBuilder[T]
OverrideParam provides fine-grained control over a single parameter.
func (*RouteBuilder[T]) Security ¶ added in v0.2.8
func (rb *RouteBuilder[T]) Security(schemeName string) *RouteBuilder[T]
Security applies a security scheme to the operation.
func (*RouteBuilder[T]) Summary ¶ added in v0.2.8
func (rb *RouteBuilder[T]) Summary(s string) *RouteBuilder[T]
Summary sets the summary for the operation.
func (*RouteBuilder[T]) Tag ¶ added in v0.2.8
func (rb *RouteBuilder[T]) Tag(tags ...string) *RouteBuilder[T]
Tag adds one or more tags to the operation.
func (*RouteBuilder[T]) Unwrap ¶ added in v0.2.8
func (rb *RouteBuilder[T]) Unwrap() T
Unwrap returns the original handler, preserving its exact original type `T`.