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

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, exclusive: bool)

source

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

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) -> Builder
where F: FnOnce(&mut Builder),

source

pub fn into_json(self) -> Value

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 T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> GetTypeId for T
where T: Any,

source§

fn typeid(&self) -> TypeId

source§

impl<T, U> Into<U> for T
where 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, U> TryFrom<U> for T
where 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 T
where 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.