Schema

Struct Schema 

Source
pub struct Schema {
Show 22 fields pub min_items: Option<String>, pub example: Option<Value>, pub property_ordering: Option<Vec<String>>, pub pattern: Option<String>, pub minimum: Option<f64>, pub default: Option<Value>, pub any_of: Option<Vec<Schema>>, pub max_length: Option<String>, pub title: Option<String>, pub min_length: Option<String>, pub min_properties: Option<String>, pub max_items: Option<String>, pub maximum: Option<f64>, pub nullable: Option<bool>, pub max_properties: Option<String>, pub type: Option<Type>, pub description: Option<String>, pub enum: Option<Vec<String>>, pub format: Option<String>, pub items: Option<Box<Schema>>, pub properties: Option<HashMap<String, Schema>>, pub required: Option<Vec<String>>,
}
Expand description

Schema that defines the format of input and output data. Represents a select subset of an OpenAPI 3.0 schema object.

Fields§

§min_items: Option<String>

Optional. Minimum number of elements for Type.ARRAY.

§example: Option<Value>

Optional. Example of the object.

§property_ordering: Option<Vec<String>>

Optional. The order of the properties.

§pattern: Option<String>

Optional. Pattern of the Type.STRING to restrict a string to a regular expression.

§minimum: Option<f64>

Optional. Minimum value of the Type.INTEGER and Type.NUMBER.

§default: Option<Value>

Optional. Default value of the data.

§any_of: Option<Vec<Schema>>

Optional. The value should be validated against any of the subschemas.

§max_length: Option<String>

Optional. Maximum length of the Type.STRING.

§title: Option<String>

Optional. The title of the Schema.

§min_length: Option<String>

Optional. Minimum length of the Type.STRING.

§min_properties: Option<String>

Optional. Minimum number of properties for Type.OBJECT.

§max_items: Option<String>

Optional. Maximum number of elements for Type.ARRAY.

§maximum: Option<f64>

Optional. Maximum value of the Type.INTEGER and Type.NUMBER.

§nullable: Option<bool>

Optional. Indicates if the value may be null.

§max_properties: Option<String>

Optional. Maximum number of properties for Type.OBJECT.

§type: Option<Type>

Optional. The type of the data.

§description: Option<String>

Optional. The description of the data.

§enum: Option<Vec<String>>

Optional. Possible values of the element of primitive type with enum format.

§format: Option<String>

Optional. The format of the data.

§items: Option<Box<Schema>>

Optional. Schema of the elements of Type.ARRAY.

§properties: Option<HashMap<String, Schema>>

Optional. Properties of Type.OBJECT.

§required: Option<Vec<String>>

Optional. Required properties of Type.OBJECT.

Implementations§

Source§

impl Schema

Source

pub fn min_items(self, value: impl Into<String>) -> Self

Sets the min_items field of this struct.

Source

pub fn example(self, value: impl Into<Value>) -> Self

Sets the example field of this struct.

Source

pub fn property_ordering(self, value: impl Into<Vec<String>>) -> Self

Sets the property_ordering field of this struct.

Source

pub fn pattern(self, value: impl Into<String>) -> Self

Sets the pattern field of this struct.

Source

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

Sets the minimum field of this struct.

Source

pub fn default(self, value: impl Into<Value>) -> Self

Sets the default field of this struct.

Source

pub fn any_of(self, value: impl Into<Vec<Schema>>) -> Self

Sets the any_of field of this struct.

Source

pub fn max_length(self, value: impl Into<String>) -> Self

Sets the max_length field of this struct.

Source

pub fn title(self, value: impl Into<String>) -> Self

Sets the title field of this struct.

Source

pub fn min_length(self, value: impl Into<String>) -> Self

Sets the min_length field of this struct.

Source

pub fn min_properties(self, value: impl Into<String>) -> Self

Sets the min_properties field of this struct.

Source

pub fn max_items(self, value: impl Into<String>) -> Self

Sets the max_items field of this struct.

Source

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

Sets the maximum field of this struct.

Source

pub fn nullable(self, value: impl Into<bool>) -> Self

Sets the nullable field of this struct.

Source

pub fn max_properties(self, value: impl Into<String>) -> Self

Sets the max_properties field of this struct.

Source

pub fn description(self, value: impl Into<String>) -> Self

Sets the description field of this struct.

Source

pub fn format(self, value: impl Into<String>) -> Self

Sets the format field of this struct.

Source

pub fn items(self, value: impl Into<Box<Schema>>) -> Self

Sets the items field of this struct.

Source

pub fn properties(self, value: impl Into<HashMap<String, Schema>>) -> Self

Sets the properties field of this struct.

Source

pub fn required(self, value: impl Into<Vec<String>>) -> Self

Sets the required field of this struct.

Trait Implementations§

Source§

impl Clone for Schema

Source§

fn clone(&self) -> Schema

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Schema

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Schema

Source§

fn default() -> Schema

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Schema

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Schema

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§

§

impl Freeze for Schema

§

impl RefUnwindSafe for Schema

§

impl Send for Schema

§

impl Sync for Schema

§

impl Unpin for Schema

§

impl UnwindSafe for Schema

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,