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 from_schemas(schemas: &[(&str, &str)]) -> ValidationResult<Self>
pub fn from_schemas(schemas: &[(&str, &str)]) -> ValidationResult<Self>
Build a registry from in-memory schema JSON strings.
Each entry is a (namespace, json) pair. Applies the same validation
pipeline as from_directory (meta-schema check, constraint injection,
validator compilation) without reading from the filesystem.
Sourcepub fn validate_values(
&self,
namespace: &str,
values: &Value,
) -> ValidationResult<()>
pub fn validate_values( &self, namespace: &str, values: &Value, ) -> ValidationResult<()>
Validate an entire values object for a namespace
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. Allows extra unknown option values to accommodate deployment race conditions
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.