@@ -6,41 +6,47 @@ use super::{spec_extensions, Server};
6
6
7
7
/// The Link object represents a possible design-time link for a response.
8
8
///
9
- /// The presence of a link does not guarantee the caller's ability to successfully invoke it,
10
- /// rather it provides a known relationship and traversal mechanism between responses and
11
- /// other operations.
9
+ /// The presence of a link does not guarantee the caller's ability to successfully invoke it, rather
10
+ /// it provides a known relationship and traversal mechanism between responses and other operations.
12
11
///
13
12
/// Unlike _dynamic_ links (i.e. links provided *in* the response payload), the OAS linking
14
13
/// mechanism does not require link information in the runtime response.
15
14
///
16
- /// For computing links, and providing instructions to execute them, a
17
- /// [runtime expression](https://github.com/OAI/OpenAPI-Specification/blob/HEAD/versions/3.1.0.md#runtimeExpression)
18
- /// is used for accessing values in an operation and using them as parameters while invoking
19
- /// the linked operation.
15
+ /// For computing links, and providing instructions to execute them, a [runtime expression] is used
16
+ /// for accessing values in an operation and using them as parameters while invoking the linked
17
+ /// operation.
18
+ ///
19
+ /// The `operationRef` and `operationId` fields are mutually exclusive and so this structure is
20
+ /// modelled as an enum.
20
21
///
21
22
/// See <https://github.com/OAI/OpenAPI-Specification/blob/HEAD/versions/3.1.0.md#link-object>.
23
+ ///
24
+ /// [runtime expression]: https://github.com/OAI/OpenAPI-Specification/blob/HEAD/versions/3.1.0.md#runtime-expressions
22
25
#[ derive( Debug , Clone , PartialEq , Deserialize , Serialize ) ]
23
26
#[ serde( untagged) ]
24
27
pub enum Link {
25
28
/// A relative or absolute reference to an OAS operation.
26
- ///
27
- /// This field is mutually exclusive of the `operationId` field, and MUST point to an
28
- /// [Operation Object]. Relative `operationRef` values MAY be used to locate an existing
29
- /// [Operation Object] in the OpenAPI definition.
30
- ///
31
- /// [Operation Object]: https://github.com/OAI/OpenAPI-Specification/blob/HEAD/versions/3.1.0.md#operation-object
32
29
Ref {
30
+ /// A relative or absolute reference to an OAS operation.
31
+ ///
32
+ /// This field is mutually exclusive of the `operationId` field, and MUST point to an
33
+ /// [Operation Object]. Relative `operationRef` values MAY be used to locate an existing
34
+ /// [Operation Object] in the OpenAPI definition.
35
+ ///
36
+ /// [Operation Object]: https://github.com/OAI/OpenAPI-Specification/blob/HEAD/versions/3.1.0.md#operation-object
33
37
#[ serde( rename = "operationRef" ) ]
34
38
operation_ref : String ,
35
39
40
+ /// A map representing parameters to pass to an operation.
41
+ ///
42
+ /// The key is the parameter name to be used, whereas the value can be a constant or an
43
+ /// expression to be evaluated and passed to the linked operation. The parameter name can be
44
+ /// qualified using the [parameter location] `[{in}.]{name}` for operations that use the
45
+ /// same parameter name in different locations (e.g. path.id).
46
+ ///
47
+ /// [parameter location]: https://github.com/OAI/OpenAPI-Specification/blob/HEAD/versions/3.1.0.md#parameterIn
48
+ //
36
49
// FIXME: Implement
37
- // /// A map representing parameters to pass to an operation as specified with `operationId`
38
- // /// or identified via `operationRef`. The key is the parameter name to be used, whereas
39
- // /// the value can be a constant or an expression to be evaluated and passed to the
40
- // /// linked operation. The parameter name can be qualified using the
41
- // /// [parameter location](https://github.com/OAI/OpenAPI-Specification/blob/HEAD/versions/3.1.0.md#parameterIn)
42
- // /// `[{in}.]{name}` for operations that use the same parameter name in different
43
- // /// locations (e.g. path.id).
44
50
// parameters: BTreeMap<String, Any | {expression}>,
45
51
//
46
52
#[ serde( default , skip_serializing_if = "BTreeMap::is_empty" ) ]
@@ -54,6 +60,7 @@ pub enum Link {
54
60
// request_body: Any | {expression}
55
61
//
56
62
/// A description of the link.
63
+ ///
57
64
/// [CommonMark syntax](https://spec.commonmark.org) MAY be used for rich text
58
65
/// representation.
59
66
#[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -72,22 +79,23 @@ pub enum Link {
72
79
extensions : BTreeMap < String , serde_json:: Value > ,
73
80
} ,
74
81
75
- /// The name of an _existing_, resolvable OAS operation, as defined with a unique
76
- /// `operationId`.
77
- ///
78
- /// This field is mutually exclusive of the `operationRef` field.
82
+ /// The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`.
79
83
Id {
84
+ /// The name of an _existing_, resolvable OAS operation, as defined with a unique
85
+ /// `operationId`.
80
86
#[ serde( rename = "operationId" ) ]
81
87
operation_id : String ,
82
88
89
+ /// A map representing parameters to pass to an operation.
90
+ ///
91
+ /// The key is the parameter name to be used, whereas the value can be a constant or an
92
+ /// expression to be evaluated and passed to the linked operation. The parameter name can be
93
+ /// qualified using the [parameter location] `[{in}.]{name}` for operations that use the
94
+ /// same parameter name in different locations (e.g. path.id).
95
+ ///
96
+ /// [parameter location]: https://github.com/OAI/OpenAPI-Specification/blob/HEAD/versions/3.1.0.md#parameterIn
97
+ //
83
98
// FIXME: Implement
84
- // /// A map representing parameters to pass to an operation as specified with `operationId`
85
- // /// or identified via `operationRef`. The key is the parameter name to be used, whereas
86
- // /// the value can be a constant or an expression to be evaluated and passed to the
87
- // /// linked operation. The parameter name can be qualified using the
88
- // /// [parameter location](https://github.com/OAI/OpenAPI-Specification/blob/HEAD/versions/3.1.0.md#parameterIn)
89
- // /// `[{in}.]{name}` for operations that use the same parameter name in different
90
- // /// locations (e.g. path.id).
91
99
// parameters: BTreeMap<String, Any | {expression}>,
92
100
//
93
101
#[ serde( default , skip_serializing_if = "BTreeMap::is_empty" ) ]
0 commit comments