pub struct Discriminator {
pub property_name: String,
pub mapping: IndexMap<String, String>,
pub extensions: IndexMap<String, Value>,
}
Expand description
When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.
When using the discriminator, inline schemas will not be considered.
Fields§
§property_name: String
REQUIRED. The name of the property in the payload that will hold the discriminator value.
mapping: IndexMap<String, String>
An object to hold mappings between payload values and schema names or references.
extensions: IndexMap<String, Value>
Inline extensions to this object.
Trait Implementations§
Source§impl Clone for Discriminator
impl Clone for Discriminator
Source§fn clone(&self) -> Discriminator
fn clone(&self) -> Discriminator
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Discriminator
impl Debug for Discriminator
Source§impl Default for Discriminator
impl Default for Discriminator
Source§fn default() -> Discriminator
fn default() -> Discriminator
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for Discriminator
impl<'de> Deserialize<'de> for Discriminator
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Discriminator, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Discriminator, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Discriminator
impl PartialEq for Discriminator
Source§impl Serialize for Discriminator
impl Serialize for Discriminator
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Discriminator
Auto Trait Implementations§
impl Freeze for Discriminator
impl RefUnwindSafe for Discriminator
impl Send for Discriminator
impl Sync for Discriminator
impl Unpin for Discriminator
impl UnwindSafe for Discriminator
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
Mutably borrows from an owned value. Read more