@@ -26,16 +26,18 @@ class RequestValidator(BaseValidator):
26
26
27
27
def validate (self , request ):
28
28
try :
29
- path , operation , _ , _ , _ = self ._find_path (request )
29
+ path , operation , _ , path_result , _ = self ._find_path (request )
30
30
# don't process if operation errors
31
31
except PathError as exc :
32
- return RequestValidationResult ([exc , ], None , None , None )
32
+ return RequestValidationResult (errors = [exc , ])
33
33
34
34
try :
35
35
security = self ._get_security (request , operation )
36
36
except InvalidSecurity as exc :
37
- return RequestValidationResult ([exc , ], None , None , None )
37
+ return RequestValidationResult (errors = [exc , ])
38
38
39
+ request .parameters .path = request .parameters .path or \
40
+ path_result .variables
39
41
params , params_errors = self ._get_parameters (
40
42
request , chain (
41
43
iteritems (operation .parameters ),
@@ -46,30 +48,41 @@ def validate(self, request):
46
48
body , body_errors = self ._get_body (request , operation )
47
49
48
50
errors = params_errors + body_errors
49
- return RequestValidationResult (errors , body , params , security )
51
+ return RequestValidationResult (
52
+ errors = errors ,
53
+ body = body ,
54
+ parameters = params ,
55
+ security = security ,
56
+ )
50
57
51
58
def _validate_parameters (self , request ):
52
59
try :
53
60
path , operation , _ , _ , _ = self ._find_path (request )
54
61
except PathError as exc :
55
- return RequestValidationResult ([exc , ], None , None )
62
+ return RequestValidationResult (errors = [exc , ])
56
63
57
64
params , params_errors = self ._get_parameters (
58
65
request , chain (
59
66
iteritems (operation .parameters ),
60
67
iteritems (path .parameters )
61
68
)
62
69
)
63
- return RequestValidationResult (params_errors , None , params , None )
70
+ return RequestValidationResult (
71
+ errors = params_errors ,
72
+ parameters = params ,
73
+ )
64
74
65
75
def _validate_body (self , request ):
66
76
try :
67
77
_ , operation , _ , _ , _ = self ._find_path (request )
68
78
except PathError as exc :
69
- return RequestValidationResult ([exc , ], None , None )
79
+ return RequestValidationResult (errors = [exc , ])
70
80
71
81
body , body_errors = self ._get_body (request , operation )
72
- return RequestValidationResult (body_errors , body , None , None )
82
+ return RequestValidationResult (
83
+ errors = body_errors ,
84
+ body = body ,
85
+ )
73
86
74
87
def _get_security (self , request , operation ):
75
88
security = operation .security or self .spec .security
0 commit comments