Documentation ¶
Overview ¶
Package middleware implements middleware function for go-chi or net/http, which validates incoming HTTP requests to make sure that they conform to the given OAPI 3.0 specification. When OAPI validation fails on the request, we return an HTTP/400.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OAPIValidator ¶
func WithErrContentType ¶
func WithErrContentType(contentType ErrRespContentType) func(*Options)
WithErrContentType sets the content type of the error response
func WithOptions ¶
func WithOptions(opt *openapi3filter.Options) func(*Options)
WithOptions sets the openapi3filter options for the middleware
Types ¶
type ErrRespContentType ¶
type ErrRespContentType string
ErrRespContentType represents the support content-types for the response when a validation error occurs
const ( ErrRespContentTypePlain ErrRespContentType = "text/plain" ErrRespContentTypeJSON ErrRespContentType = "application/json" ErrRespContentTypeXML ErrRespContentType = "application/xml" )
Consts to expose supported Error Response Content-Types
type Options ¶
type Options struct { Options *openapi3filter.Options ErrRespContentType // contains filtered or unexported fields }
Options to customize request validation, openapi3filter specified options will be passed through.
Click to show internal directories.
Click to hide internal directories.