{"modulePath":"github.com/pokt-foundation/libopenapi-validator","version":"v1.0.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\nPackage errors contains all the error types used by the validator\n\n## Constants\n\n```go\nconst (\n\tHowToFixReservedValues string = \"parameter values need to URL Encoded to ensure reserved \" +\n\t\t\"values are correctly encoded, for example: '%s'\"\n\tHowToFixParamInvalidNumber                      string = \"Convert the value '%s' into a number\"\n\tHowToFixParamInvalidString                      string = \"Convert the value '%s' into a string (cannot start with a number, or be a floating point)\"\n\tHowToFixParamInvalidBoolean                     string = \"Convert the value '%s' into a true/false value\"\n\tHowToFixParamInvalidEnum                        string = \"Instead of '%s', use one of the allowed values: '%s'\"\n\tHowToFixParamInvalidFormEncode                  string = \"Use a form style encoding for parameter values, for example: '%s'\"\n\tHowToFixInvalidSchema                           string = \"Ensure that the object being submitted, matches the schema correctly\"\n\tHowToFixParamInvalidSpaceDelimitedObjectExplode string = \"When using 'explode' with space delimited parameters, \" +\n\t\t\"they should be separated by spaces. For example: '%s'\"\n\tHowToFixParamInvalidPipeDelimitedObjectExplode string = \"When using 'explode' with pipe delimited parameters, \" +\n\t\t\"they should be separated by pipes '|'. For example: '%s'\"\n\tHowToFixParamInvalidDeepObjectMultipleValues string = \"There can only be a single value per property name, \" +\n\t\t\"deepObject parameters should contain the property key in square brackets next to the parameter name. For example: '%s'\"\n\tHowToFixInvalidJSON         string = \"The JSON submitted is invalid, please check the syntax\"\n\tHowToFixDecodingError              = \"The object can't be decoded, so make sure it's being encoded correctly according to the spec.\"\n\tHowToFixInvalidContentType         = \"The content type is invalid, Use one of the %d supported types for this operation: %s\"\n\tHowToFixInvalidResponseCode        = \"The service is responding with a code that is not defined in the spec, fix the service or add the code to the specification\"\n\tHowToFixInvalidEncoding            = \"Ensure the correct encoding has been used on the object\"\n\tHowToFixMissingValue               = \"Ensure the value has been set\"\n\tHowToFixPath                       = \"Check the path is correct, and check that the correct HTTP method has been used (e.g. GET, POST, PUT, DELETE)\"\n\tHowToFixPathMethod                 = \"Add the missing operation to the contract for the path\"\n)\n```\n\n## Functions\n\n```go\nfunc PopulateValidationErrors(validationErrors []*ValidationError, request *http.Request, path string)\n```\nPopulateValidationErrors mutates the provided validation errors with additional useful error information, that is not necessarily available when the ValidationError was created and are standard for all errors. Specifically, the RequestPath, SpecPath and RequestMethod are populated.\n\n## Types\n\n```go\ntype SchemaValidationFailure struct {\n\t// Reason is a human-readable message describing the reason for the error.\n\tReason string `json:\"reason,omitempty\" yaml:\"reason,omitempty\"`\n\n\t// Location is the XPath-like location of the validation failure\n\tLocation string `json:\"location,omitempty\" yaml:\"location,omitempty\"`\n\n\t// DeepLocation is the path to the validation failure as exposed by the jsonschema library.\n\tDeepLocation string `json:\"deepLocation,omitempty\" yaml:\"deepLocation,omitempty\"`\n\n\t// AbsoluteLocation is the absolute path to the validation failure as exposed by the jsonschema library.\n\tAbsoluteLocation string `json:\"absoluteLocation,omitempty\" yaml:\"absoluteLocation,omitempty\"`\n\n\t// Line is the line number where the violation occurred. This may a local line number\n\t// if the validation is a schema (only schemas are validated locally, so the line number will be relative to\n\t// the Context object held by the ValidationError object).\n\tLine int `json:\"line,omitempty\" yaml:\"line,omitempty\"`\n\n\t// Column is the column number where the violation occurred. This may a local column number\n\t// if the validation is a schema (only schemas are validated locally, so the column number will be relative to\n\t// the Context object held by the ValidationError object).\n\tColumn int `json:\"column,omitempty\" yaml:\"column,omitempty\"`\n\n\t// ReferenceSchema is the schema that was referenced in the validation failure.\n\tReferenceSchema string `json:\"referenceSchema,omitempty\" yaml:\"referenceSchema,omitempty\"`\n\n\t// ReferenceObject is the object that was referenced in the validation failure.\n\tReferenceObject string `json:\"referenceObject,omitempty\" yaml:\"referenceObject,omitempty\"`\n\n\t// ReferenceExample is an example object generated from the schema that was referenced in the validation failure.\n\tReferenceExample string `json:\"referenceExample,omitempty\" yaml:\"referenceExample,omitempty\"`\n\n\t// The original error object, which is a jsonschema.ValidationError object.\n\tOriginalError *jsonschema.ValidationError `json:\"-\" yaml:\"-\"`\n}\n```\nSchemaValidationFailure is a wrapper around the jsonschema.ValidationError object, to provide a more user-friendly way to break down what went wrong.\n\n```go\nfunc (s *SchemaValidationFailure) Error() string\n```\nError returns a string representation of the error\n\n```go\ntype ValidationError struct {\n\n\t// Message is a human-readable message describing the error.\n\tMessage string `json:\"message\" yaml:\"message\"`\n\n\t// Reason is a human-readable message describing the reason for the error.\n\tReason string `json:\"reason\" yaml:\"reason\"`\n\n\t// ValidationType is a string that describes the type of validation that failed.\n\tValidationType string `json:\"validationType\" yaml:\"validationType\"`\n\n\t// ValidationSubType is a string that describes the subtype of validation that failed.\n\tValidationSubType string `json:\"validationSubType\" yaml:\"validationSubType\"`\n\n\t// SpecLine is the line number in the spec where the error occurred.\n\tSpecLine int `json:\"specLine\" yaml:\"specLine\"`\n\n\t// SpecCol is the column number in the spec where the error occurred.\n\tSpecCol int `json:\"specColumn\" yaml:\"specColumn\"`\n\n\t// HowToFix is a human-readable message describing how to fix the error.\n\tHowToFix string `json:\"howToFix\" yaml:\"howToFix\"`\n\n\t// RequestPath is the path of the request\n\tRequestPath string `json:\"requestPath\" yaml:\"requestPath\"`\n\n\t// SpecPath is the path from the specification that corresponds to the request\n\tSpecPath string `json:\"specPath\" yaml:\"specPath\"`\n\n\t// RequestMethod is the HTTP method of the request\n\tRequestMethod string `json:\"requestMethod\" yaml:\"requestMethod\"`\n\n\t// SchemaValidationErrors is a slice of SchemaValidationFailure objects that describe the validation errors\n\t// This is only populated whe the validation type is against a schema.\n\tSchemaValidationErrors []*SchemaValidationFailure `json:\"validationErrors,omitempty\" yaml:\"validationErrors,omitempty\"`\n\n\t// Context is the object that the validation error occurred on. This is usually a pointer to a schema\n\t// or a parameter object.\n\tContext interface{} `json:\"-\" yaml:\"-\"`\n}\n```\nValidationError is a struct that contains all the information about a validation error.\n\n```go\nfunc HeaderParameterCannotBeDecoded(param *v3.Parameter, val string) *ValidationError\n```\n\n```go\nfunc HeaderParameterMissing(param *v3.Parameter) *ValidationError\n```\n\n```go\nfunc IncorrectCookieParamArrayBoolean(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectCookieParamArrayNumber(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectCookieParamBool(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectCookieParamEnum(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectFormEncoding(param *v3.Parameter, qp *helpers.QueryParam, i int) *ValidationError\n```\n\n```go\nfunc IncorrectHeaderParamArrayBoolean(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectHeaderParamArrayNumber(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectHeaderParamBool(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectHeaderParamEnum(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectParamEncodingJSON(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectPathParamArrayBoolean(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectPathParamArrayNumber(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectPathParamBool(param *v3.Parameter, item string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectPathParamEnum(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectPathParamNumber(param *v3.Parameter, item string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectPipeDelimiting(param *v3.Parameter, qp *helpers.QueryParam) *ValidationError\n```\n\n```go\nfunc IncorrectQueryParamArrayBoolean(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectQueryParamArrayNumber(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectQueryParamBool(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectQueryParamEnum(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectQueryParamEnumArray(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectReservedValues(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc IncorrectSpaceDelimiting(param *v3.Parameter, qp *helpers.QueryParam) *ValidationError\n```\n\n```go\nfunc InvalidCookieParamNumber(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc InvalidDeepObject(param *v3.Parameter, qp *helpers.QueryParam) *ValidationError\n```\n\n```go\nfunc InvalidHeaderParamNumber(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc InvalidQueryParamNumber(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError\n```\n\n```go\nfunc OperationNotFound(pathItem *v3.PathItem, request *http.Request, method string, specPath string) *ValidationError\n```\n\n```go\nfunc QueryParameterMissing(param *v3.Parameter) *ValidationError\n```\n\n```go\nfunc RequestContentTypeNotFound(op *v3.Operation, request *http.Request, specPath string) *ValidationError\n```\n\n```go\nfunc ResponseCodeNotFound(op *v3.Operation, request *http.Request, code int) *ValidationError\n```\n\n```go\nfunc ResponseContentTypeNotFound(op *v3.Operation,\n\trequest *http.Request,\n\tresponse *http.Response,\n\tcode string,\n\tisDefault bool,\n) *ValidationError\n```\n\n```go\nfunc (v *ValidationError) Error() string\n```\nError returns a string representation of the error\n\n```go\nfunc (v *ValidationError) IsPathMissingError() bool\n```\nIsPathMissingError returns true if the error has a ValidationType of \"path\" and a ValidationSubType of \"missing\"\n\n","path":"github.com/pokt-foundation/libopenapi-validator/errors","name":"errors","synopsis":"Package errors contains all the error types used by the validator","isRedistributable":true}
