pub struct PrimitiveSchema {
pub schema_type: String,
pub format: Option<String>,
pub description: Option<String>,
pub default: Option<Value>,
pub example: Option<Value>,
pub enum_values: Option<Vec<Value>>,
pub minimum: Option<f64>,
pub maximum: Option<f64>,
pub min_length: Option<u32>,
pub max_length: Option<u32>,
pub pattern: Option<String>,
}Expand description
基本类型 Schema(string/integer/number/boolean)
Fields§
§schema_type: String§format: Option<String>§description: Option<String>§default: Option<Value>§example: Option<Value>§enum_values: Option<Vec<Value>>§minimum: Option<f64>§maximum: Option<f64>§min_length: Option<u32>§max_length: Option<u32>§pattern: Option<String>Implementations§
Source§impl PrimitiveSchema
impl PrimitiveSchema
pub fn string() -> Self
pub fn integer() -> Self
pub fn number() -> Self
pub fn boolean() -> Self
pub fn with_format(self, format: &str) -> Self
pub fn with_description(self, desc: &str) -> Self
pub fn with_default(self, value: Value) -> Self
pub fn with_example(self, value: Value) -> Self
pub fn with_enum(self, values: Vec<Value>) -> Self
pub fn with_range(self, min: f64, max: f64) -> Self
pub fn with_length_range(self, min: u32, max: u32) -> Self
pub fn with_pattern(self, pattern: &str) -> Self
Trait Implementations§
Source§impl Clone for PrimitiveSchema
impl Clone for PrimitiveSchema
Source§fn clone(&self) -> PrimitiveSchema
fn clone(&self) -> PrimitiveSchema
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrimitiveSchema
impl Debug for PrimitiveSchema
Source§impl<'de> Deserialize<'de> for PrimitiveSchema
impl<'de> Deserialize<'de> for PrimitiveSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PrimitiveSchema
impl RefUnwindSafe for PrimitiveSchema
impl Send for PrimitiveSchema
impl Sync for PrimitiveSchema
impl Unpin for PrimitiveSchema
impl UnsafeUnpin for PrimitiveSchema
impl UnwindSafe for PrimitiveSchema
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