forked from openapi-generators/openapi-python-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathencoding.py
41 lines (34 loc) · 1.29 KB
/
encoding.py
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
from typing import TYPE_CHECKING, Optional
from pydantic import BaseModel, ConfigDict
from .reference import ReferenceOr
if TYPE_CHECKING: # pragma: no cover
from .header import Header
class Encoding(BaseModel):
"""A single encoding definition applied to a single schema property.
References:
- https://swagger.io/docs/specification/describing-request-body/
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#encodingObject
"""
contentType: Optional[str] = None
headers: Optional[dict[str, ReferenceOr["Header"]]] = None
style: Optional[str] = None
explode: bool = False
allowReserved: bool = False
model_config = ConfigDict(
# `Header` is an unresolvable forward reference, will rebuild in `__init__.py`:
defer_build=True,
extra="allow",
json_schema_extra={
"examples": [
{
"contentType": "image/png, image/jpeg",
"headers": {
"X-Rate-Limit-Limit": {
"description": "The number of allowed requests in the current period",
"schema": {"type": "integer"},
}
},
}
]
},
)