respec

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package respec provides a fluent API for adding OpenAPI metadata to http.HandlerFuncs.

Index

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

func GetByHandler(handler types.Object) *Builder

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 (b *Builder) Description(d string) *Builder

func (*Builder) GetDescription

func (b *Builder) GetDescription() string

func (*Builder) GetSecurity

func (b *Builder) GetSecurity() []string

func (*Builder) GetSummary

func (b *Builder) GetSummary() string

Getters for the static analyzer to read the final values.

func (*Builder) GetTags

func (b *Builder) GetTags() []string

func (*Builder) Security

func (b *Builder) Security(schemeName string) *Builder

func (*Builder) Summary

func (b *Builder) Summary(s string) *Builder

func (*Builder) Tag

func (b *Builder) Tag(tags ...string) *Builder

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL