Documentation
¶
Overview ¶
Package paths contains all the logic, models and interfaces for validating OpenAPI 3+ Paths.
Index ¶
- func FindPath(request *http.Request, document *v3.Document, ...) (*v3.PathItem, []*errors.ValidationError, string)
- func ResolveRoute(request *http.Request, document *v3.Document, ...) (*router.Route, []*errors.ValidationError)
- func StripRequestPath(request *http.Request, document *v3.Document) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindPath ¶
func FindPath(request *http.Request, document *v3.Document, options *config.ValidationOptions) (*v3.PathItem, []*errors.ValidationError, string)
FindPath will find the path in the document that matches the request path. If a successful match was found, then the first return value will be a pointer to the PathItem. The second return value will contain any validation errors that were picked up when locating the path. The third return value will be the path that was found in the document, as it pertains to the contract, so all path parameters will not have been replaced with their values from the request - allowing model lookups.
This function first tries a fast O(k) radix tree lookup (where k is path depth). If the radix tree doesn't find a match, it falls back to regex-based matching which handles complex path patterns like matrix-style ({;param}), label-style ({.param}), and OData-style (entities('{Entity}')).
Path matching follows the OpenAPI specification: literal (concrete) paths take precedence over parameterized paths, regardless of definition order in the specification.
func ResolveRoute ¶ added in v0.14.0
func ResolveRoute(request *http.Request, document *v3.Document, options *config.ValidationOptions) (*router.Route, []*errors.ValidationError)
ResolveRoute returns the complete route used by high-level validation. It preserves existing ValidationError shapes while exposing the router's server, operation, path-parameter, and server-variable context to internal callers.
Types ¶
This section is empty.