forked from openapi-generators/openapi-python-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpath_item.py
76 lines (69 loc) · 2.89 KB
/
path_item.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
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
from typing import TYPE_CHECKING, Optional
from pydantic import BaseModel, ConfigDict, Field
from .parameter import Parameter
from .reference import ReferenceOr
from .server import Server
if TYPE_CHECKING:
from .operation import Operation # pragma: no cover
class PathItem(BaseModel):
"""
Describes the operations available on a single path.
A Path Item MAY be empty, due to [ACL constraints](#securityFiltering).
The path itself is still exposed to the documentation viewer
but they will not know which operations and parameters are available.
References:
- https://swagger.io/docs/specification/paths-and-operations/
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathItemObject
"""
ref: Optional[str] = Field(default=None, alias="$ref")
summary: Optional[str] = None
description: Optional[str] = None
get: Optional["Operation"] = None
put: Optional["Operation"] = None
post: Optional["Operation"] = None
delete: Optional["Operation"] = None
options: Optional["Operation"] = None
head: Optional["Operation"] = None
patch: Optional["Operation"] = None
trace: Optional["Operation"] = None
servers: Optional[list[Server]] = None
parameters: Optional[list[ReferenceOr[Parameter]]] = None
model_config = ConfigDict(
# `Operation` is an unresolvable forward reference, will rebuild in `__init__.py`:
defer_build=True,
extra="allow",
populate_by_name=True,
json_schema_extra={
"examples": [
{
"get": {
"description": "Returns pets based on ID",
"summary": "Find pets by ID",
"operationId": "getPetsById",
"responses": {
"200": {
"description": "pet response",
"content": {
"*/*": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Pet"}}}
},
},
"default": {
"description": "error payload",
"content": {"text/html": {"schema": {"$ref": "#/components/schemas/ErrorModel"}}},
},
},
},
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of pet to use",
"required": True,
"schema": {"type": "array", "items": {"type": "string"}},
"style": "simple",
}
],
}
]
},
)