Skip to content

Commit d3d3c0f

Browse files
committed
Add oas32_schema_casters_factory
1 parent bb7b3d3 commit d3d3c0f

File tree

4 files changed

+26
-15
lines changed

4 files changed

+26
-15
lines changed

openapi_core/casting/schemas/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
oas30_write_schema_validators_factory,
1616
)
1717
from openapi_core.validation.schemas import oas31_schema_validators_factory
18+
from openapi_core.validation.schemas import oas32_schema_validators_factory
1819

1920
__all__ = [
2021
"oas30_write_schema_casters_factory",
2122
"oas30_read_schema_casters_factory",
2223
"oas31_schema_casters_factory",
24+
"oas32_schema_casters_factory",
2325
]
2426

2527
oas30_casters_dict = OrderedDict(
@@ -48,6 +50,7 @@
4850
PrimitiveCaster,
4951
multi=PrimitiveCaster,
5052
)
53+
oas32_types_caster = oas31_types_caster
5154

5255
oas30_write_schema_casters_factory = SchemaCastersFactory(
5356
oas30_write_schema_validators_factory,
@@ -63,3 +66,7 @@
6366
oas31_schema_validators_factory,
6467
oas31_types_caster,
6568
)
69+
oas32_schema_casters_factory = SchemaCastersFactory(
70+
oas32_schema_validators_factory,
71+
oas32_types_caster,
72+
)

openapi_core/unmarshalling/schemas/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
__all__ = [
3131
"oas30_format_unmarshallers",
3232
"oas31_format_unmarshallers",
33+
"oas32_format_unmarshallers",
3334
"oas30_write_schema_unmarshallers_factory",
3435
"oas30_read_schema_unmarshallers_factory",
3536
"oas31_schema_unmarshallers_factory",
@@ -67,6 +68,7 @@
6768
AnyUnmarshaller,
6869
multi=MultiTypeUnmarshaller,
6970
)
71+
oas32_types_unmarshaller = oas31_types_unmarshaller
7072

