parameter

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InQuery  = In("query")
	InHeader = In("header")
	InCookie = In("cookie")
	InPath   = In("path")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentSpec

type ContentSpec struct {
	Content map[string]media.Type `json:"content"`
}

type In

type In string

type Parameter

type Parameter interface {
	// contains filtered or unexported methods
}

func FromStruct

func FromStruct(Struct reflect.Type, in In) ([]Parameter, error)

type Reference

type Reference struct {
}

Reference to a component.

type SchemaSpec

type SchemaSpec struct {
	schema.Schema `flatten:""`

	// Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for "query" - "form"; for "path" - "simple"; for "header" - "simple"; for "cookie" - "form".
	Style *string `json:"style,omitempty"`

	// When this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this field has no effect. When style is "form", the default value is true. For all other styles, the default value is false. Note that despite false being the default for deepObject, the combination of false with deepObject is undefined.
	Explode *bool `json:"explode,omitempty"`

	Example  *shared.Json       `json:"example,omitempty"`
	Examples *[]example.Example `json:"examples,omitempty"`
}

func (SchemaSpec) MarshalJSON

func (s SchemaSpec) MarshalJSON() ([]byte, error)

type Spec

type Spec struct {
	// The name of the parameter. Parameter names are case sensitive.
	//
	// If in is "path", the name field MUST correspond to a template expression occurring within the path field in the Paths Object. See Path Templating for further information.
	// If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored.
	// For all other cases, the name corresponds to the parameter name used by the in field.
	Name string `json:"name"`

	// The location of the parameter. Possible values are "query", "header", "path" or "cookie".
	In In `json:"in"`

	// Description. May include Markdown.
	Description *string `json:"description,omitempty"`

	Required bool `json:"required,omitempty"`

	Deprecated bool `json:"deprecated,omitempty"`

	// Structure and syntax of the parameter.
	//
	// Mutually exclusive with Schema.
	*ContentSpec `json:"content,omitempty" flatten:""`

	// Media type and schema for the parameter.
	//
	// Mutually exclusive with Content.
	*SchemaSpec `json:"schema,omitempty"`
}

Specification for a parameter.

func FromField

func FromField(container reflect.Type, from reflect.StructField, in In) (Spec, error)

func (Spec) MarshalJSON

func (s Spec) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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