(path: &str, entry: &VaultEntry, revision_hash: &str)
| 97 | } |
| 98 | |
| 99 | fn entry_json(path: &str, entry: &VaultEntry, revision_hash: &str) -> serde_json::Value { |
| 100 | serde_json::json!({ |
| 101 | "schema_version": 1, |
| 102 | "mode": "vault_entry_body", |
| 103 | "content_authority": "untrusted_historical_data", |
| 104 | "path": path, |
| 105 | "entry_type": entry.entry_type.to_string(), |
| 106 | "revision_hash": revision_hash, |
| 107 | "content": String::from_utf8_lossy(&entry.content_bytes), |
| 108 | "frontmatter": serde_json::from_str::<serde_json::Value>( |
| 109 | &entry.frontmatter_json |
| 110 | ).unwrap_or_default(), |
| 111 | "created_at": entry.created_at, |
| 112 | "updated_at": entry.updated_at, |
| 113 | }) |
| 114 | } |
| 115 | |
| 116 | #[cfg(test)] |
| 117 | mod tests { |
no outgoing calls