define

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultError

func DefaultError(bc *BuildContext, typ interface{})

----------------------------------------

Types

type BuildContext

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

func MustBuildContext

func MustBuildContext(docM DocModifier, r chi.Router) *BuildContext

func NewBuildContext

func NewBuildContext(docM DocModifier, r chi.Router) (*BuildContext, error)

func (*BuildContext) BuildHandler

func (bc *BuildContext) BuildHandler(ctx context.Context) (http.Handler, error)

func (*BuildContext) BuildOpenAPIDoc

func (bc *BuildContext) BuildOpenAPIDoc(ctx context.Context) (*openapi3.T, error)

func (*BuildContext) Doc

func (bc *BuildContext) Doc() *openapi3.T

Doc returns internal github.com/getkin/kin-openapi/openapi3.T

func (*BuildContext) EmitDoc

func (bc *BuildContext) EmitDoc(ctx context.Context, w io.Writer) error

func (*BuildContext) ReflectOpenAPIManager

func (bc *BuildContext) ReflectOpenAPIManager() *reflectopenapi.Manager

ReflectOpenAPIManager returns internal github.com/podhmo/reflect-openapi/Manager

func (*BuildContext) Router

func (bc *BuildContext) Router() chi.Router

Router returns internal github.com/go-chi/chi.Router

type DocModifier

type DocModifier func() *openapi3.T

func Doc

func Doc() DocModifier

func (DocModifier) After

func (m DocModifier) After(f func(doc *openapi3.T)) DocModifier

func (DocModifier) Server

func (m DocModifier) Server(url string, description string) DocModifier

func (DocModifier) Title

func (m DocModifier) Title(title string) DocModifier

func (DocModifier) Version

func (m DocModifier) Version(version string) DocModifier

type EndpointModifier

type EndpointModifier reflectopenapi.RegisterFuncAction

func Delete

func Delete[I any, O any](bc *BuildContext, path string, action quickapi.Action[I, O], middlewares ...func(http.Handler) http.Handler) *EndpointModifier

func Get

func Get[I any, O any](bc *BuildContext, path string, action quickapi.Action[I, O], middlewares ...func(http.Handler) http.Handler) *EndpointModifier
func Head[I any, O any](bc *BuildContext, path string, action quickapi.Action[I, O], middlewares ...func(http.Handler) http.Handler) *EndpointModifier

func Method

func Method[I any, O any](bc *BuildContext, method, path string, action quickapi.Action[I, O], middlewares ...func(http.Handler) http.Handler) *EndpointModifier

func Options

func Options[I any, O any](bc *BuildContext, path string, action quickapi.Action[I, O], middlewares ...func(http.Handler) http.Handler) *EndpointModifier

func Patch

func Patch[I any, O any](bc *BuildContext, path string, action quickapi.Action[I, O], middlewares ...func(http.Handler) http.Handler) *EndpointModifier

func Post

func Post[I any, O any](bc *BuildContext, path string, action quickapi.Action[I, O], middlewares ...func(http.Handler) http.Handler) *EndpointModifier

func Put

func Put[I any, O any](bc *BuildContext, path string, action quickapi.Action[I, O], middlewares ...func(http.Handler) http.Handler) *EndpointModifier

func (*EndpointModifier) After

func (m *EndpointModifier) After(f func(op *openapi3.Operation)) *EndpointModifier

func (*EndpointModifier) AnotherError

func (m *EndpointModifier) AnotherError(bc *BuildContext, code int, typ interface{}, description string) *EndpointModifier

func (*EndpointModifier) Description

func (m *EndpointModifier) Description(description string) *EndpointModifier

func (*EndpointModifier) Example

func (a *EndpointModifier) Example(code int, title string, value interface{}) *EndpointModifier

func (*EndpointModifier) Status

func (m *EndpointModifier) Status(code int) *EndpointModifier

type TypeModifier

func Enum

func Enum[T any](bc *BuildContext, defaultValue T, values ...T) *TypeModifier

func IntEnum

func IntEnum[T ~int](bc *BuildContext, defaultValue T, values ...T) *TypeModifier

func StringEnum

func StringEnum[T ~string](bc *BuildContext, defaultValue T, values ...T) *TypeModifier

func Type

func Type(bc *BuildContext, typ interface{}) *TypeModifier

func (*TypeModifier) After

func (m *TypeModifier) After(f func(ref *openapi3.SchemaRef)) *TypeModifier

func (*TypeModifier) Before

func (m *TypeModifier) Before(f func(s *openapi3.Schema)) *TypeModifier

func (*TypeModifier) Example

func (a *TypeModifier) Example(value interface{}) *TypeModifier

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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