Documentation
¶
Index ¶
- Variables
- func InputFromCTX(ctx context.Context) (*openapi3filter.RequestValidationInput, error)
- func SetOpenAPIInput(router routers.Router, ...) func(http.Handler) http.Handler
- func VerifyRequest(errFn ErrorHandler) func(http.Handler) http.Handler
- func VerifyResponse(errFn ErrorHandler) func(http.Handler) http.Handler
- type ErrorHandler
- type Router
- func (r *Router) Components() openapi.Components
- func (r *Router) Connect(pattern string, handler http.HandlerFunc, options []operations.Option)
- func (r *Router) Delete(pattern string, handler http.HandlerFunc, options []operations.Option)
- func (r *Router) FilterRouter() (routers.Router, error)
- func (r *Router) GenerateSpec() (string, error)
- func (r *Router) Get(pattern string, handler http.HandlerFunc, options []operations.Option)
- func (r *Router) Head(pattern string, handler http.HandlerFunc, options []operations.Option)
- func (r *Router) Method(method, pattern string, handler http.Handler, options []operations.Option)
- func (r *Router) MethodFunc(method, pattern string, handler http.HandlerFunc, options []operations.Option)
- func (r *Router) Mount(pattern string, handler http.Handler)
- func (r *Router) Options(pattern string, handler http.HandlerFunc, options []operations.Option)
- func (r *Router) Patch(pattern string, handler http.HandlerFunc, options []operations.Option)
- func (r *Router) Post(pattern string, handler http.HandlerFunc, options []operations.Option)
- func (r *Router) Put(pattern string, handler http.HandlerFunc, options []operations.Option)
- func (r *Router) RegisterType(obj interface{}, schema *openapi3.Schema)
- func (r *Router) RegisterTypeAsComponent(obj interface{}, name string, schema *openapi3.Schema)
- func (r *Router) RegisterTypeAsRef(obj interface{}, name string) error
- func (r *Router) Route(pattern string, fn func(*Router))
- func (router *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (r *Router) SetDefaultJSON(description string, obj interface{})
- func (r *Router) SetGlobalSecurity(name string) *Router
- func (r *Router) SetStatusDefault(status int, description string, obj interface{})
- func (r *Router) Trace(pattern string, handler http.HandlerFunc, options []operations.Option)
- func (r *Router) Use(middlewares ...func(http.Handler) http.Handler)
- func (r *Router) UseRouter(other *Router) *Router
- func (r *Router) ValidateSpec() error
- func (r *Router) With(middlewares ...func(http.Handler) http.Handler) *Router
- func (r *Router) WithInfo(info openapi.Info) *Router
- func (r *Router) WithSecurity(security SecuritySchema) *Router
- type SecuritySchema
Constants ¶
This section is empty.
Variables ¶
var InputKey = ctxKey{"input"}
InputKey is used to get the *openapi3filter.RequestValidationInput{} from a ctx
Functions ¶
func InputFromCTX ¶
func InputFromCTX(ctx context.Context) (*openapi3filter.RequestValidationInput, error)
func SetOpenAPIInput ¶
func VerifyRequest ¶
func VerifyRequest(errFn ErrorHandler) func(http.Handler) http.Handler
VerifyRequest validates requests against matching openapi routes; Requires SetOpenAPIInput middleware to have been called
func VerifyResponse ¶
func VerifyResponse(errFn ErrorHandler) func(http.Handler) http.Handler
VerifyResponse validates response against matching openapi routes Requires SetOpenAPIInput middleware to have been called
Types ¶
type ErrorHandler ¶
type ErrorHandler func(http.ResponseWriter, *http.Request, error)
type Router ¶
type Router struct { Mux chi.Router OpenAPI openapi.OpenAPI // contains filtered or unexported fields }
Router is a small wrapper over a chi.Router to help generate an openapi spec
func (*Router) Components ¶
func (r *Router) Components() openapi.Components
func (*Router) Connect ¶
func (r *Router) Connect(pattern string, handler http.HandlerFunc, options []operations.Option)
func (*Router) Delete ¶
func (r *Router) Delete(pattern string, handler http.HandlerFunc, options []operations.Option)
func (*Router) FilterRouter ¶
FilterRouter returns a router used for verifying middlewares
func (*Router) GenerateSpec ¶
func (*Router) Get ¶
func (r *Router) Get(pattern string, handler http.HandlerFunc, options []operations.Option)
func (*Router) Head ¶
func (r *Router) Head(pattern string, handler http.HandlerFunc, options []operations.Option)
func (*Router) MethodFunc ¶
func (r *Router) MethodFunc(method, pattern string, handler http.HandlerFunc, options []operations.Option)
MethodFunc adds routes for `pattern` that matches the `method` HTTP method.
func (*Router) Options ¶
func (r *Router) Options(pattern string, handler http.HandlerFunc, options []operations.Option)
func (*Router) Patch ¶
func (r *Router) Patch(pattern string, handler http.HandlerFunc, options []operations.Option)
func (*Router) Post ¶
func (r *Router) Post(pattern string, handler http.HandlerFunc, options []operations.Option)
func (*Router) Put ¶
func (r *Router) Put(pattern string, handler http.HandlerFunc, options []operations.Option)
func (*Router) RegisterType ¶
RegisterType registers the type as an inline schema
func (*Router) RegisterTypeAsComponent ¶
RegisterTypeAsComponent registers the objects type as a reference to the schema, which is inserted into the schema.components with the supplied name
func (*Router) RegisterTypeAsRef ¶
RegisterTypeAsRef registers the objects type as a reference to the schema located in schema.components with the supplied name
func (*Router) SetDefaultJSON ¶
SetDefaultJSON will set the default response for all routes unless overridden at the operation level
func (*Router) SetGlobalSecurity ¶
func (*Router) SetStatusDefault ¶
SetStatusDefault will set the statusCode for all routes to the supplied object.
func (*Router) Trace ¶
func (r *Router) Trace(pattern string, handler http.HandlerFunc, options []operations.Option)
func (*Router) ValidateSpec ¶
func (*Router) WithSecurity ¶
func (r *Router) WithSecurity(security SecuritySchema) *Router
type SecuritySchema ¶
SecuritySchema represents an openapi3 security scheme