Skip to main content

Normalizer

Trait Normalizer 

Source
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§

Source

fn schema_version(&self) -> GenomeSchemaVersion

Schema version this normalizer targets.

Source

fn name(&self) -> &'static str

Stable identifier for diagnostics and logs.

Source

fn normalize( &self, genome: &mut Value, ) -> Result<NormalizationDiagnostics, MigrationError>

Apply corrections in place. Returns diagnostics describing what changed, or an error on hard failure.

Implementors§