Struct valico::json_schema::builder::Builder
source · 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)
pub fn exclusive_maximum(&mut self, number: f64)
pub fn minimum(&mut self, number: f64)
pub fn exclusive_minimum(&mut self, number: f64)
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)where F: FnOnce(&mut Builder),
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)where F: FnOnce(&mut Builder),
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)where F: FnOnce(&mut Builder),
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)where F: FnOnce(&mut Builder),
pub fn build<F>(build: F) -> Builderwhere F: FnOnce(&mut Builder),
pub fn into_json(self) -> Value
pub fn content_media_type(&mut self, type_: ContentMediaType)
pub fn content_encoding(&mut self, type_: ContentEncoding)
pub fn if_<F>(&mut self, build: F)where F: FnOnce(&mut Builder),
pub fn then_<F>(&mut self, build: F)where F: FnOnce(&mut Builder),
pub fn else_<F>(&mut self, build: F)where F: FnOnce(&mut Builder),
pub fn custom_vocabulary<V: Serialize, N: Into<String>>( &mut self, name: N, value: V )
Trait Implementations§
Auto Trait Implementations§
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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.