Skip to main content

Schema

Struct Schema 

Source
pub struct Schema<T: SchemaType> { /* private fields */ }

Implementations§

Source§

impl<T: SchemaType> Schema<T>

Source

pub fn component(name: &'static str, schema: Self) -> Self

Source§

impl Schema<string>

Source

pub fn string() -> Self

Source§

impl Schema<number>

Source

pub fn number() -> Self

Source§

impl Schema<integer>

Source

pub fn integer() -> Self

Source§

impl Schema<bool>

Source

pub fn bool() -> Self

Source§

impl Schema<array>

Source

pub fn array(items: impl Into<SchemaRef>) -> Self

Source§

impl Schema<object>

Source

pub fn object() -> Self

Source§

impl Schema<any>

Source

pub fn any_of(schemas: impl SchemaList) -> Self

Source

pub fn all_of(schemas: impl SchemaList) -> Self

Source

pub fn one_of(schemas: impl SchemaList) -> Self

Source§

impl<T: SchemaType> Schema<T>

Source

pub fn description(self, description: &'static str) -> Self

Source

pub fn default(self, default: impl Serialize) -> Self

Source

pub fn example(self, example: impl Serialize) -> Self

Source

pub fn enumerates<const N: usize, V: Serialize>( self, enumerates: [V; N], ) -> Self

Source

pub fn deprecated(self) -> Self

Source

pub fn nullable(self) -> Self

Source

pub fn read_only(self) -> Self

Source

pub fn write_only(self) -> Self

Source§

impl Schema<string>

Source

pub fn format(self, format: &'static str) -> Self

Source

pub fn pattern(self, pattern: &'static str) -> Self

Source§

impl Schema<object>

Source

pub fn property(self, name: &'static str, schema: impl Into<SchemaRef>) -> Self

Source

pub fn optional(self, name: &'static str, schema: impl Into<SchemaRef>) -> Self

Source§

impl Schema<array>

Source

pub fn max_items(self, max_items: usize) -> Self

Source

pub fn min_items(self, min_items: usize) -> Self

Source

pub fn max_properties(self, max_properties: usize) -> Self

Source

pub fn min_properties(self, min_properties: usize) -> Self

Source

pub fn max_length(self, max_length: usize) -> Self

Source

pub fn min_length(self, min_length: usize) -> Self

Source

pub fn unique_items(self) -> Self

Source§

impl Schema<number>

Source

pub fn format(self, format: &'static str) -> Self

Source

pub fn multiple_of(self, n: impl Into<f64>) -> Self

Source

pub fn maximum(self, maximum: impl Into<f64>) -> Self

Source

pub fn exclusive_maximum(self, maximum: impl Into<f64>) -> Self

Source

pub fn minimum(self, minimum: impl Into<f64>) -> Self

Source

pub fn exclusive_minimum(self, minimum: impl Into<f64>) -> Self

Source§

impl Schema<integer>

Source

pub fn format(self, format: &'static str) -> Self

Source

pub fn multiple_of(self, n: i32) -> Self

Source

pub fn maximum(self, maximum: i32) -> Self

Source

pub fn exclusive_maximum(self, maximum: i32) -> Self

Source

pub fn minimum(self, minimum: i32) -> Self

Source

pub fn exclusive_minimum(self, minimum: i32) -> Self

Trait Implementations§

Source§

impl<T: SchemaType> From<RawSchema> for Schema<T>

Source§

fn from(raw: RawSchema) -> Self

Converts to this type from the input type.
Source§

impl<T: SchemaType> From<Schema<T>> for RawSchema

Source§

fn from(schema: Schema<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: SchemaType> From<Schema<T>> for ResponseHeader

Source§

fn from(schema: Schema<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: SchemaType> From<Schema<T>> for SchemaRef

Source§

fn from(schema: Schema<T>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> Freeze for Schema<T>

§

impl<T> RefUnwindSafe for Schema<T>

§

impl<T> Send for Schema<T>

§

impl<T> Sync for Schema<T>

§

impl<T> Unpin for Schema<T>

§

impl<T> UnsafeUnpin for Schema<T>

§

impl<T> UnwindSafe for Schema<T>

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, 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<S> SchemaList for S
where S: Into<SchemaRef>,

Source§

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

Source§

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>,

Source§

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.