@@ -14,42 +14,53 @@ import (
14
14
//
15
15
// ValidateQueryParams will validate the query parameters for the request
16
16
// ValidateHeaderParams will validate the header parameters for the request
17
- // ValidateCookieParams will validate the cookie parameters for the request
17
+ // ValidateCookieParamsWithPathItem will validate the cookie parameters for the request
18
18
// ValidatePathParams will validate the path parameters for the request
19
19
//
20
20
// Each method accepts an *http.Request and returns true if validation passed,
21
21
// false if validation failed and a slice of ValidationError pointers.
22
22
type ParameterValidator interface {
23
-
24
- // SetPathItem will set the pathItem for the ParameterValidator, all validations will be performed against this pathItem
25
- // otherwise if not set, each validation will perform a lookup for the pathItem based on the *http.Request
26
- SetPathItem (path * v3.PathItem , pathValue string )
27
-
28
23
// ValidateQueryParams accepts an *http.Request and validates the query parameters against the OpenAPI specification.
29
24
// The method will locate the correct path, and operation, based on the verb. The parameters for the operation
30
25
// will be matched and validated against what has been supplied in the http.Request query string.
31
26
ValidateQueryParams (request * http.Request ) (bool , []* errors.ValidationError )
32
27
28
+ // ValidateQueryParamsWithPathItem accepts an *http.Request and validates the query parameters against the OpenAPI specification.
29
+ // The method will locate the correct path, and operation, based on the verb. The parameters for the operation
30
+ // will be matched and validated against what has been supplied in the http.Request query string.
31
+ ValidateQueryParamsWithPathItem (request * http.Request , pathItem * v3.PathItem , pathValue string ) (bool , []* errors.ValidationError )
32
+
33
33
// ValidateHeaderParams validates the header parameters contained within *http.Request. It returns a boolean
34
34
// stating true if validation passed (false for failed), and a slice of errors if validation failed.
35
35
ValidateHeaderParams (request * http.Request ) (bool , []* errors.ValidationError )
36
36
37
+ // ValidateHeaderParamsWithPathItem validates the header parameters contained within *http.Request. It returns a boolean
38
+ // stating true if validation passed (false for failed), and a slice of errors if validation failed.
39
+ ValidateHeaderParamsWithPathItem (request * http.Request , pathItem * v3.PathItem , pathValue string ) (bool , []* errors.ValidationError )
40
+
37
41
// ValidateCookieParams validates the cookie parameters contained within *http.Request.
38
42
// It returns a boolean stating true if validation passed (false for failed), and a slice of errors if validation failed.
39
43
ValidateCookieParams (request * http.Request ) (bool , []* errors.ValidationError )
40
44
45
+ // ValidateCookieParamsWithPathItem validates the cookie parameters contained within *http.Request.
46
+ // It returns a boolean stating true if validation passed (false for failed), and a slice of errors if validation failed.
47
+ ValidateCookieParamsWithPathItem (request * http.Request , pathItem * v3.PathItem , pathValue string ) (bool , []* errors.ValidationError )
48
+
41
49
// ValidatePathParams validates the path parameters contained within *http.Request. It returns a boolean stating true
42
50
// if validation passed (false for failed), and a slice of errors if validation failed.
43
51
ValidatePathParams (request * http.Request ) (bool , []* errors.ValidationError )
44
52
53
+ // ValidatePathParamsWithPathItem validates the path parameters contained within *http.Request. It returns a boolean stating true
54
+ // if validation passed (false for failed), and a slice of errors if validation failed.
55
+ ValidatePathParamsWithPathItem (request * http.Request , pathItem * v3.PathItem , pathValue string ) (bool , []* errors.ValidationError )
56
+
45
57
// ValidateSecurity validates the security requirements for the operation. It returns a boolean stating true
46
58
// if validation passed (false for failed), and a slice of errors if validation failed.
47
59
ValidateSecurity (request * http.Request ) (bool , []* errors.ValidationError )
48
- }
49
60
50
- func ( v * paramValidator ) SetPathItem ( path * v3. PathItem , pathValue string ) {
51
- v . pathItem = path
52
- v . pathValue = pathValue
61
+ // ValidateSecurityWithPathItem validates the security requirements for the operation. It returns a boolean stating true
62
+ // if validation passed (false for failed), and a slice of errors if validation failed.
63
+ ValidateSecurityWithPathItem ( request * http. Request , pathItem * v3. PathItem , pathValue string ) ( bool , [] * errors. ValidationError )
53
64
}
54
65
55
66
// NewParameterValidator will create a new ParameterValidator from an OpenAPI 3+ document
@@ -58,8 +69,5 @@ func NewParameterValidator(document *v3.Document) ParameterValidator {
58
69
}
59
70
60
71
type paramValidator struct {
61
- document * v3.Document
62
- pathItem * v3.PathItem
63
- pathValue string
64
- errors []* errors.ValidationError
72
+ document * v3.Document
65
73
}
0 commit comments