fix: serde(default) on ALL Row fields so missing transform outputs don't crash

Author: Aaron Steven White
Commit 2180e05b329bbf108c8a654ad52125c6fdc4c6b9
Parent: 7d3b4ad4af
Structural diff unavailable

These commits were pushed via plain git push, so no pre-parsed schemas are available. Install git-remote-cospan and re-push via panproto:// to see scope-level changes, breaking change detection, and semantic diffs.

brew install panproto/tap/git-remote-cospan
1 file changed +4 -6
@@ -207,13 +207,11 @@ pub fn emit_row_types(
207207     w.line(&format!("pub struct {} {{", config.row_struct_name));
208208     w.indent();
209209     for col in &cols {
210-        // Add #[serde(default)] for fields not in the Lexicon record
211-        // (did, rkey, indexed_at, counters) so serde_json::from_value works
212-        if col.name == "indexed_at" {
210+        // All fields get #[serde(default)] so serde_json::from_value tolerates
211+        // missing fields from panproto transforms that may not produce everything
212+        if col.rust_type == "DateTime<Utc>" {
213213             w.line("#[serde(default = \"default_now\")]");
214-        } else if col.rust_type.starts_with("DateTime") {
215-            // DateTime fields from Lexicon are already in the transformed JSON
216-        } else if col.is_counter || col.name == "did" || col.name == "rkey" || col.name == "id" {
214+        } else {
217215             w.line("#[serde(default)]");
218216         }
219217         w.line(&format!("pub {}: {},", col.name, col.rust_type));
cospan · schematic version control on atproto built on AT Protocol