param

package
v0.0.0-...-9a508a9 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidStyle    = errors.New("invalid parameter style")
	ErrInvalidLocation = errors.New("invalid parameter location")
)

Functions

This section is empty.

Types

type DataType

type DataType string

DataType represents the parameter data type.

const (
	DataTypePrimitive DataType = "primitive"
	DataTypeArray     DataType = "array"
	DataTypeObject    DataType = "object"
)

type InvalidParamStyleError

type InvalidParamStyleError struct {
	Struct reflect.Type
	Field  reflect.StructField
	// Type of the parameter, can be different than the field type.
	Type         reflect.Type
	Style        Style
	DataType     DataType
	Location     Location
	Msg          string
	UnderlineMsg string
	// contains filtered or unexported fields
}

func (InvalidParamStyleError) Error

func (e InvalidParamStyleError) Error() string

func (InvalidParamStyleError) ErrorWithColor

func (e InvalidParamStyleError) ErrorWithColor(c structs.Colors) string

func (InvalidParamStyleError) Unwrap

func (e InvalidParamStyleError) Unwrap() error

type Location

type Location string
const (
	LocationPath   Location = openapi.InPath
	LocationQuery  Location = openapi.InQuery
	LocationHeader Location = openapi.InHeader
	LocationCookie Location = openapi.InCookie
)

func LocationFromString

func LocationFromString(str string) (Location, error)

type Parameter

type Parameter struct {
	*openapi.Parameter
}

func FromInfo

func FromInfo(info param.Info, schemer jsonschema.Schemer) (Parameter, error)

func New

func New() Parameter

func (*Parameter) SetSchema

func (p *Parameter) SetSchema(schema jsonschema.Schema)

type Style

type Style string

https://spec.openapis.org/oas/v3.1.0#styleValues

const (
	StyleMatrix         Style = "matrix"
	StyleLabel          Style = "label"
	StyleForm           Style = "form"
	StyleSimple         Style = "simple"
	StyleSpaceDelimited Style = "spaceDelimited"
	StylePipeDelimited  Style = "pipeDelimited"
	StyleDeepObject     Style = "deepObject"
)

func GetStyleFromTag

func GetStyleFromTag(tag reflect.StructTag) (Style, error)

func StyleFromString

func StyleFromString(str string) (Style, error)

Jump to

Keyboard shortcuts

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