Struct salvo_oapi::Example
source · #[non_exhaustive]pub struct Example {
pub summary: String,
pub description: String,
pub value: Option<Value>,
pub external_value: String,
}
Expand description
Implements OpenAPI Example Object.
Example is used on path operations to describe possible response bodies.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.summary: String
Short description for the Example
.
description: String
Long description for the Example
. Value supports markdown syntax for rich text
representation.
value: Option<Value>
Embedded literal example value. Example::value
and Example::external_value
are
mutually exclusive.
external_value: String
An URI that points to a literal example value. Example::external_value
provides the
capability to references an example that cannot be easily included in JSON or YAML.
Example::value
and Example::external_value
are mutually exclusive.
Implementations§
source§impl Example
impl Example
sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new empty Example
. This is effectively same as calling Example::default
.
sourcepub fn summary<S: Into<String>>(self, summary: S) -> Self
pub fn summary<S: Into<String>>(self, summary: S) -> Self
Add or change a short description for the Example
. Setting this to empty String
will make it not render in the generated OpenAPI document.
sourcepub fn description<D: Into<String>>(self, description: D) -> Self
pub fn description<D: Into<String>>(self, description: D) -> Self
Add or change a long description for the Example
. Markdown syntax is supported for rich
text representation.
Setting this to empty String
will make it not render in the generated
OpenAPI document.
sourcepub fn value(self, value: Value) -> Self
pub fn value(self, value: Value) -> Self
Add or change embedded literal example value. Example::value
and Example::external_value
are mutually exclusive.
sourcepub fn external_value<E: Into<String>>(self, external_value: E) -> Self
pub fn external_value<E: Into<String>>(self, external_value: E) -> Self
Add or change an URI that points to a literal example value. Example::external_value
provides the capability to references an example that cannot be easily included
in JSON or YAML. Example::value
and Example::external_value
are mutually exclusive.
Setting this to an empty String will make the field not to render in the generated OpenAPI document.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Example
impl<'de> Deserialize<'de> for Example
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>,
source§impl PartialEq for Example
impl PartialEq for Example
impl Eq for Example
impl StructuralPartialEq for Example
Auto Trait Implementations§
impl Freeze for Example
impl RefUnwindSafe for Example
impl Send for Example
impl Sync for Example
impl Unpin for Example
impl UnwindSafe for Example
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<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.