openapiv3/
example.rs

1use indexmap::IndexMap;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
5pub struct Example {
6    /// Short description for the example.
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub summary: Option<String>,
9    /// Long description for the example.
10    /// CommonMark syntax MAY be used for rich text representation.
11    #[serde(skip_serializing_if = "Option::is_none")]
12    pub description: Option<String>,
13    /// Embedded literal example. The `value` field and `externalValue`
14    /// field are mutually exclusive. To represent examples of
15    /// media types that cannot naturally represented in JSON or YAML,
16    /// use a string value to contain the example, escaping where necessary.
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub value: Option<serde_json::Value>,
19    /// A URL that points to the literal example.
20    /// This provides the capability to reference examples that cannot
21    /// easily be included in JSON or YAML documents. The `value` field and
22    /// `externalValue` field are mutually exclusive.
23    #[serde(rename = "externalValue")]
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub external_value: Option<String>,
26    /// Inline extensions to this object.
27    #[serde(flatten, deserialize_with = "crate::util::deserialize_extensions")]
28    pub extensions: IndexMap<String, serde_json::Value>,
29}