7173
oas30_format_unmarshallers = {
7274
# string compatible
@@ -102,7 +104,7 @@
102104

103105
oas32_schema_unmarshallers_factory = SchemaUnmarshallersFactory(
104106
oas32_schema_validators_factory,
105-
oas31_types_unmarshaller,
107+
oas32_types_unmarshaller,
106108
format_unmarshallers=oas32_format_unmarshallers,
107109
)
108110

openapi_core/validation/request/validators.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from openapi_core.casting.schemas import oas30_write_schema_casters_factory
1616
from openapi_core.casting.schemas import oas31_schema_casters_factory
17+
from openapi_core.casting.schemas import oas32_schema_casters_factory
1718
from openapi_core.casting.schemas.factories import SchemaCastersFactory
1819
from openapi_core.datatypes import Parameters
1920
from openapi_core.datatypes import RequestParameters
@@ -482,47 +483,47 @@ class V31WebhookRequestValidator(WebhookRequestValidator):
482483

483484
class V32RequestBodyValidator(APICallRequestBodyValidator):
484485
spec_validator_cls = OpenAPIV32SpecValidator
485-
schema_casters_factory = oas31_schema_casters_factory
486+
schema_casters_factory = oas32_schema_casters_factory
486487
schema_validators_factory = oas32_schema_validators_factory
487488

488489

489490
class V32RequestParametersValidator(APICallRequestParametersValidator):
490491
spec_validator_cls = OpenAPIV32SpecValidator
491-
schema_casters_factory = oas31_schema_casters_factory
492+
schema_casters_factory = oas32_schema_casters_factory
492493
schema_validators_factory = oas32_schema_validators_factory
493494

494495

495496
class V32RequestSecurityValidator(APICallRequestSecurityValidator):
496497
spec_validator_cls = OpenAPIV32SpecValidator
497-
schema_casters_factory = oas31_schema_casters_factory
498+
schema_casters_factory = oas32_schema_casters_factory
498499
schema_validators_factory = oas32_schema_validators_factory
499500

500501

501502
class V32RequestValidator(APICallRequestValidator):
502503
spec_validator_cls = OpenAPIV32SpecValidator
503-
schema_casters_factory = oas31_schema_casters_factory
504+
schema_casters_factory = oas32_schema_casters_factory
504505
schema_validators_factory = oas32_schema_validators_factory
505506

506507

507508
class V32WebhookRequestBodyValidator(WebhookRequestBodyValidator):
508509
spec_validator_cls = OpenAPIV32SpecValidator
509-
schema_casters_factory = oas31_schema_casters_factory
510+
schema_casters_factory = oas32_schema_casters_factory
510511
schema_validators_factory = oas32_schema_validators_factory
511512

512513

513514
class V32WebhookRequestParametersValidator(WebhookRequestParametersValidator):
514515
spec_validator_cls = OpenAPIV32SpecValidator
515-
schema_casters_factory = oas31_schema_casters_factory
516+
schema_casters_factory = oas32_schema_casters_factory
516517
schema_validators_factory = oas32_schema_validators_factory
517518

518519

519520
class V32WebhookRequestSecurityValidator(WebhookRequestSecurityValidator):
520521
spec_validator_cls = OpenAPIV32SpecValidator
521-
schema_casters_factory = oas31_schema_casters_factory
522+
schema_casters_factory = oas32_schema_casters_factory
522523
schema_validators_factory = oas32_schema_validators_factory
523524

524525

525526
class V32WebhookRequestValidator(WebhookRequestValidator):
526527
spec_validator_cls = OpenAPIV32SpecValidator
527-
schema_casters_factory = oas31_schema_casters_factory
528+
schema_casters_factory = oas32_schema_casters_factory
528529
schema_validators_factory = oas32_schema_validators_factory

openapi_core/validation/response/validators.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from openapi_core.casting.schemas import oas30_read_schema_casters_factory
1717
from openapi_core.casting.schemas import oas31_schema_casters_factory
18+
from openapi_core.casting.schemas import oas32_schema_casters_factory
1819
from openapi_core.exceptions import OpenAPIError
1920
from openapi_core.protocols import HeadersType
2021
from openapi_core.protocols import Request
@@ -410,35 +411,35 @@ class V31WebhookResponseValidator(WebhookResponseValidator):
410411

411412
class V32ResponseDataValidator(APICallResponseDataValidator):
412413
spec_validator_cls = OpenAPIV32SpecValidator
413-
schema_casters_factory = oas31_schema_casters_factory
414+
schema_casters_factory = oas32_schema_casters_factory
414415
schema_validators_factory = oas32_schema_validators_factory
415416

416417

417418
class V32ResponseHeadersValidator(APICallResponseHeadersValidator):
418419
spec_validator_cls = OpenAPIV32SpecValidator
419-
schema_casters_factory = oas31_schema_casters_factory
420+
schema_casters_factory = oas32_schema_casters_factory
420421
schema_validators_factory = oas32_schema_validators_factory
421422

422423

423424
class V32ResponseValidator(APICallResponseValidator):
424425
spec_validator_cls = OpenAPIV32SpecValidator
425-
schema_casters_factory = oas31_schema_casters_factory
426+
schema_casters_factory = oas32_schema_casters_factory
426427
schema_validators_factory = oas32_schema_validators_factory
427428

428429

429430
class V32WebhookResponseDataValidator(WebhookResponseDataValidator):
430431
spec_validator_cls = OpenAPIV32SpecValidator
431-
schema_casters_factory = oas31_schema_casters_factory
432+
schema_casters_factory = oas32_schema_casters_factory
432433
schema_validators_factory = oas32_schema_validators_factory
433434

434435

435436
class V32WebhookResponseHeadersValidator(WebhookResponseHeadersValidator):
436437
spec_validator_cls = OpenAPIV32SpecValidator
437-
schema_casters_factory = oas31_schema_casters_factory
438+
schema_casters_factory = oas32_schema_casters_factory
438439
schema_validators_factory = oas32_schema_validators_factory
439440

440441

441442
class V32WebhookResponseValidator(WebhookResponseValidator):
442443
spec_validator_cls = OpenAPIV32SpecValidator
443-
schema_casters_factory = oas31_schema_casters_factory
444+
schema_casters_factory = oas32_schema_casters_factory
444445
schema_validators_factory = oas32_schema_validators_factory

0 commit comments

Comments
 (0)