pub struct PropertiesSchema {
pub properties: HashMap<String, Box<dyn Serializable>>,
pub optional_properties: HashMap<String, Box<dyn Serializable>>,
pub is_strict: Option<bool>,
pub metadata: Option<MetadataSchema>,
pub is_nullable: Option<bool>,
}Expand description
Represents a schema for properties in an Arri schema.
This struct defines the properties, optional properties, and metadata associated with a schema. It also includes flags for strictness and nullability.
Fields§
§properties: HashMap<String, Box<dyn Serializable>>A map of required properties, where the key is the property name and the value is a serializable object.
optional_properties: HashMap<String, Box<dyn Serializable>>A map of optional properties, where the key is the property name and the value is a serializable object.
is_strict: Option<bool>Indicates whether the schema is strict. If Some(true), the schema
enforces strict validation.
metadata: Option<MetadataSchema>Metadata associated with the schema.
is_nullable: Option<bool>Indicates whether the schema allows null values. If Some(true),
null values are permitted.
Implementations§
Source§impl PropertiesSchema
impl PropertiesSchema
Sourcepub fn new() -> PropertiesSchema
pub fn new() -> PropertiesSchema
Creates a new PropertiesSchema instance with default values.
Sourcepub fn set_property(
&mut self,
key: impl ToString,
value: Box<dyn Serializable>,
) -> &mut PropertiesSchema
pub fn set_property( &mut self, key: impl ToString, value: Box<dyn Serializable>, ) -> &mut PropertiesSchema
Sourcepub fn set_optional_property(
&mut self,
key: impl ToString,
value: Box<dyn Serializable>,
) -> &mut PropertiesSchema
pub fn set_optional_property( &mut self, key: impl ToString, value: Box<dyn Serializable>, ) -> &mut PropertiesSchema
Sourcepub fn set_strict(&mut self, strict: bool) -> &mut PropertiesSchema
pub fn set_strict(&mut self, strict: bool) -> &mut PropertiesSchema
Trait Implementations§
Source§impl Debug for PropertiesSchema
impl Debug for PropertiesSchema
Source§impl Default for PropertiesSchema
impl Default for PropertiesSchema
Source§fn default() -> PropertiesSchema
fn default() -> PropertiesSchema
Source§impl PartialEq for PropertiesSchema
impl PartialEq for PropertiesSchema
Source§impl Serializable for PropertiesSchema
impl Serializable for PropertiesSchema
Source§fn serialize(&self) -> Option<String>
fn serialize(&self) -> Option<String>
Serializes the PropertiesSchema into a string representation.
§Returns
An Option<String> containing the serialized schema, or None if serialization fails.
Source§fn set_metadata(&mut self, metadata: MetadataSchema)
fn set_metadata(&mut self, metadata: MetadataSchema)
Sets the metadata for the schema.
§Arguments
metadata- AMetadataSchemaobject to be merged with the existing metadata.
Source§fn set_nullable(&mut self, is_nullable: bool)
fn set_nullable(&mut self, is_nullable: bool)
Sets the nullability flag for the schema.
§Arguments
is_nullable- A boolean indicating whether null values are allowed.
Source§fn set_rename(&mut self, new_name: &str)
fn set_rename(&mut self, new_name: &str)
impl Eq for PropertiesSchema
impl StructuralPartialEq for PropertiesSchema
Auto Trait Implementations§
impl Freeze for PropertiesSchema
impl !RefUnwindSafe for PropertiesSchema
impl !Send for PropertiesSchema
impl !Sync for PropertiesSchema
impl Unpin for PropertiesSchema
impl !UnwindSafe for PropertiesSchema
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.