pub enum SchemaRule {
Show 15 variants
Type(ValueType),
Pattern(Regex),
Length {
min: Option<usize>,
max: Option<usize>,
},
Range {
min: Option<f64>,
max: Option<f64>,
},
Enum(Vec<Value>),
Properties(HashMap<String, Schema>),
Items(Box<Schema>),
Required(Vec<String>),
AdditionalProperties(bool),
Custom(String),
Conditional {
if_schema: Box<Schema>,
then_schema: Option<Box<Schema>>,
else_schema: Option<Box<Schema>>,
},
Not(Box<Schema>),
AnyOf(Vec<Schema>),
AllOf(Vec<Schema>),
OneOf(Vec<Schema>),
}Expand description
Schema validation rules
Variants§
Type(ValueType)
Validate type (string, number, boolean, array, object, null)
Pattern(Regex)
String must match regex pattern
Length
String/Array length constraints
Range
Number range constraints
Enum(Vec<Value>)
Value must be one of the specified values
Properties(HashMap<String, Schema>)
Object property validation
Items(Box<Schema>)
Array item validation
Required(Vec<String>)
Required properties for objects
AdditionalProperties(bool)
Additional properties allowed for objects
Custom(String)
Custom validation function
Conditional
Conditional validation (if-then-else)
Fields
Not(Box<Schema>)
Value must not match this schema (negation)
AnyOf(Vec<Schema>)
Value must match any of these schemas (OR)
AllOf(Vec<Schema>)
Value must match all of these schemas (AND)
OneOf(Vec<Schema>)
Value must match exactly one of these schemas (XOR)
Trait Implementations§
Source§impl Clone for SchemaRule
impl Clone for SchemaRule
Source§fn clone(&self) -> SchemaRule
fn clone(&self) -> SchemaRule
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for SchemaRule
impl RefUnwindSafe for SchemaRule
impl Send for SchemaRule
impl Sync for SchemaRule
impl Unpin for SchemaRule
impl UnwindSafe for SchemaRule
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