Documentation ¶
Overview ¶
Package requests contains all the logic, models and interfaces for validating OpenAPI 3+ Requests. The package depends on *http.Request
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateRequestSchema ¶
func ValidateRequestSchema( request *http.Request, schema *base.Schema, renderedSchema, jsonSchema []byte) (bool, []*errors.ValidationError)
ValidateRequestSchema will validate an http.Request pointer against a schema. If validation fails, it will return a list of validation errors as the second return value.
Types ¶
type RequestBodyValidator ¶
type RequestBodyValidator interface { // ValidateRequestBody will validate the request body for an operation. The first return value will be true if the // request body is valid, false if it is not. The second return value will be a slice of ValidationError pointers if // the body is not valid. ValidateRequestBody(request *http.Request) (bool, []*errors.ValidationError) // SetPathItem will set the pathItem for the RequestBodyValidator, all validations will be performed // against this pathItem otherwise if not set, each validation will perform a lookup for the pathItem // based on the *http.Request SetPathItem(path *v3.PathItem, pathValue string) }
RequestBodyValidator is an interface that defines the methods for validating request bodies for Operations.
ValidateRequestBody method accepts an *http.Request and returns true if validation passed, false if validation failed and a slice of ValidationError pointers.
func NewRequestBodyValidator ¶
func NewRequestBodyValidator(document *v3.Document) RequestBodyValidator
NewRequestBodyValidator will create a new RequestBodyValidator from an OpenAPI 3+ document
Click to show internal directories.
Click to hide internal directories.