pub struct SchemaProperty {
pub property_type: Option<Value>,
pub description: Option<String>,
pub format: Option<String>,
pub items: Option<Box<SchemaProperty>>,
pub properties: Option<HashMap<String, SchemaProperty>>,
pub required: Option<Vec<String>>,
pub default: Option<Value>,
pub enum_values: Option<Vec<Value>>,
pub reference: Option<String>,
pub additional: HashMap<String, Value>,
}Expand description
A property definition in a schema
Fields§
§property_type: Option<Value>The type of this property (can be a single type or array of types for nullable)
description: Option<String>Description of this property
format: Option<String>Format hint (e.g., “uuid”, “date-time”, “email”)
items: Option<Box<SchemaProperty>>For array types, the schema of items
properties: Option<HashMap<String, SchemaProperty>>For object types, nested properties
required: Option<Vec<String>>Required properties (for object types)
default: Option<Value>Default value for this property
enum_values: Option<Vec<Value>>Enum values if this is an enum
reference: Option<String>Reference to another schema definition
additional: HashMap<String, Value>Any additional property metadata
Implementations§
Source§impl SchemaProperty
impl SchemaProperty
Sourcepub fn string() -> SchemaProperty
pub fn string() -> SchemaProperty
Create a string property
Sourcepub fn uuid() -> SchemaProperty
pub fn uuid() -> SchemaProperty
Create a UUID property (string with format)
Sourcepub fn integer() -> SchemaProperty
pub fn integer() -> SchemaProperty
Create an integer property
Sourcepub fn object() -> SchemaProperty
pub fn object() -> SchemaProperty
Create an object property
Sourcepub fn array(items: SchemaProperty) -> SchemaProperty
pub fn array(items: SchemaProperty) -> SchemaProperty
Create an array property
Sourcepub fn with_description(self, description: impl Into<String>) -> SchemaProperty
pub fn with_description(self, description: impl Into<String>) -> SchemaProperty
Add a description
Sourcepub fn with_default(self, default: Value) -> SchemaProperty
pub fn with_default(self, default: Value) -> SchemaProperty
Add a default value
Sourcepub fn with_property(
self,
name: impl Into<String>,
property: SchemaProperty,
) -> SchemaProperty
pub fn with_property( self, name: impl Into<String>, property: SchemaProperty, ) -> SchemaProperty
Add nested properties (for object types)
Trait Implementations§
Source§impl Clone for SchemaProperty
impl Clone for SchemaProperty
Source§fn clone(&self) -> SchemaProperty
fn clone(&self) -> SchemaProperty
Returns a duplicate of the value. Read more
1.0.0 · 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 SchemaProperty
impl Debug for SchemaProperty
Source§impl<'de> Deserialize<'de> for SchemaProperty
impl<'de> Deserialize<'de> for SchemaProperty
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaProperty, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaProperty, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for SchemaProperty
impl Serialize for SchemaProperty
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for SchemaProperty
impl RefUnwindSafe for SchemaProperty
impl Send for SchemaProperty
impl Sync for SchemaProperty
impl Unpin for SchemaProperty
impl UnsafeUnpin for SchemaProperty
impl UnwindSafe for SchemaProperty
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more