MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / compute_field_diffs

Function compute_field_diffs

nodedb/src/event/field_diff.rs:147–151  ·  view source on GitHub ↗

Compute field-level diffs between two JSON objects. Returns an empty Vec if both values are identical or if either is not an object (non-objects are opaque — we can't produce field-level diffs).

(old: &serde_json::Value, new: &serde_json::Value)

Source from the content-addressed store, hash-verified

145/// Returns an empty Vec if both values are identical or if either is not
146/// an object (non-objects are opaque — we can't produce field-level diffs).
147pub fn compute_field_diffs(old: &serde_json::Value, new: &serde_json::Value) -> Vec<FieldDiff> {
148 let mut diffs = Vec::new();
149 diff_values(&mut diffs, "", old, new);
150 diffs
151}
152
153/// Recursive diff of two JSON values at a given path prefix.
154fn diff_values(

Callers 14

scalar_field_modifiedFunction · 0.85
field_added_and_removedFunction · 0.85
nested_object_diffFunction · 0.85
array_element_modifiedFunction · 0.85
array_element_insertedFunction · 0.85
array_element_removedFunction · 0.85
deep_nested_block_changeFunction · 0.85
insert_only_no_old_valueFunction · 0.85
text_insert_detectedFunction · 0.85
text_delete_detectedFunction · 0.85

Calls 1

diff_valuesFunction · 0.85

Tested by 13

scalar_field_modifiedFunction · 0.68
field_added_and_removedFunction · 0.68
nested_object_diffFunction · 0.68
array_element_modifiedFunction · 0.68
array_element_insertedFunction · 0.68
array_element_removedFunction · 0.68
deep_nested_block_changeFunction · 0.68
insert_only_no_old_valueFunction · 0.68
text_insert_detectedFunction · 0.68
text_delete_detectedFunction · 0.68