65
65
from openapi_core .validation .request .protocols import BaseRequest
66
66
from openapi_core .validation .request .protocols import Request
67
67
from openapi_core .validation .request .protocols import WebhookRequest
68
+ from openapi_core .validation .request .proxies import SpecRequestValidatorProxy
68
69
from openapi_core .validation .validators import BaseAPICallValidator
69
70
from openapi_core .validation .validators import BaseValidator
70
71
from openapi_core .validation .validators import BaseWebhookValidator
@@ -105,7 +106,7 @@ def _validate(
105
106
params = self ._get_parameters (request .parameters , operation , path )
106
107
except ParametersError as exc :
107
108
params = exc .parameters
108
- params_errors = exc .context
109
+ params_errors = exc .errors
109
110
else :
110
111
params_errors = []
111
112
@@ -154,7 +155,7 @@ def _validate_parameters(
154
155
params = self ._get_parameters (request .parameters , path , operation )
155
156
except ParametersError as exc :
156
157
params = exc .parameters
157
- params_errors = exc .context
158
+ params_errors = exc .errors
158
159
else :
159
160
params_errors = []
160
161
@@ -328,7 +329,7 @@ def validate(self, request: WebhookRequest) -> RequestValidationResult:
328
329
raise NotImplementedError
329
330
330
331
331
- class RequestBodyValidator (BaseAPICallRequestValidator ):
332
+ class APICallRequestBodyValidator (BaseAPICallRequestValidator ):
332
333
def validate (self , request : Request ) -> RequestValidationResult :
333
334
try :
334
335
_ , operation , _ , _ , _ = self ._find_path (request )
@@ -338,7 +339,7 @@ def validate(self, request: Request) -> RequestValidationResult:
338
339
return self ._validate_body (request , operation )
339
340
340
341
341
- class RequestParametersValidator (BaseAPICallRequestValidator ):
342
+ class APICallRequestParametersValidator (BaseAPICallRequestValidator ):
342
343
def validate (self , request : Request ) -> RequestValidationResult :
343
344
try :
344
345
path , operation , _ , path_result , _ = self ._find_path (request )
@@ -352,7 +353,7 @@ def validate(self, request: Request) -> RequestValidationResult:
352
353
return self ._validate_parameters (request , operation , path )
353
354
354
355
355
- class RequestSecurityValidator (BaseAPICallRequestValidator ):
356
+ class APICallRequestSecurityValidator (BaseAPICallRequestValidator ):
356
357
def validate (self , request : Request ) -> RequestValidationResult :
357
358
try :
358
359
_ , operation , _ , _ , _ = self ._find_path (request )
@@ -362,7 +363,7 @@ def validate(self, request: Request) -> RequestValidationResult:
362
363
return self ._validate_security (request , operation )
363
364
364
365
365
- class RequestValidator (BaseAPICallRequestValidator ):
366
+ class APICallRequestValidator (BaseAPICallRequestValidator ):
366
367
def validate (self , request : Request ) -> RequestValidationResult :
367
368
try :
368
369
path , operation , _ , path_result , _ = self ._find_path (request )
@@ -426,35 +427,35 @@ def validate(self, request: WebhookRequest) -> RequestValidationResult:
426
427
return self ._validate_security (request , operation )
427
428
428
429
429
- class V30RequestBodyValidator (RequestBodyValidator ):
430
+ class V30RequestBodyValidator (APICallRequestBodyValidator ):
430
431
schema_unmarshallers_factory = oas30_request_schema_unmarshallers_factory
431
432
432
433
433
- class V30RequestParametersValidator (RequestParametersValidator ):
434
+ class V30RequestParametersValidator (APICallRequestParametersValidator ):
434
435
schema_unmarshallers_factory = oas30_request_schema_unmarshallers_factory
435
436
436
437
437
- class V30RequestSecurityValidator (RequestSecurityValidator ):
438
+ class V30RequestSecurityValidator (APICallRequestSecurityValidator ):
438
439
schema_unmarshallers_factory = oas30_request_schema_unmarshallers_factory
439
440
440
441
441
- class V30RequestValidator (RequestValidator ):
442
+ class V30RequestValidator (APICallRequestValidator ):
442
443
schema_unmarshallers_factory = oas30_request_schema_unmarshallers_factory
443
444
444
445
445
- class V31RequestBodyValidator (RequestBodyValidator ):
446
+ class V31RequestBodyValidator (APICallRequestBodyValidator ):
446
447
schema_unmarshallers_factory = oas31_schema_unmarshallers_factory
447
448
448
449
449
- class V31RequestParametersValidator (RequestParametersValidator ):
450
+ class V31RequestParametersValidator (APICallRequestParametersValidator ):
450
451
schema_unmarshallers_factory = oas31_schema_unmarshallers_factory
451
452
452
453
453
- class V31RequestSecurityValidator (RequestSecurityValidator ):
454
+ class V31RequestSecurityValidator (APICallRequestSecurityValidator ):
454
455
schema_unmarshallers_factory = oas31_schema_unmarshallers_factory
455
456
456
457
457
- class V31RequestValidator (RequestValidator ):
458
+ class V31RequestValidator (APICallRequestValidator ):
458
459
schema_unmarshallers_factory = oas31_schema_unmarshallers_factory
459
460
path_finder_cls = WebhookPathFinder
460
461
@@ -477,3 +478,17 @@ class V31WebhookRequestSecurityValidator(WebhookRequestSecurityValidator):
477
478
class V31WebhookRequestValidator (WebhookRequestValidator ):
478
479
schema_unmarshallers_factory = oas31_schema_unmarshallers_factory
479
480
path_finder_cls = WebhookPathFinder
481
+
482
+
483
+ # backward compatibility
484
+ class RequestValidator (SpecRequestValidatorProxy ):
485
+ def __init__ (
486
+ self ,
487
+ schema_unmarshallers_factory : SchemaUnmarshallersFactory ,
488
+ ** kwargs : Any ,
489
+ ):
490
+ super ().__init__ (
491
+ APICallRequestValidator ,
492
+ schema_unmarshallers_factory = schema_unmarshallers_factory ,
493
+ ** kwargs ,
494
+ )
0 commit comments