@@ -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,43 @@ 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
- path , operation , _ , _ , _ = self ._find_path (request )
60
+ path , operation , _ , path_result , _ = self ._find_path (request )
54
61
except PathError as exc :
55
- return RequestValidationResult ([exc , ], None , None )
62
+ return RequestValidationResult (errors = [exc , ])
56
63
64
+ request .parameters .path = request .parameters .path or \
65
+ path_result .variables
57
66
params , params_errors = self ._get_parameters (
58
67
request , chain (
59
68
iteritems (operation .parameters ),
60
69
iteritems (path .parameters )
61
70
)
62
71
)
63
- return RequestValidationResult (params_errors , None , params , None )
72
+ return RequestValidationResult (
73
+ errors = params_errors ,
74
+ parameters = params ,
75
+ )
64
76
65
77
def _validate_body (self , request ):
66
78
try :
67
79
_ , operation , _ , _ , _ = self ._find_path (request )
68
80
except PathError as exc :
69
- return RequestValidationResult ([exc , ], None , None )
81
+ return RequestValidationResult (errors = [exc , ])
70
82
71
83
body , body_errors = self ._get_body (request , operation )
72
- return RequestValidationResult (body_errors , body , None , None )
84
+ return RequestValidationResult (
85
+ errors = body_errors ,
86
+ body = body ,
87
+ )
73
88
74
89
def _get_security (self , request , operation ):
75
90
security = operation .security or self .spec .security
0 commit comments