pub enum BasicType {
Object,
String,
Integer,
Number,
Boolean,
Array,
Null,
}
Expand description
Represents data type fragment of Schema
.
BasicType
is used to create a SchemaType
that defines the type of the Schema
.
SchemaType
can be created from a single BasicType
or multiple BasicType
s 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 = [BasicType::String, BasicType::Null].into_iter().collect();
Create string SchemaType
let _ = SchemaType::basic(BasicType::String);
Variants§
Object
Used with Object
to describe schema that has properties describing fields. have
String
Indicates string type of content. Used with Object
on a string
field.
Integer
Indicates integer type of content. Used with Object
on a number
field.
Number
Indicates floating point number type of content. Used with
Object
on a number
field.
Boolean
Indicates boolean type of content. Used with Object
on
a bool
field.
Array
Used with Array
. 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 BasicType
impl<'de> Deserialize<'de> for BasicType
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 From<BasicType> for SchemaType
impl From<BasicType> for SchemaType
Source§impl FromIterator<BasicType> for SchemaType
impl FromIterator<BasicType> for SchemaType
impl Eq for BasicType
impl StructuralPartialEq for BasicType
Auto Trait Implementations§
impl Freeze for BasicType
impl RefUnwindSafe for BasicType
impl Send for BasicType
impl Sync for BasicType
impl Unpin for BasicType
impl UnwindSafe for BasicType
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.