pub struct SchemaValidator { /* private fields */ }
Expand description
Schema validator for configuration values
Implementations§
Source§impl SchemaValidator
impl SchemaValidator
Sourcepub fn add_schema<T>(self, path: &str) -> Selfwhere
T: Serialize + for<'de> Deserialize<'de>,
pub fn add_schema<T>(self, path: &str) -> Selfwhere
T: Serialize + for<'de> Deserialize<'de>,
Add a schema for a specific configuration path
Sourcepub fn add_schema_from_json(self, path: &str, schema: JsonValue) -> Result<Self>
pub fn add_schema_from_json(self, path: &str, schema: JsonValue) -> Result<Self>
Add a schema from a JSON schema object
Sourcepub fn add_schema_from_string(
self,
path: &str,
schema_str: &str,
) -> Result<Self>
pub fn add_schema_from_string( self, path: &str, schema_str: &str, ) -> Result<Self>
Add a schema from a JSON schema string
Sourcepub fn validate(&self, config: &ConfigValue) -> Result<()>
pub fn validate(&self, config: &ConfigValue) -> Result<()>
Validate a configuration value against all applicable schemas
Sourcepub fn validate_path(&self, path: &str, value: &ConfigValue) -> Result<()>
pub fn validate_path(&self, path: &str, value: &ConfigValue) -> Result<()>
Validate a specific configuration value at a path
Sourcepub fn schema_paths(&self) -> Vec<String>
pub fn schema_paths(&self) -> Vec<String>
Get the list of schema paths
Sourcepub fn has_schema(&self, path: &str) -> bool
pub fn has_schema(&self, path: &str) -> bool
Check if a schema exists for a given path
Sourcepub fn remove_schema(&mut self, path: &str) -> bool
pub fn remove_schema(&mut self, path: &str) -> bool
Remove a schema for a path
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SchemaValidator
impl !RefUnwindSafe for SchemaValidator
impl Send for SchemaValidator
impl Sync for SchemaValidator
impl Unpin for SchemaValidator
impl !UnwindSafe for SchemaValidator
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