Repository navigation
Expand file tree
/
Copy pathpath_item.py
More file actions
71 lines (64 loc) · 2.72 KB
/
Copy pathpath_item.py
File metadata and controls
71 lines (64 loc) · 2.72 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
from typing import List, Optional, Union
from pydantic import BaseModel, Field
from .operation import Operation
from .parameter import Parameter
from .reference import Reference
from .server import Server
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[Union[Parameter, Reference]]] = None
class Config: # pylint: disable=missing-class-docstring
allow_population_by_field_name = True
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",
}
],
}
]
}