Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatSummary ¶
FormatSummary produces a one-line summary of classified diffs. Example: "2 critical, 1 warning, 3 info"
func InferSchema ¶
InferSchema extracts a type-only schema from a JSON body. Values are replaced with their types: "string", "number", "boolean", "null", "array", "object". Nested structures are preserved.
Types ¶
type ClassifiedDiff ¶
ClassifiedDiff wraps a FieldDiff with a severity classification.
func ClassifyDiffs ¶
func ClassifyDiffs(fields []FieldDiff) []ClassifiedDiff
ClassifyDiffs takes raw field diffs and assigns a severity to each one based on what changed and where.
type DiffEngine ¶
type DiffEngine struct {
IgnoreRules IgnoreChecker
Normalizer ValueNormalizer
SchemaMode bool // when true, compare types/structure only, ignore values
}
DiffEngine compares stored and live snapshot entries.
func NewDiffEngine ¶
func NewDiffEngine() *DiffEngine
NewDiffEngine creates a new DiffEngine with no ignore rules.
func NewDiffEngineFull ¶
func NewDiffEngineFull(rules IgnoreChecker, normalizer ValueNormalizer) *DiffEngine
NewDiffEngineFull creates a DiffEngine with both ignore rules and normalization.
func NewDiffEngineWithIgnore ¶
func NewDiffEngineWithIgnore(rules IgnoreChecker) *DiffEngine
NewDiffEngineWithIgnore creates a DiffEngine that skips fields matching the given rules.
func (*DiffEngine) Compare ¶
func (d *DiffEngine) Compare(stored, live *snapshot.SnapshotEntry) DiffResult
Compare compares stored vs live snapshot, filtering ignored fields.
func (*DiffEngine) FormatDiff ¶
func (d *DiffEngine) FormatDiff(result DiffResult, color bool) string
FormatDiff formats a DiffResult as a human-readable string with severity indicators. When color is true, ANSI escape codes are used.
type DiffResult ¶
DiffResult represents the comparison result for a single request.
type FieldDiff ¶
FieldDiff represents a single field-level difference.
func CompareSchemas ¶
CompareSchemas compares two inferred schemas and returns field diffs for structural/type changes only. Value changes are completely ignored.
type IgnoreChecker ¶
IgnoreChecker decides whether a field path should be skipped during comparison.