Sorted keys

This commit is contained in:
Joe 2025-12-09 00:28:13 -06:00
parent d08780fc14
commit 929bc254fa
16 changed files with 145 additions and 36 deletions

View file

@ -111,7 +111,7 @@ pub fn syncback_csv<'sync>(
let parent = snapshot.path.parent_err()?;
fs_snapshot.add_file(
parent.join(format!("{}.meta.json", new_inst.name)),
serde_json::to_vec_pretty(&meta).context("cannot serialize metadata")?,
crate::json::to_vec_pretty_sorted(&meta).context("cannot serialize metadata")?,
)
}
}
@ -149,7 +149,7 @@ pub fn syncback_csv_init<'sync>(
if !meta.is_empty() {
dir_syncback.fs_snapshot.add_file(
snapshot.path.join("init.meta.json"),
serde_json::to_vec_pretty(&meta)
crate::json::to_vec_pretty_sorted(&meta)
.context("could not serialize new init.meta.json")?,
);
}

View file

@ -106,7 +106,7 @@ pub fn syncback_dir<'sync>(
if !meta.is_empty() {
dir_syncback.fs_snapshot.add_file(
snapshot.path.join("init.meta.json"),
serde_json::to_vec_pretty(&meta)
crate::json::to_vec_pretty_sorted(&meta)
.context("could not serialize new init.meta.json")?,
);
}

View file

@ -86,7 +86,8 @@ pub fn syncback_json_model<'sync>(
Ok(SyncbackReturn {
fs_snapshot: FsSnapshot::new().with_added_file(
&snapshot.path,
serde_json::to_vec_pretty(&model).context("failed to serialize new JSON Model")?,
crate::json::to_vec_pretty_sorted(&model)
.context("failed to serialize new JSON Model")?,
),
children: Vec::new(),
removed_children: Vec::new(),

View file

@ -160,7 +160,7 @@ pub fn syncback_lua<'sync>(
let parent_location = snapshot.path.parent_err()?;
fs_snapshot.add_file(
parent_location.join(format!("{}.meta.json", new_inst.name)),
serde_json::to_vec_pretty(&meta).context("cannot serialize metadata")?,
crate::json::to_vec_pretty_sorted(&meta).context("cannot serialize metadata")?,
);
}
}
@ -203,7 +203,7 @@ pub fn syncback_lua_init<'sync>(
if !meta.is_empty() {
dir_syncback.fs_snapshot.add_file(
snapshot.path.join("init.meta.json"),
serde_json::to_vec_pretty(&meta)
crate::json::to_vec_pretty_sorted(&meta)
.context("could not serialize new init.meta.json")?,
);
}

View file

@ -509,7 +509,7 @@ pub fn syncback_project<'sync>(
for (node_properties, node_attributes, old_inst) in node_changed_map {
if project_node_should_reserialize(node_properties, node_attributes, old_inst)? {
fs_snapshot.add_file(project_path, serde_json::to_vec_pretty(&project)?);
fs_snapshot.add_file(project_path, crate::json::to_vec_pretty_sorted(&project)?);
break;
}
}

View file

@ -60,7 +60,7 @@ pub fn syncback_txt<'sync>(
let parent = snapshot.path.parent_err()?;
fs_snapshot.add_file(
parent.join(format!("{}.meta.json", new_inst.name)),
serde_json::to_vec_pretty(&meta).context("could not serialize metadata")?,
crate::json::to_vec_pretty_sorted(&meta).context("could not serialize metadata")?,
);
}
}