docs

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTag       = "default"
	BindingTag       = "binding"
	HeaderTag        = "header"
	JsonTag          = "json"
	DefaultStatusTag = "default_status"
	StatusCodesTag   = "status_codes"
)

Variables

This section is empty.

Functions

func DefaultStatus

func DefaultStatus(type_ reflect.Type) int

Types

type Docs

type Docs struct {
	OpenAPIPath     string
	OpenAPI         *openapi3.T
	OpenAPIUrl      string
	Title           string
	TermsOfService  string
	Description     string
	License         *openapi3.License
	Contact         *openapi3.Contact
	Version         string
	OpenAPIFilePath string
	InMemory        bool
	CORS            *cors.Config
}

func (*Docs) AddServer

func (d *Docs) AddServer(addr string)

func (*Docs) Build

func (d *Docs) Build() error

func (*Docs) FixPath

func (d *Docs) FixPath(path string) string

func (*Docs) NewOpenAPI

func (d *Docs) NewOpenAPI()

func (*Docs) OpenAPIContent

func (d *Docs) OpenAPIContent() *openapi3.T

func (*Docs) PathItem

func (d *Docs) PathItem(path string) *openapi3.PathItem

func (*Docs) PathsIsEmpty

func (d *Docs) PathsIsEmpty() bool

func (*Docs) SetPath added in v0.4.0

func (d *Docs) SetPath(path string, method string, doc *Endpoint)

func (*Docs) SetPathItem

func (d *Docs) SetPathItem(path string, pathItem *openapi3.PathItem)

func (*Docs) Valid

func (d *Docs) Valid() error

type Endpoint added in v0.4.0

type Endpoint openapi3.Operation

func (*Endpoint) AddHeadersType added in v0.4.0

func (e *Endpoint) AddHeadersType(headerType reflect.Type)

func (*Endpoint) AddPathParam added in v0.4.0

func (e *Endpoint) AddPathParam(name string, type_ reflect.Type)

func (*Endpoint) SetBodyType added in v0.4.0

func (e *Endpoint) SetBodyType(bodyType reflect.Type)

func (*Endpoint) SetQueryType added in v0.4.0

func (e *Endpoint) SetQueryType(queryType reflect.Type)

func (*Endpoint) SetResponses added in v0.4.0

func (e *Endpoint) SetResponses(responseType reflect.Type, errorType reflect.Type)

func (*Endpoint) SetTagsFromPath added in v0.4.0

func (e *Endpoint) SetTagsFromPath(path string)

type Handler

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

func NewHandler

func NewHandler(docs *Docs) *Handler

func (*Handler) Docs

func (h *Handler) Docs(ctx *gin.Context)

func (*Handler) File

func (h *Handler) File(ctx *gin.Context)

Jump to

Keyboard shortcuts

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