respec

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: MIT Imports: 7 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
}

func GetByHandler added in v0.2.0

func GetByHandler(handler types.Object) *Builder

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

func (*Builder) GetDescription

func (b *Builder) GetDescription() string

func (*Builder) GetParamModifiers

func (b *Builder) GetParamModifiers() map[string]ParamModifier

func (*Builder) GetSecurity

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

func (*Builder) GetSummary

func (b *Builder) GetSummary() string

func (*Builder) GetTags

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

func (*Builder) OverrideParam

func (b *Builder) OverrideParam(name string, modifier ParamModifier) *Builder

func (*Builder) Security

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

func (*Builder) ServeHTTP added in v0.2.0

func (b *Builder) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Builder) Summary

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

func (*Builder) Tag

func (b *Builder) Tag(tags ...string) *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 ParamModifier func(p *openapi3.Parameter)

type ResponseModifier

type ResponseModifier func(r *openapi3.Response)

Jump to

Keyboard shortcuts

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