pub trait Normalizer: Send + Sync {
// Required methods
fn schema_version(&self) -> GenomeSchemaVersion;
fn name(&self) -> &'static str;
fn normalize(
&self,
genome: &mut Value,
) -> Result<NormalizationDiagnostics, MigrationError>;
}Expand description
In-place cleanup of a genome at a specific schema version.
Reuses MigrationError for failure reporting because normalizers and
migrators raise structurally identical errors (step name, version,
reason). Adding a parallel error enum would only duplicate the variants.
Required Methods§
Sourcefn schema_version(&self) -> GenomeSchemaVersion
fn schema_version(&self) -> GenomeSchemaVersion
Schema version this normalizer targets.
Sourcefn normalize(
&self,
genome: &mut Value,
) -> Result<NormalizationDiagnostics, MigrationError>
fn normalize( &self, genome: &mut Value, ) -> Result<NormalizationDiagnostics, MigrationError>
Apply corrections in place. Returns diagnostics describing what changed, or an error on hard failure.