pub struct SchemaDefinition {Show 15 fields
pub schema_type: SchemaType,
pub format: Option<String>,
pub description: Option<String>,
pub items: Option<Box<SchemaDefinition>>,
pub properties: BTreeMap<String, SchemaDefinition>,
pub required: Vec<String>,
pub ref_name: Option<String>,
pub enum_values: Vec<String>,
pub example: Option<String>,
pub default: Option<String>,
pub nullable: bool,
pub additional_properties: Option<Box<SchemaDefinition>>,
pub one_of: Vec<SchemaDefinition>,
pub any_of: Vec<SchemaDefinition>,
pub all_of: Vec<SchemaDefinition>,
}Expand description
Schema definition for a type.
Fields§
§schema_type: SchemaTypeSchema type.
format: Option<String>Format (e.g., “int64”, “email”, “date-time”).
description: Option<String>Description.
items: Option<Box<SchemaDefinition>>For arrays, the item schema.
properties: BTreeMap<String, SchemaDefinition>For objects, property schemas.
required: Vec<String>Required property names.
ref_name: Option<String>Reference name (for $ref).
enum_values: Vec<String>Enum values.
example: Option<String>Example value.
default: Option<String>Default value.
nullable: boolNullable flag.
additional_properties: Option<Box<SchemaDefinition>>Additional properties schema (for objects).
one_of: Vec<SchemaDefinition>OneOf schemas.
any_of: Vec<SchemaDefinition>AnyOf schemas.
all_of: Vec<SchemaDefinition>AllOf schemas.
Implementations§
Source§impl SchemaDefinition
impl SchemaDefinition
Sourcepub fn display_type(&self) -> String
pub fn display_type(&self) -> String
Get a display type string (e.g., “string”, “array<User>”, “object”).
Sourcepub fn is_complex(&self) -> bool
pub fn is_complex(&self) -> bool
Check if this is a complex type (object or array with object items).
Sourcepub fn generate_example_json(&self, depth: usize) -> Value
pub fn generate_example_json(&self, depth: usize) -> Value
Generate example JSON for this schema.
Uses explicit example if present, otherwise generates placeholder values by type.
depth prevents infinite recursion from circular refs (max 5).
Trait Implementations§
Source§impl Clone for SchemaDefinition
impl Clone for SchemaDefinition
Source§fn clone(&self) -> SchemaDefinition
fn clone(&self) -> SchemaDefinition
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 SchemaDefinition
impl Debug for SchemaDefinition
Source§impl Default for SchemaDefinition
impl Default for SchemaDefinition
Source§impl PartialEq for SchemaDefinition
impl PartialEq for SchemaDefinition
impl StructuralPartialEq for SchemaDefinition
Auto Trait Implementations§
impl Freeze for SchemaDefinition
impl RefUnwindSafe for SchemaDefinition
impl Send for SchemaDefinition
impl Sync for SchemaDefinition
impl Unpin for SchemaDefinition
impl UnsafeUnpin for SchemaDefinition
impl UnwindSafe for SchemaDefinition
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> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
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<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.