Documentation
¶
Index ¶
- func BasicEqualityPathSegmentMatcher(segmentA, segmentB string) (match bool, err error)
- func BasicEqualityPathSegmentWithParamMatcher(segmentA, segmentB string) (match bool, err error)
- func HasMatchingPathSegments(pathA, pathB string) (match bool, err error)
- func HasMatchingPathSegmentsWithParams(pathA, pathB string) (match bool, err error)
- func MatchesPathParameterSyntax(parameter string) bool
- func MatchingPathSegments(pathA, pathB string, matcherFn PathSegmentMatcherFunc) (match bool, err error)
- func SplitPath(p string) []string
- func ValidatePathParameter(parameter string) error
- type PathSegmentMatcherFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicEqualityPathSegmentMatcher ¶
BasicEqualityPathSegmentMatcher is a PathSegmentMatcherFunc that performs direct string comparison of two path segments.
func BasicEqualityPathSegmentWithParamMatcher ¶
BasicEqualityPathSegmentWithParamMatcher is a PathSegmentMatcherFunc that is similar to BasicEqualityPathSegmentMatcher but accounts for path parameter segments.
func HasMatchingPathSegments ¶
HasMatchingPathSegments checks whether two path strings match based on their segments by doing a simple equality check on each path segment pair.
func HasMatchingPathSegmentsWithParams ¶
HasMatchingPathSegmentsWithParams is similar to HasMatchingPathSegments but also considers segments as matching if at least one of them contains a path parameter.
HasMatchingPathSegmentsWithParams("/some/{param}/path", "/some/{param}/path") // true
HasMatchingPathSegmentsWithParams("/some/abc/path", "/some/{param}/path") // true
HasMatchingPathSegmentsWithParams("/some/abc/path", "/some/def/path") // false
func MatchesPathParameterSyntax ¶
MatchesPathParameterSyntax checks whether the parameter string matches the syntax for a path parameter as described by the OpenAPI spec (see https://spec.openapis.org/oas/v3.0.0.html#path-templating).
func MatchingPathSegments ¶
func MatchingPathSegments(pathA, pathB string, matcherFn PathSegmentMatcherFunc) (match bool, err error)
MatchingPathSegments checks whether two path strings match based on their segments using the provided matcher function.
func SplitPath ¶
SplitPath returns a slice containing the individual segments that make up the path string p. It looks for the default forward slash path separator when splitting.
func ValidatePathParameter ¶
ValidatePathParameter checks whether a path parameter is valid. An error is returned if it is invalid. Version 3.1.0 of the OpenAPI spec provides some guidance for path parameter values (see https://spec.openapis.org/oas/v3.1.0.html#path-templating)
Types ¶
type PathSegmentMatcherFunc ¶
PathSegmentMatcherFunc defines the signature for path segment matcher functions.