pub enum Schema {
Boolean(bool),
Ref(RefSchema),
Object(ObjectSchema),
Array(ArraySchema),
Primitive(PrimitiveSchema),
Enum(EnumSchema),
OneOf(OneOfSchema),
}Expand description
JSON Schema representation.
Variants§
Boolean(bool)
Boolean schema (true = any, false = none).
Ref(RefSchema)
Reference to another schema.
Object(ObjectSchema)
Object schema.
Array(ArraySchema)
Array schema.
Primitive(PrimitiveSchema)
Primitive type schema.
Enum(EnumSchema)
Enum schema (string values).
OneOf(OneOfSchema)
OneOf schema (union type).
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn object(
properties: HashMap<String, Schema>,
required: Vec<String>,
) -> Self
pub fn object( properties: HashMap<String, Schema>, required: Vec<String>, ) -> Self
Create an object schema with the given properties.
Sourcepub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
Set title on this schema (if object).
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set description on this schema (if object).
Sourcepub fn string_enum(values: Vec<String>) -> Self
pub fn string_enum(values: Vec<String>) -> Self
Create a string enum schema with allowed values.
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 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