operation

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package operation holds what the server, the client and the MCP generators share about an operation: the fields its parameters and bodies go in, the Go type of a body, the status code a response key names, how the runtime names a parameter's style, the encoding of a form body, and the parts the types of an operation are declared in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseMediaType

func BaseMediaType(mediaType string) string

BaseMediaType is a media type in lower case and without its parameters.

func BodyFields

func BodyFields(bodies []gomodel.Content, n *naming.Namer) []string

BodyFields names the options field of each body: Body for one, else Body and the tag of its media type. Two media types with one tag, such as application/xml and text/xml, are told apart by the type, then by a number.

func BodyType

func BodyType(c gomodel.Content) gomodel.Type

BodyType is the Go type a body field holds: the schema's type, held by pointer unless it can be nil, or any for JSON without a schema, a string for text and bytes for anything else.

func Concrete

func Concrete(mediaType string) string

Concrete is the media type a body under mediaType is sent as: the member of a range that has one, else mediaType without parameters.

func Doc

func Doc(head string, op *spec.Operation, isDescribed bool) string

Doc is head, then the summary and description when isDescribed, then any deprecation note.

func Encoding

func Encoding(c gomodel.Content, runtimePkg string) string

Encoding writes the runtime.Encoding of a form body, nil when it declares none.

func FirstBody

func FirstBody(contents []gomodel.Content) (gomodel.Content, bool)

FirstBody is the JSON body of a response, else its first one.

func FrameType

func FrameType(c gomodel.Content) gomodel.Type

FrameType is the type of one frame: the item type, or bytes for none and for text.

func GroupField

func GroupField(in string, n *naming.Namer) string

GroupField names the options field that holds the parameters of location in: PathParams, Query, Headers or Cookies.

func IsJSONParam

func IsJSONParam(p *spec.Parameter) bool

IsJSONParam reports a parameter written as JSON: one with content application/json instead of a schema.

func IsTextValue

func IsTextValue(t gomodel.Type) bool

IsTextValue reports a type a text body holds as its text: a builtin, any included, or a type from a package such as time.Time.

func PartsOf

func PartsOf(types []gomodel.Type) []layout.PartID

PartsOf lists the parts the declarations behind types are in, each once and sorted.

func QueryStringField

func QueryStringField(op *gomodel.Operation, n *naming.Namer) string

QueryStringField names the options field of the querystring of op, QueryString added on a clash.

func QueryStringType

func QueryStringType(qs *gomodel.QueryString) gomodel.Type

QueryStringType is the Go type of the querystring field, held as a body is, any without a schema.

func StatusOf

func StatusOf(status string) int

StatusOf is the status code a response is answered with: the one its key names, else 500.

func Style

func Style(p *spec.Parameter) string

Style is the runtime constant of a parameter's style, the default of its location when it names none the runtime knows.

Types

This section is empty.

Jump to

Keyboard shortcuts

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