pub struct Link {
pub parameters: Map<Value>,
pub request_body: Option<Value>,
pub description: Option<String>,
pub server: Option<Server>,
pub extensions: Extensions,
/* private fields */
}Expand description
A design-time link from one response to another operation.
A link says “the value at this location in my response is the id parameter
of that operation”. It is the one construct in OpenAPI that expresses the
relationship between operations, and no mainstream Rust framework emits it.
The target is a LinkTarget, which is operationRef or operationId
and never both or neither.
Fields§
§parameters: Map<Value>Parameters to pass to the target operation.
Each value is either a constant or a runtime expression such as
$response.body#/id.
request_body: Option<Value>A request body to pass to the target operation.
description: Option<String>A description of the link. CommonMark syntax may be used.
server: Option<Server>A server to use for the target operation.
extensions: ExtensionsSpecification extensions.
Implementations§
Source§impl Link
impl Link
Sourcepub fn to_operation(operation_id: impl Into<String>) -> Self
pub fn to_operation(operation_id: impl Into<String>) -> Self
Links to an operation by its operationId.
Sourcepub fn to_operation_ref(operation_ref: impl Into<String>) -> Self
pub fn to_operation_ref(operation_ref: impl Into<String>) -> Self
Links to an operation by URI reference.
Sourcepub fn target(&self) -> &LinkTarget
pub fn target(&self) -> &LinkTarget
The operation this link points at.
Sourcepub fn operation_ref(&self) -> Option<&str>
pub fn operation_ref(&self) -> Option<&str>
The URI reference to the target, when the link points at one that way.
Sourcepub fn operation_id(&self) -> Option<&str>
pub fn operation_id(&self) -> Option<&str>
The operationId of the target, when the link names one.
Sourcepub fn with_parameter(
self,
name: impl Into<String>,
value: impl Into<Value>,
) -> Self
pub fn with_parameter( self, name: impl Into<String>, value: impl Into<Value>, ) -> Self
Binds a target parameter to a constant or runtime expression.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Sets the description.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Link
impl<'de> Deserialize<'de> for Link
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Link
impl StructuralPartialEq for Link
Auto Trait Implementations§
impl Freeze for Link
impl RefUnwindSafe for Link
impl Send for Link
impl Sync for Link
impl Unpin for Link
impl UnsafeUnpin for Link
impl UnwindSafe for Link
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.