(path: &str, entry: &VaultEntry, revision_hash: &str)
| 105 | } |
| 106 | |
| 107 | pub(crate) fn entry_json(path: &str, entry: &VaultEntry, revision_hash: &str) -> serde_json::Value { |
| 108 | serde_json::json!({ |
| 109 | "schema_version": 1, |
| 110 | "mode": "vault_entry_body", |
| 111 | "content_authority": "untrusted_historical_data", |
| 112 | "path": path, |
| 113 | "entry_type": entry.entry_type.to_string(), |
| 114 | "revision_hash": revision_hash, |
| 115 | "content": String::from_utf8_lossy(&entry.content_bytes), |
| 116 | "frontmatter": serde_json::from_str::<serde_json::Value>( |
| 117 | &entry.frontmatter_json |
| 118 | ).unwrap_or_default(), |
| 119 | "created_at": entry.created_at, |
| 120 | "updated_at": entry.updated_at, |
| 121 | }) |
| 122 | } |
| 123 | |
| 124 | #[cfg(test)] |
| 125 | mod tests { |
no outgoing calls