body

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New[T any](store *store.Store, opts ...Option) *v3.RequestBody

New builds a request body for T. Unless T is op.NoContent, it adds an application/json media type by default.

Types

type Option

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

Option configures an OpenAPI request body. May be returned from a type implementing the RequestBody interface:

func (T) RequestBody() Option

func ContentType

func ContentType[T any](contentType string, opts ...mediatype.Option) Option

ContentType adds a typed content entry to the request body. Use this to add content types beyond the default application/json set by op.RequestBody[T].

func Description

func Description(s string) Option

Description sets the request body description.

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 request body component in components/requestBodies.

func Required

func Required(v bool) Option

Required sets whether the request body is required. Default: true.

type RequestBody

type RequestBody interface {
	RequestBody() Option
}

RequestBody may be implemented to set default request body options on a type.

func (T) RequestBody() body.Option

Jump to

Keyboard shortcuts

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