pub enum Schema {
Ref {
ref_path: String,
},
Object(ObjectType),
Array(ArrayType),
Primitive(PrimitiveSchema),
}Expand description
Schema definition, supports reference, object, array, and primitive types
Ref: references a Schema defined in components.schemas via$refObject: object type, contains properties and requiredArray: array type, contains itemsPrimitive: primitive type (string/integer/number/boolean)
Variants§
Ref
References another already-defined Schema
Object(ObjectType)
Object type
Array(ArrayType)
Array type
Primitive(PrimitiveSchema)
Primitive type (string/integer/number/boolean)
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn object(obj: ObjectType) -> Self
pub fn object(obj: ObjectType) -> Self
Creates an object Schema
Sourcepub fn with_format(self, format: &str) -> Self
pub fn with_format(self, format: &str) -> Self
Sets the format (only effective for Primitive types; other types return the original value)
Sourcepub fn with_description(self, desc: &str) -> Self
pub fn with_description(self, desc: &str) -> Self
Sets the description (only effective for Primitive types)
Sourcepub fn with_example(self, value: Value) -> Self
pub fn with_example(self, value: Value) -> Self
Sets the example value (only effective for Primitive types)
Sourcepub fn with_default(self, value: Value) -> Self
pub fn with_default(self, value: Value) -> Self
Sets the default value (only effective for Primitive types)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schema
impl<'de> Deserialize<'de> for Schema
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
impl UnwindSafe for Schema
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more