Repository navigation
Expand file tree
/
Copy pathlink.py
More file actions
43 lines (35 loc) · 1.64 KB
/
Copy pathlink.py
File metadata and controls
43 lines (35 loc) · 1.64 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
from typing import Any, Optional
from pydantic import BaseModel, ConfigDict
from .server import Server
class Link(BaseModel):
"""
The `Link object` represents a possible design-time link for a response.
The presence of a link does not guarantee the caller's ability to successfully invoke it,
rather it provides a known relationship and traversal mechanism between responses and other operations.
Unlike _dynamic_ links (i.e. links provided **in** the response payload),
the OAS linking mechanism does not require link information in the runtime response.
For computing links, and providing instructions to execute them,
a [runtime expression](#runtimeExpression) is used for accessing values in an operation
and using them as parameters while invoking the linked operation.
References:
- https://swagger.io/docs/specification/links/
- https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#linkObject
"""
operationRef: Optional[str] = None
operationId: Optional[str] = None
parameters: Optional[dict[str, Any]] = None
requestBody: Optional[Any] = None
description: Optional[str] = None
server: Optional[Server] = None
model_config = ConfigDict(
extra="allow",
json_schema_extra={
"examples": [
{"operationId": "getUserAddressByUUID", "parameters": {"userUuid": "$response.body#/uuid"}},
{
"operationRef": "#/paths/~12.0~1repositories~1{username}/get",
"parameters": {"username": "$response.body#/username"},
},
]
},
)