param

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: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InPath identifies a path parameter.
	InPath = "path"
	// InQuery identifies a query parameter.
	InQuery = "query"
	// InHeader identifies a header parameter.
	InHeader = "header"
	// InCookie identifies a cookie parameter.
	InCookie = "cookie"
)

Variables

This section is empty.

Functions

func New

func New[T any](in, name string, store *store.Store, opts ...Option) *v3.Parameter

New builds a parameter for T in the given location with the provided name.

Types

type Option

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

Option configures an OpenAPI parameter. May be returned from a type implementing the Parameter interface:

func (T) Parameter() Option

func AllowEmptyValue

func AllowEmptyValue() Option

AllowEmptyValue allows sending an empty value for the parameter. Default: false.

func AllowReserved

func AllowReserved() Option

AllowReserved allows reserved URI characters in query parameter values. Default: false.

func Deprecated

func Deprecated() Option

Deprecated marks the parameter as deprecated. Default: false.

func Description

func Description(s string) Option

Description sets the parameter description.

func Example

func Example(v any) Option

Example sets an example value for the parameter.

func Explode

func Explode(v bool) Option

Explode controls whether arrays and objects generate separate parameter instances. Default: true for form style, false for all others.

func NamedExample

func NamedExample(name string, value any, opts ...example.Option) Option

NamedExample adds a named example to the parameter.

func NamedExampleRef

func NamedExampleRef(name, ref string) Option

NamedExampleRef adds a named example $ref to the parameter.

func Options

func Options(opts ...Option) Option

Options combines multiple options into one.

func Reference

func Reference(name string) Option

Reference sets a $ref to a named parameter component in components/parameters.

func Required

func Required(v bool) Option

Required sets whether the parameter is required. Default: false.

func Style

func Style(s string) Option

Style sets the serialization style for the parameter. Valid values: matrix, label, form, simple, spaceDelimited, pipeDelimited, deepObject.

type Parameter

type Parameter interface {
	Parameter() Option
}

Parameter may be implemented to set default parameter options on a type.

func (T) Parameter() param.Option

Jump to

Keyboard shortcuts

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