-
-
Notifications
You must be signed in to change notification settings - Fork 136
Expand file tree
/
Copy pathprotocols.py
More file actions
105 lines (96 loc) · 4.02 KB
/
protocols.py
File metadata and controls
105 lines (96 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
"""OpenAPI core validation request protocols module"""
from typing import Optional
from typing import Protocol
from typing import runtime_checkable
from jsonschema_path import SchemaPath
from openapi_spec_validator.validation.types import SpecValidatorType
from openapi_core.casting.schemas.factories import SchemaCastersFactory
from openapi_core.deserializing.media_types.datatypes import (
MediaTypeDeserializersDict,
)
from openapi_core.deserializing.media_types.factories import (
MediaTypeDeserializersFactory,
)
from openapi_core.deserializing.styles.factories import (
StyleDeserializersFactory,
)
from openapi_core.protocols import Request
from openapi_core.protocols import WebhookRequest
from openapi_core.security import security_provider_factory
from openapi_core.security.factories import SecurityProviderFactory
from openapi_core.templating.paths.types import PathFinderType
from openapi_core.unmarshalling.request.datatypes import RequestUnmarshalResult
from openapi_core.unmarshalling.schemas.datatypes import (
FormatUnmarshallersDict,
)
from openapi_core.unmarshalling.schemas.factories import (
SchemaUnmarshallersFactory,
)
from openapi_core.validation.schemas.datatypes import FormatValidatorsDict
from openapi_core.validation.schemas.factories import SchemaValidatorsFactory
@runtime_checkable
class RequestUnmarshaller(Protocol):
def __init__(
self,
spec: SchemaPath,
base_url: Optional[str] = None,
style_deserializers_factory: Optional[
StyleDeserializersFactory
] = None,
media_type_deserializers_factory: Optional[
MediaTypeDeserializersFactory
] = None,
schema_casters_factory: Optional[SchemaCastersFactory] = None,
schema_validators_factory: Optional[SchemaValidatorsFactory] = None,
path_finder_cls: Optional[PathFinderType] = None,
spec_validator_cls: Optional[SpecValidatorType] = None,
format_validators: Optional[FormatValidatorsDict] = None,
extra_format_validators: Optional[FormatValidatorsDict] = None,
extra_media_type_deserializers: Optional[
MediaTypeDeserializersDict
] = None,
security_provider_factory: SecurityProviderFactory = security_provider_factory,
strict_additional_properties: bool = False,
schema_unmarshallers_factory: Optional[
SchemaUnmarshallersFactory
] = None,
format_unmarshallers: Optional[FormatUnmarshallersDict] = None,
extra_format_unmarshallers: Optional[FormatUnmarshallersDict] = None,
): ...
def unmarshal(
self,
request: Request,
) -> RequestUnmarshalResult: ...
@runtime_checkable
class WebhookRequestUnmarshaller(Protocol):
def __init__(
self,
spec: SchemaPath,
base_url: Optional[str] = None,
style_deserializers_factory: Optional[
StyleDeserializersFactory
] = None,
media_type_deserializers_factory: Optional[
MediaTypeDeserializersFactory
] = None,
schema_casters_factory: Optional[SchemaCastersFactory] = None,
schema_validators_factory: Optional[SchemaValidatorsFactory] = None,
path_finder_cls: Optional[PathFinderType] = None,
spec_validator_cls: Optional[SpecValidatorType] = None,
format_validators: Optional[FormatValidatorsDict] = None,
extra_format_validators: Optional[FormatValidatorsDict] = None,
extra_media_type_deserializers: Optional[
MediaTypeDeserializersDict
] = None,
security_provider_factory: SecurityProviderFactory = security_provider_factory,
strict_additional_properties: bool = False,
schema_unmarshallers_factory: Optional[
SchemaUnmarshallersFactory
] = None,
format_unmarshallers: Optional[FormatUnmarshallersDict] = None,
extra_format_unmarshallers: Optional[FormatUnmarshallersDict] = None,
): ...
def unmarshal(
self,
request: WebhookRequest,
) -> RequestUnmarshalResult: ...