Documentation
¶
Overview ¶
Package openapi adapts oapi-codegen's strict std-http server to handlers' route table, guard, error writer, and kin-openapi request validation.
Index ¶
- func Mount(mux *http.ServeMux, routes []handlers.Route, g handlers.Guard, ...)
- type Router
- func (r *Router) HandleFunc(pattern string, h func(http.ResponseWriter, *http.Request))
- func (r *Router) RequestError(w http.ResponseWriter, req *http.Request, err error)
- func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Router) WriteError(w http.ResponseWriter, req *http.Request, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router implements oapi-codegen's ServeMux interface.
func (*Router) HandleFunc ¶
HandleFunc registers pattern from oapi-codegen (<METHOD> <prefix><path>) on the underlying Mount with request validation against the OpenAPI spec.
func (*Router) RequestError ¶
RequestError handles oapi-codegen parameter/body binding errors, writing ErrTooLarge for *http.MaxBytesError or ErrInvalidRequest otherwise, and logging the cause at debug level.
func (*Router) ServeHTTP ¶
func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP delegates to the mux passed to Mount.
func (*Router) WriteError ¶
WriteError writes a handler error through Mount's configured ErrorWriter.
Click to show internal directories.
Click to hide internal directories.