response

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithSchemaName

func WithSchemaName(name string) func(*bodyOpt)

WithSchemaName to override generated schema name from struct name to this name. For example, if you don't specify this it will use package.StructName as the schema name, but if you define this, then we will use this as the schema name.

Types

type Response

type Response struct {
	// contains filtered or unexported fields
}

func NewResponse

func NewResponse() *Response

NewResponse only return one openapi3respRef openapi3.ResponseRef. If one path can contain multiple response openapi3schema, then it must have different http code.

func (*Response) Body

func (r *Response) Body(contentType string, data interface{}, opts ...func(*bodyOpt)) *Response

func (*Response) BodyWithSchema

func (r *Response) BodyWithSchema(contentType, schemaName string, schemaRef *openapi3.SchemaRef) *Response

func (*Response) Components

func (r *Response) Components(gen *openapi3gen.Generator, responseName, httpCode string) (components openapi3.Components, err error)

Components returns openapi3.Components with the value of following fields: * openapi3.Schemas * openapi3.Headers * openapi3.Responses

func (*Response) Description

func (r *Response) Description(desc string) *Response

Description will be added to new line each called.

func (*Response) Header

func (r *Response) Header(h *header.Header) *Response

Jump to

Keyboard shortcuts

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