pub struct SchemaRegistry { /* private fields */ }Expand description
Registry for loading and storing schemas
Implementations§
Source§impl SchemaRegistry
impl SchemaRegistry
Sourcepub fn from_directory(schemas_dir: &Path) -> ValidationResult<Self>
pub fn from_directory(schemas_dir: &Path) -> ValidationResult<Self>
Sourcepub fn validate_values(
&self,
namespace: &str,
values: &Value,
) -> ValidationResult<()>
pub fn validate_values( &self, namespace: &str, values: &Value, ) -> ValidationResult<()>
Sourcepub fn get(&self, namespace: &str) -> Option<&Arc<NamespaceSchema>>
pub fn get(&self, namespace: &str) -> Option<&Arc<NamespaceSchema>>
Get a namespace schema by name
Sourcepub fn schemas(&self) -> &HashMap<String, Arc<NamespaceSchema>>
pub fn schemas(&self) -> &HashMap<String, Arc<NamespaceSchema>>
Get all loaded schemas (for schema evolution validation)
Sourcepub fn load_values_json(
&self,
values_dir: &Path,
) -> ValidationResult<(ValuesByNamespace, HashMap<String, String>)>
pub fn load_values_json( &self, values_dir: &Path, ) -> ValidationResult<(ValuesByNamespace, HashMap<String, String>)>
Load and validate JSON values from a directory.
Expects structure: {values_dir}/{namespace}/values.json
Values file must have format: {"options": {"key": value, ...}, "generated_at": "..."}
Skips namespaces without a values.json file.
Returns the values and a map of namespace -> generated_at timestamp.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SchemaRegistry
impl !RefUnwindSafe for SchemaRegistry
impl Send for SchemaRegistry
impl Sync for SchemaRegistry
impl Unpin for SchemaRegistry
impl !UnwindSafe for SchemaRegistry
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