@@ -6,41 +6,47 @@ use super::{spec_extensions, Server};
66
77/// The Link object represents a possible design-time link for a response.
88///
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.
1211///
1312/// Unlike _dynamic_ links (i.e. links provided *in* the response payload), the OAS linking
1413/// mechanism does not require link information in the runtime response.
1514///
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.
2021///
2122/// 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
2225#[ derive( Debug , Clone , PartialEq , Deserialize , Serialize ) ]
2326#[ serde( untagged) ]
2427pub enum Link {
2528 /// 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
3229 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
3337 #[ serde( rename = "operationRef" ) ]
3438 operation_ref : String ,
3539
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+ //
3649 // 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).
4450 // parameters: BTreeMap<String, Any | {expression}>,
4551 //
4652 #[ serde( default , skip_serializing_if = "BTreeMap::is_empty" ) ]
@@ -54,6 +60,7 @@ pub enum Link {
5460 // request_body: Any | {expression}
5561 //
5662 /// A description of the link.
63+ ///
5764 /// [CommonMark syntax](https://spec.commonmark.org) MAY be used for rich text
5865 /// representation.
5966 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -72,22 +79,23 @@ pub enum Link {
7279 extensions : BTreeMap < String , serde_json:: Value > ,
7380 } ,
7481
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`.
7983 Id {
84+ /// The name of an _existing_, resolvable OAS operation, as defined with a unique
85+ /// `operationId`.
8086 #[ serde( rename = "operationId" ) ]
8187 operation_id : String ,
8288
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+ //
8398 // 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).
9199 // parameters: BTreeMap<String, Any | {expression}>,
92100 //
93101 #[ serde( default , skip_serializing_if = "BTreeMap::is_empty" ) ]
0 commit comments