{"modulePath":"github.com/pb33f/libopenapi-validator","version":"v0.16.5","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\tHowToFixParamInvalidInteger                     string = \"Convert the value '%s' into an integer\"\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\tHowToFixInvalidXml                              string = \"Ensure xml is well-formed and matches schema structure\"\n\tHowToFixXmlPrefix                               string = \"Make sure to prepend the correct prefix '%s' to the declared fields\"\n\tHowToFixXmlNamespace                            string = \"Make sure to declare the 'xmlns:%s' with the correct namespace URI\"\n\tHowToFixFormDataReservedCharacters              string = \"Make sure to correcly encode specials characters to percent encoding, or set allowReserved to true\"\n\tHowToFixInvalidSchema                           string = \"Ensure that the object being submitted, matches the schema correctly\"\n\tHowToFixInvalidTypeEncoding                     string = \"Ensure that the object being submitted matches the property encoding Content-Type\"\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\tHowToFixParamInvalidDeepObjectPathConflict string = \"Use either '%s[%s]' or nested properties like '%s[%s]', not both\"\n\tHowToFixInvalidJSON                        string = \"The JSON submitted is invalid, please check the syntax\"\n\tHowToFixInvalidUrlEncoded                  string = \"Ensure URL Encoded submitted is well-formed and matches schema structure\"\n\tHowToFixDecodingError                      string = \"The object can't be decoded, so make sure it's being encoded correctly according to the spec.\"\n\tHowToFixInvalidContentType                 string = \"The content type is invalid, Use one of the %d supported types for this operation: %s\"\n\tHowToFixInvalidResponseCode                string = \"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                    string = \"Ensure the correct encoding has been used on the object\"\n\tHowToFixMissingValue                       string = \"Ensure the value has been set\"\n\tHowToFixPath                               string = \"Check the path is correct, and check that the correct HTTP method has been used (e.g. GET, POST, PUT, DELETE)\"\n\tHowToFixPathMethod                         string = \"Add the missing operation to the contract for the path\"\n\tHowToFixAmbiguousPath                      string = \"Send the path in canonical form: do not percent-encode characters allowed in a path segment, do not encode '/', and remove empty and dot segments\"\n\tHowToFixInvalidMaxItems                    string = \"Reduce the number of items in the array to %d or less\"\n\tHowToFixInvalidMinItems                    string = \"Increase the number of items in the array to %d or more\"\n\tHowToFixMissingHeader                      string = \"Make sure the service responding sets the required headers with this response code\"\n\tHowToFixInvalidRenderedSchema              string = \"Check the request schema for circular references or invalid structures\"\n\tHowToFixInvalidJsonSchema                  string = \"Check the request schema for invalid JSON Schema syntax, complex regex patterns, or unsupported schema constructs\"\n)\n```\n\n```go\nconst (\n\tStrictSubTypeProperty          = \"undeclared-property\"\n\tStrictSubTypeHeader            = \"undeclared-header\"\n\tStrictSubTypeQuery             = \"undeclared-query-param\"\n\tStrictSubTypeCookie            = \"undeclared-cookie\"\n\tStrictSubTypeReadOnlyProperty  = \"readonly-property\"\n\tStrictSubTypeWriteOnlyProperty = \"writeonly-property\"\n)\n```\nStrictValidationSubTypes for different kinds of strict validation errors.\n\n```go\nconst StrictValidationType = \"strict\"\n```\nStrictValidationType is the validation type for strict mode errors.\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```go\nfunc SafeNodeLineCol(node *yaml.Node) (int, int)\n```\nSafeNodeLineCol safely extracts line and column from a yaml.Node pointer. Returns (1, 0) if the node is nil.\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// InstancePath is the raw path segments from the root to the failing field\n\tInstancePath []string `json:\"instancePath,omitempty\" yaml:\"instancePath,omitempty\"`\n\n\t// FieldName is the name of the specific field that failed validation (last segment of the path)\n\tFieldName string `json:\"fieldName,omitempty\" yaml:\"fieldName,omitempty\"`\n\n\t// FieldPath is the JSONPath representation of the field location that failed validation (e.g., \"$.user.email\")\n\tFieldPath string `json:\"fieldPath,omitempty\" yaml:\"fieldPath,omitempty\"`\n\n\t// KeywordLocation is the JSON Pointer (RFC 6901) path to the schema keyword that failed validation\n\t// (e.g., \"/properties/age/minimum\")\n\tKeywordLocation string `json:\"keywordLocation,omitempty\" yaml:\"keywordLocation,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 failed schema validation\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 jsonschema.ValidationError object, if the schema failure originated from the jsonschema library.\n\tOriginalJsonSchemaError *jsonschema.ValidationError `json:\"-\" yaml:\"-\"`\n\n\t// Context is the raw schema object that failed validation (for programmatic access)\n\tContext interface{} `json:\"-\" yaml:\"-\"`\n}\n```\nSchemaValidationFailure describes any failure that occurs when validating data against either an OpenAPI or JSON Schema. It aims to be a more user-friendly representation of the error than what is provided by the jsonschema library.\n\n```go\nfunc (s *SchemaValidationFailure) Error() string\n```\nError returns a string representation of the error\n\n```go\ntype ValidationError struct {\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// ParameterName is the name of the parameter that failed validation (for parameter validation errors)\n\tParameterName string `json:\"parameterName,omitempty\" yaml:\"parameterName,omitempty\"`\n\n\t// SchemaValidationErrors is a slice of SchemaValidationFailure objects that describe the validation errors\n\t// This is only populated when 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 CookieParameterMissing(param *v3.Parameter, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc HeaderParameterCannotBeDecoded(param *v3.Parameter, val string, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc HeaderParameterMissing(param *v3.Parameter, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectCookieParamArrayBoolean(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema, pathTemplate string, operation string, renderedItemsSchema string,\n) *ValidationError\n```\n\n```go\nfunc IncorrectCookieParamArrayNumber(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema, pathTemplate string, operation string, renderedItemsSchema string,\n) *ValidationError\n```\n\n```go\nfunc IncorrectCookieParamBool(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectCookieParamEnum(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *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, pathTemplate string, operation string, renderedItemsSchema string,\n) *ValidationError\n```\n\n```go\nfunc IncorrectHeaderParamArrayNumber(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema, pathTemplate string, operation string, renderedItemsSchema string,\n) *ValidationError\n```\n\n```go\nfunc IncorrectHeaderParamBool(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectHeaderParamEnum(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectParamArrayMaxNumItems(param *v3.Parameter, sch *base.Schema, expected, actual int64, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectParamArrayMinNumItems(param *v3.Parameter, sch *base.Schema, expected, actual int64, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectParamArrayUniqueItems(param *v3.Parameter, sch *base.Schema, duplicates string, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectParamEncodingJSON(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectPathParamArrayBoolean(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema, pathTemplate string, renderedSchema string,\n) *ValidationError\n```\n\n```go\nfunc IncorrectPathParamArrayInteger(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema, pathTemplate string, renderedSchema string,\n) *ValidationError\n```\n\n```go\nfunc IncorrectPathParamArrayNumber(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema, pathTemplate string, renderedSchema string,\n) *ValidationError\n```\n\n```go\nfunc IncorrectPathParamBool(param *v3.Parameter, item string, sch *base.Schema, pathTemplate string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectPathParamEnum(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectPathParamInteger(param *v3.Parameter, item string, sch *base.Schema, pathTemplate string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectPathParamNumber(param *v3.Parameter, item string, sch *base.Schema, pathTemplate string, renderedSchema string) *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, pathTemplate string, operation string, renderedItemsSchema string,\n) *ValidationError\n```\n\n```go\nfunc IncorrectQueryParamArrayInteger(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema, pathTemplate string, operation string, renderedItemsSchema string,\n) *ValidationError\n```\n\n```go\nfunc IncorrectQueryParamArrayNumber(\n\tparam *v3.Parameter, item string, sch *base.Schema, itemsSchema *base.Schema, pathTemplate string, operation string, renderedItemsSchema string,\n) *ValidationError\n```\n\n```go\nfunc IncorrectQueryParamBool(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectQueryParamEnum(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectQueryParamEnumArray(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedItemsSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectReservedValues(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc IncorrectSpaceDelimiting(param *v3.Parameter, qp *helpers.QueryParam) *ValidationError\n```\n\n```go\nfunc InvalidCookieParamInteger(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc InvalidCookieParamNumber(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc InvalidDeepObject(param *v3.Parameter, qp *helpers.QueryParam) *ValidationError\n```\n\n```go\nfunc InvalidDeepObjectPathConflict(param *v3.Parameter, prefixParam, nestedParam *helpers.QueryParam) *ValidationError\n```\n\n```go\nfunc InvalidHeaderParamInteger(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc InvalidHeaderParamNumber(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc InvalidNamespace(schema *base.Schema, namespace, expectedNamespace, prefix string) *ValidationError\n```\n\n```go\nfunc InvalidPrefix(schema *base.Schema, prefix string) *ValidationError\n```\n\n```go\nfunc InvalidQueryParamInteger(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc InvalidQueryParamNumber(param *v3.Parameter, ef string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc InvalidTypeEncoding(schema *base.Schema, name, contentType string) *ValidationError\n```\n\n```go\nfunc InvalidURLEncodedParsing(reason, referenceObject string) *ValidationError\n```\n\n```go\nfunc InvalidXMLParsing(reason, referenceObject string) *ValidationError\n```\n\n```go\nfunc MissingNamespace(schema *base.Schema, namespace string) *ValidationError\n```\n\n```go\nfunc MissingPrefix(schema *base.Schema, prefix string) *ValidationError\n```\n\n```go\nfunc OperationNotFound(pathItem *v3.PathItem, request *http.Request, method string, specPath string) *ValidationError\n```\n\n```go\nfunc PathParameterMissing(param *v3.Parameter, pathTemplate string, actualPath string) *ValidationError\n```\n\n```go\nfunc QueryParameterCannotBeDecoded(param *v3.Parameter, val string, sch *base.Schema, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\nQueryParameterCannotBeDecoded reports that an object query parameter value could not be decoded into a map.\n\n```go\nfunc QueryParameterMissing(param *v3.Parameter, pathTemplate string, operation string, renderedSchema string) *ValidationError\n```\n\n```go\nfunc ReadOnlyPropertyError(\n\tpath string,\n\tname string,\n\tvalue any,\n\trequestPath string,\n\trequestMethod string,\n\tspecLine int,\n\tspecCol int,\n) *ValidationError\n```\nReadOnlyPropertyError creates a ValidationError for a readOnly property in a request.\n\n```go\nfunc RequestContentTypeNotFound(op *v3.Operation, request *http.Request, specPath string) *ValidationError\n```\n\n```go\nfunc ReservedURLEncodedValue(schema *base.Schema, name, value 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 UndeclaredCookieError(\n\tpath string,\n\tname string,\n\tvalue any,\n\tdeclaredCookies []string,\n\trequestPath string,\n\trequestMethod string,\n) *ValidationError\n```\nUndeclaredCookieError creates a ValidationError for an undeclared cookie.\n\n```go\nfunc UndeclaredHeaderError(\n\tname string,\n\tvalue string,\n\tdeclaredHeaders []string,\n\tdirection string,\n\trequestPath string,\n\trequestMethod string,\n) *ValidationError\n```\nUndeclaredHeaderError creates a ValidationError for an undeclared header.\n\n```go\nfunc UndeclaredPropertyError(\n\tpath string,\n\tname string,\n\tvalue any,\n\tdeclaredProperties []string,\n\tdirection string,\n\trequestPath string,\n\trequestMethod string,\n\tspecLine int,\n\tspecCol int,\n) *ValidationError\n```\nUndeclaredPropertyError creates a ValidationError for an undeclared property.\n\n```go\nfunc UndeclaredQueryParamError(\n\tpath string,\n\tname string,\n\tvalue any,\n\tdeclaredParams []string,\n\trequestPath string,\n\trequestMethod string,\n) *ValidationError\n```\nUndeclaredQueryParamError creates a ValidationError for an undeclared query parameter.\n\n```go\nfunc WriteOnlyPropertyError(\n\tpath string,\n\tname string,\n\tvalue any,\n\trequestPath string,\n\trequestMethod string,\n\tspecLine int,\n\tspecCol int,\n) *ValidationError\n```\nWriteOnlyPropertyError creates a ValidationError for a writeOnly property in a response.\n\n```go\nfunc (v *ValidationError) Error() string\n```\nError returns a string representation of the error\n\n```go\nfunc (v *ValidationError) IsOperationMissingError() bool\n```\nIsOperationMissingError returns true if the error has a ValidationType of \"request\" and a ValidationSubType of \"missingOperation\"\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/pb33f/libopenapi-validator/errors","name":"errors","synopsis":"Package errors contains all the error types used by the validator","isRedistributable":true}
