Skip to main content

Module repair

Module repair 

Source
Expand description

Generic JSON repair logic

This module provides generic fuzzy repair functions that work with any schema provided by the caller.

§Architecture

Repair walks the JSON value tree guided by the schema:

  1. Field-name repair — object keys are fuzzy-matched against the schema’s field names and renamed (collision-safe, first-win; skipped renames are recorded as SkippedCorrections).
  2. Value repair — each field’s value is repaired according to its FieldKind: fuzzy correction against closed sets, recursive descent into nested objects / arrays of objects, or scalar type coercion.

Every change is recorded as a Correction; every rename that was not applied because the target key already existed is recorded as a SkippedCorrection. Nothing is changed silently.

Structs§

Correction
A single correction made during repair
FuzzyOptions
Options for fuzzy repair
RepairLog
Accumulated log of a repair pass: applied and skipped corrections.
RepairResult
Result of a repair operation
SkippedCorrection
A correction that was found but not applied.

Enums§

SkipReason
Why a candidate correction was not applied.

Functions§

repair_enum_array
Repair values in an enum array
repair_fields_with_list
Repair field names in a JSON object using a field list
repair_object_fields
Repair a JSON object using an ObjectSchema
repair_tagged_enum
Repair a tagged enum JSON object using a TaggedEnumSchema
repair_tagged_enum_array
Repair an array of tagged enums
repair_tagged_enum_json
Repair a tagged enum from JSON string