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 array(items: SchemaProperty) -> Self
pub fn array(items: SchemaProperty) -> Self
Create an array property
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Add a description
Sourcepub fn with_default(self, default: Value) -> Self
pub fn with_default(self, default: Value) -> Self
Add a default value
Sourcepub fn with_property(
self,
name: impl Into<String>,
property: SchemaProperty,
) -> Self
pub fn with_property( self, name: impl Into<String>, property: SchemaProperty, ) -> Self
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<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 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