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

source

pub fn new() -> Builder

source

pub fn id(&mut self, url: &str)

source

pub fn ref_(&mut self, url: &str)

source

pub fn schema(&mut self, url: &str)

source

pub fn desc(&mut self, text: &str)

source

pub fn title(&mut self, text: &str)

source

pub fn default<T>(&mut self, default: T)where T: Serialize,

source

pub fn multiple_of(&mut self, number: f64)

source

pub fn maximum(&mut self, number: f64)

source

pub fn exclusive_maximum(&mut self, number: f64)

source

pub fn minimum(&mut self, number: f64)

source

pub fn exclusive_minimum(&mut self, number: f64)

source

pub fn max_length(&mut self, number: u64)

source

pub fn min_length(&mut self, number: u64)

source

pub fn pattern(&mut self, pattern: &str)

source

pub fn format(&mut self, format: &str)

source

pub fn items_schema<F>(&mut self, build: F)where F: FnOnce(&mut Builder),

source

pub fn items_array<F>(&mut self, build: F)where F: FnOnce(&mut SchemaArray),

source

pub fn additional_items(&mut self, allow: bool)

source

pub fn additional_items_schema<F>(&mut self, build: F)where F: FnOnce(&mut Builder),

source

pub fn max_items(&mut self, number: u64)

source

pub fn min_items(&mut self, number: u64)

source

pub fn unique_items(&mut self, unique: bool)

source

pub fn max_properties(&mut self, number: u64)

source

pub fn min_properties(&mut self, number: u64)

source

pub fn required(&mut self, items: Vec<String>)

source

pub fn properties<F>(&mut self, build: F)where F: FnOnce(&mut SchemaHash),

source

pub fn pattern_properties<F>(&mut self, build: F)where F: FnOnce(&mut SchemaHash),

source

pub fn additional_properties(&mut self, allow: bool)

source

pub fn additional_properties_schema<F>(&mut self, build: F)where F: FnOnce(&mut Builder),

source

pub fn dependencies<F>(&mut self, build: F)where F: FnOnce(&mut Dependencies),

source

pub fn enum_<F>(&mut self, build: F)where F: FnOnce(&mut ArrayBuilder),

source

pub fn array(&mut self)

source

pub fn boolean(&mut self)

source

pub fn integer(&mut self)

source

pub fn number(&mut self)

source

pub fn null(&mut self)

source

pub fn object(&mut self)

source

pub fn string(&mut self)

source

pub fn type_(&mut self, type_: PrimitiveType)

source

pub fn types(&mut self, types: &[PrimitiveType])

source

pub fn all_of<F>(&mut self, build: F)where F: FnOnce(&mut SchemaArray),

source

pub fn any_of<F>(&mut self, build: F)where F: FnOnce(&mut SchemaArray),

source

pub fn one_of<F>(&mut self, build: F)where F: FnOnce(&mut SchemaArray),

source

pub fn not<F>(&mut self, build: F)where F: FnOnce(&mut Builder),

source

pub fn build<F>(build: F) -> Builderwhere F: FnOnce(&mut Builder),

source

pub fn into_json(self) -> Value

source

pub fn content_media_type(&mut self, type_: ContentMediaType)

source

pub fn content_encoding(&mut self, type_: ContentEncoding)

source

pub fn if_<F>(&mut self, build: F)where F: FnOnce(&mut Builder),

source

pub fn then_<F>(&mut self, build: F)where F: FnOnce(&mut Builder),

source

pub fn else_<F>(&mut self, build: F)where F: FnOnce(&mut Builder),

source

pub fn custom_vocabulary<V: Serialize, N: Into<String>>( &mut self, name: N, value: V )

Trait Implementations§

source§

impl Serialize for Builder

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast for Twhere T: Any,

source§

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>

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)

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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync + 'static>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Serialize for Twhere T: Serialize + ?Sized,

source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.