45
45
from openapi_core .validation .request .exceptions import (
46
46
MissingRequiredRequestBody ,
47
47
)
48
- from openapi_core .validation .request .exceptions import ParameterError
49
48
from openapi_core .validation .request .exceptions import ParametersError
50
- from openapi_core .validation .request .exceptions import RequestBodyError
51
- from openapi_core .validation .request .exceptions import SecurityError
49
+ from openapi_core .validation .request .exceptions import ParameterValidationError
50
+ from openapi_core .validation .request .exceptions import (
51
+ RequestBodyValidationError ,
52
+ )
53
+ from openapi_core .validation .request .exceptions import SecurityValidationError
52
54
from openapi_core .validation .schemas import (
53
55
oas30_write_schema_validators_factory ,
54
56
)
@@ -95,7 +97,7 @@ def _iter_errors(
95
97
try :
96
98
self ._get_security (request .parameters , operation )
97
99
# don't process if security errors
98
- except SecurityError as exc :
100
+ except SecurityValidationError as exc :
99
101
yield exc
100
102
return
101
103
@@ -106,15 +108,15 @@ def _iter_errors(
106
108
107
109
try :
108
110
self ._get_body (request .body , request .mimetype , operation )
109
- except RequestBodyError as exc :
111
+ except RequestBodyValidationError as exc :
110
112
yield exc
111
113
112
114
def _iter_body_errors (
113
115
self , request : BaseRequest , operation : Spec
114
116
) -> Iterator [Exception ]:
115
117
try :
116
118
self ._get_body (request .body , request .mimetype , operation )
117
- except RequestBodyError as exc :
119
+ except RequestBodyValidationError as exc :
118
120
yield exc
119
121
120
122
def _iter_parameters_errors (
@@ -130,7 +132,7 @@ def _iter_security_errors(
130
132
) -> Iterator [Exception ]:
131
133
try :
132
134
self ._get_security (request .parameters , operation )
133
- except SecurityError as exc :
135
+ except SecurityValidationError as exc :
134
136
yield exc
135
137
136
138
def _get_parameters (
@@ -158,7 +160,7 @@ def _get_parameters(
158
160
value = self ._get_parameter (parameters , param )
159
161
except MissingParameter :
160
162
continue
161
- except ParameterError as exc :
163
+ except ParameterValidationError as exc :
162
164
errors .append (exc )
163
165
continue
164
166
else :
@@ -171,7 +173,7 @@ def _get_parameters(
171
173
return validated
172
174
173
175
@ValidationErrorWrapper (
174
- ParameterError ,
176
+ ParameterValidationError ,
175
177
InvalidParameter ,
176
178
"from_spec" ,
177
179
spec = "param" ,
@@ -197,7 +199,7 @@ def _get_parameter(
197
199
raise MissingRequiredParameter (name , param_location )
198
200
raise MissingParameter (name , param_location )
199
201
200
- @ValidationErrorWrapper (SecurityError , InvalidSecurity )
202
+ @ValidationErrorWrapper (SecurityValidationError , InvalidSecurity )
201
203
def _get_security (
202
204
self , parameters : RequestParameters , operation : Spec
203
205
) -> Optional [Dict [str , str ]]:
@@ -236,7 +238,7 @@ def _get_security_value(
236
238
security_provider = self .security_provider_factory .create (scheme )
237
239
return security_provider (parameters )
238
240
239
- @ValidationErrorWrapper (RequestBodyError , InvalidRequestBody )
241
+ @ValidationErrorWrapper (RequestBodyValidationError , InvalidRequestBody )
240
242
def _get_body (
241
243
self , body : Optional [str ], mimetype : str , operation : Spec
242
244
) -> Any :
0 commit comments