{"modulePath":"github.com/pb33f/libopenapi-validator","version":"v0.16.5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package validator\n\n## Types\n\n```go\ntype Validator interface {\n\t// ValidateHttpRequest will validate an *http.Request object against an OpenAPI 3+ document.\n\t// The path, query, cookie and header parameters and request body are validated.\n\tValidateHttpRequest(request *http.Request) (bool, []*errors.ValidationError)\n\t// ValidateHttpRequestSync will validate an *http.Request object against an OpenAPI 3+ document synchronously and without spawning any goroutines.\n\t// The path, query, cookie and header parameters and request body are validated.\n\tValidateHttpRequestSync(request *http.Request) (bool, []*errors.ValidationError)\n\n\t// ValidateHttpRequestWithPathItem will validate an *http.Request object against an OpenAPI 3+ document.\n\t// The path, query, cookie and header parameters and request body are validated.\n\tValidateHttpRequestWithPathItem(request *http.Request, pathItem *v3.PathItem, pathValue string) (bool, []*errors.ValidationError)\n\n\t// ValidateHttpRequestSyncWithPathItem will validate an *http.Request object against an OpenAPI 3+ document synchronously and without spawning any goroutines.\n\t// The path, query, cookie and header parameters and request body are validated.\n\tValidateHttpRequestSyncWithPathItem(request *http.Request, pathItem *v3.PathItem, pathValue string) (bool, []*errors.ValidationError)\n\n\t// ValidateHttpResponse will an *http.Response object against an OpenAPI 3+ document.\n\t// The response body is validated. The request is only used to extract the correct response from the spec.\n\tValidateHttpResponse(request *http.Request, response *http.Response) (bool, []*errors.ValidationError)\n\n\t// ValidateHttpRequestResponse will validate both the *http.Request and *http.Response objects against an OpenAPI 3+ document.\n\t// The path, query, cookie and header parameters and request and response body are validated.\n\tValidateHttpRequestResponse(request *http.Request, response *http.Response) (bool, []*errors.ValidationError)\n\n\t// ValidateDocument validates an OpenAPI document against the embedded 3.0, 3.1, or 3.2 specification schema.\n\tValidateDocument() (bool, []*errors.ValidationError)\n\n\t// GetParameterValidator will return a parameters.ParameterValidator instance used to validate parameters\n\tGetParameterValidator() parameters.ParameterValidator\n\n\t// GetRequestBodyValidator will return a parameters.RequestBodyValidator instance used to validate request bodies\n\tGetRequestBodyValidator() requests.RequestBodyValidator\n\n\t// GetResponseBodyValidator will return a parameters.ResponseBodyValidator instance used to validate response bodies\n\tGetResponseBodyValidator() responses.ResponseBodyValidator\n\n\t// SetDocument will set the OpenAPI 3+ document to be validated\n\tSetDocument(document libopenapi.Document)\n\n\t// Release clears validator-owned caches and drops references to the model, document, and child validators.\n\tRelease()\n}\n```\nValidator provides a coarse grained interface for validating an OpenAPI 3+ documents. There are three primary use-cases for validation\n\nValidating \\*http.Request objects against and OpenAPI 3+ document Validating \\*http.Response objects against an OpenAPI 3+ document Validating an OpenAPI 3+ document against the OpenAPI 3+ specification\n\n```go\nfunc NewValidator(document libopenapi.Document, opts ...config.Option) (Validator, []error)\n```\nNewValidator will create a new Validator from an OpenAPI 3+ document\n\n```go\nfunc NewValidatorFromV3Model(m *v3.Document, opts ...config.Option) Validator\n```\nNewValidatorFromV3Model will create a new Validator from an OpenAPI Model\n\n","path":"github.com/pb33f/libopenapi-validator","name":"validator","synopsis":"","isRedistributable":true}
