pub enum Type {
Object,
String,
Integer,
Number,
Boolean,
Array,
Null,
}Expand description
Represents data type fragment of Schema.
Type is used to create a SchemaType that defines the type of the Schema.
SchemaType can be created from a single Type or multiple Types according to the
OpenAPI 3.1 spec. Since the OpenAPI 3.1 is fully compatible with JSON schema the definition of
the type property comes from JSON Schema type.
§Examples
Create nullable string SchemaType
let _: SchemaType = [Type::String, Type::Null].into_iter().collect();Create string SchemaType
let _ = SchemaType::new(Type::String);Variants§
Object
Used with Object and ObjectBuilder to describe schema that has properties
describing fields.
String
Indicates string type of content. Used with Object and ObjectBuilder on a string
field.
Integer
Indicates integer type of content. Used with Object and ObjectBuilder on a number
field.
Number
Indicates floating point number type of content. Used with
Object and ObjectBuilder on a number field.
Boolean
Indicates boolean type of content. Used with Object and ObjectBuilder on
a bool field.
Array
Used with Array and ArrayBuilder. Indicates array type of content.
Null
Null type. Used together with other type to indicate nullable values.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Type
impl<'de> Deserialize<'de> for Type
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Type, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Type, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<Type> for SchemaType
impl From<Type> for SchemaType
Source§fn from(value: Type) -> SchemaType
fn from(value: Type) -> SchemaType
Source§impl FromIterator<Type> for SchemaType
impl FromIterator<Type> for SchemaType
Source§fn from_iter<T>(iter: T) -> SchemaTypewhere
T: IntoIterator<Item = Type>,
fn from_iter<T>(iter: T) -> SchemaTypewhere
T: IntoIterator<Item = Type>,
Source§impl Serialize for Type
impl Serialize for Type
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,
impl Eq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
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,
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.