pathitem

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOperation

func AddOperation(store *store.Store, item *v3.PathItem, method string, opt op.Option)

AddOperation applies opt to item for the given HTTP method. An empty method registers the operation for all supported methods.

func GetHandlers

func GetHandlers(p *Path) map[string]httpx.HandlerFunc

GetHandlers returns the registered handlers for each method on p. If no method is present the handler is registered for all supported methods.

func GetPathItem

func GetPathItem(p *Path, store *store.Store, item *v3.PathItem) *v3.PathItem

GetPathItem constructs an OpenAPI path item from p's options and operations. If a reference is set, the full item is stored in components and a $ref object is returned.

Types

type Option

type Option func(*v3.PathItem, *store.Store)

Option configures an OpenAPI path item.

func AdditionalOperation

func AdditionalOperation(name string, opt op.Option) Option

AdditionalOperation adds a named custom operation to the path item (OpenAPI 3.2+).

func Description

func Description(s string) Option

Description sets the description for the path item.

func Parameter

func Parameter[T any](in, name string, opts ...param.Option) Option

Parameter adds a shared parameter to the path item. in must be one of "path", "query", "header", or "cookie".

func Reference

func Reference(name string) Option

Reference sets a $ref to a named path item component in components/pathItems.

func Server

func Server(url, description string, opts ...server.Option) Option

Server adds a server override for the path item.

func Summary

func Summary(s string) Option

Summary sets a short summary for the path item.

type Path

type Path struct {
	// contains filtered or unexported fields
}

Path collects path item options, operations, and optional handlers for a single path.

func New

func New(opts ...Option) *Path

New creates a Path that collects path item options, operations, and handlers.

func (*Path) Handle

func (p *Path) Handle(method string, opt op.Option, handler http.Handler)

Handle registers an OpenAPI operation and a handler on the underlying mux.

func (*Path) HandleFunc

func (p *Path) HandleFunc(method string, opt op.Option, handler func(http.ResponseWriter, *http.Request))

HandleFunc registers an OpenAPI operation and a handler func on the underlying mux.

func (*Path) Operation

func (p *Path) Operation(method string, opt op.Option)

Operation registers an OpenAPI operation for the given method. If no method is present the operation is registered for all supported methods. Use this when the handler is registered separately.

func (*Path) PathItem

func (p *Path) PathItem() func(*store.Store) *v3.PathItem

PathItem returns a builder function that constructs the path item from p.

func (*Path) Route

func (p *Path) Route(method string, opt op.Option, handler func(http.ResponseWriter, *http.Request) error)

Route registers an OpenAPI operation and a handler on the underlying mux.

Jump to

Keyboard shortcuts

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