pub enum Schema {
Reference {
reference: String,
extra: BTreeMap<String, Value>,
},
RecursiveRef {
recursive_ref: String,
extra: BTreeMap<String, Value>,
},
OneOf {
one_of: Vec<Schema>,
discriminator: Option<Discriminator>,
details: SchemaDetails,
},
AnyOf {
schema_type: Option<SchemaType>,
any_of: Vec<Schema>,
discriminator: Option<Discriminator>,
details: SchemaDetails,
},
Typed {
schema_type: SchemaType,
details: SchemaDetails,
},
AllOf {
all_of: Vec<Schema>,
details: SchemaDetails,
},
Untyped {
details: SchemaDetails,
},
}Variants§
Reference
Schema reference
RecursiveRef
Recursive reference (OpenAPI 3.1)
OneOf
OneOf union
AnyOf
AnyOf union (must come before Typed to handle type + anyOf patterns)
Typed
Schema with explicit type
AllOf
AllOf composition
Untyped
Schema without explicit type (inferred from other fields)
Fields
§
details: SchemaDetailsImplementations§
Source§impl Schema
impl Schema
Sourcepub fn schema_type(&self) -> Option<&SchemaType>
pub fn schema_type(&self) -> Option<&SchemaType>
Get the schema type if explicitly set
Sourcepub fn details(&self) -> &SchemaDetails
pub fn details(&self) -> &SchemaDetails
Get schema details
Sourcepub fn details_mut(&mut self) -> &mut SchemaDetails
pub fn details_mut(&mut self) -> &mut SchemaDetails
Get mutable schema details
Sourcepub fn is_reference(&self) -> bool
pub fn is_reference(&self) -> bool
Check if this is any kind of reference (regular or recursive)
Sourcepub fn recursive_reference(&self) -> Option<&str>
pub fn recursive_reference(&self) -> Option<&str>
Get recursive reference string if this is a recursive reference
Sourcepub fn is_discriminated_union(&self) -> bool
pub fn is_discriminated_union(&self) -> bool
Check if this is a discriminated union
Sourcepub fn discriminator(&self) -> Option<&Discriminator>
pub fn discriminator(&self) -> Option<&Discriminator>
Get discriminator if this is a discriminated union
Sourcepub fn union_variants(&self) -> Option<&[Schema]>
pub fn union_variants(&self) -> Option<&[Schema]>
Get union variants
Sourcepub fn is_nullable_pattern(&self) -> bool
pub fn is_nullable_pattern(&self) -> bool
Check if this appears to be a nullable pattern (anyOf with null)
Sourcepub fn non_null_variant(&self) -> Option<&Schema>
pub fn non_null_variant(&self) -> Option<&Schema>
Get the non-null variant from a nullable pattern
Sourcepub fn inferred_type(&self) -> Option<SchemaType>
pub fn inferred_type(&self) -> Option<SchemaType>
Infer schema type from structure if not explicitly set
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schema
impl<'de> Deserialize<'de> for Schema
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 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> 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