pub struct Builder { /* private fields */ }
Expand description
Builder provides simple DSL to build Schema. It allows you not to use strings and raw JSON manipulation. It also prevent some kinds of spelling and type errors.
Implementations§
Source§impl Builder
impl Builder
pub fn new() -> Builder
pub fn id(&mut self, url: &str)
pub fn ref_(&mut self, url: &str)
pub fn schema(&mut self, url: &str)
pub fn desc(&mut self, text: &str)
pub fn title(&mut self, text: &str)
pub fn default<T>(&mut self, default: T)where
T: Serialize,
pub fn multiple_of(&mut self, number: f64)
pub fn maximum(&mut self, number: f64, exclusive: bool)
pub fn minimum(&mut self, number: f64, exclusive: bool)
pub fn max_length(&mut self, number: u64)
pub fn min_length(&mut self, number: u64)
pub fn pattern(&mut self, pattern: &str)
pub fn format(&mut self, format: &str)
pub fn items_schema<F>(&mut self, build: F)
pub fn items_array<F>(&mut self, build: F)where
F: FnOnce(&mut SchemaArray),
pub fn additional_items(&mut self, allow: bool)
pub fn additional_items_schema<F>(&mut self, build: F)
pub fn max_items(&mut self, number: u64)
pub fn min_items(&mut self, number: u64)
pub fn unique_items(&mut self, unique: bool)
pub fn max_properties(&mut self, number: u64)
pub fn min_properties(&mut self, number: u64)
pub fn required(&mut self, items: Vec<String>)
pub fn properties<F>(&mut self, build: F)where
F: FnOnce(&mut SchemaHash),
pub fn pattern_properties<F>(&mut self, build: F)where
F: FnOnce(&mut SchemaHash),
pub fn additional_properties(&mut self, allow: bool)
pub fn additional_properties_schema<F>(&mut self, build: F)
pub fn dependencies<F>(&mut self, build: F)where
F: FnOnce(&mut Dependencies),
pub fn enum_<F>(&mut self, build: F)where
F: FnOnce(&mut ArrayBuilder),
pub fn array(&mut self)
pub fn boolean(&mut self)
pub fn integer(&mut self)
pub fn number(&mut self)
pub fn null(&mut self)
pub fn object(&mut self)
pub fn string(&mut self)
pub fn type_(&mut self, type_: PrimitiveType)
pub fn types(&mut self, types: &[PrimitiveType])
pub fn all_of<F>(&mut self, build: F)where
F: FnOnce(&mut SchemaArray),
pub fn any_of<F>(&mut self, build: F)where
F: FnOnce(&mut SchemaArray),
pub fn one_of<F>(&mut self, build: F)where
F: FnOnce(&mut SchemaArray),
pub fn not<F>(&mut self, build: F)
pub fn build<F>(build: F) -> Builder
pub fn into_json(self) -> Value
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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