MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / report_json

Function report_json

atomic-cli/src/commands/memory/validate.rs:108–122  ·  view source on GitHub ↗

Serialize a [`ValidationReport`] to the documented JSON shape: `{conforms, results: [{focus_node, shape, path, message}]}`.

(report: &ValidationReport)

Source from the content-addressed store, hash-verified

106/// Serialize a [`ValidationReport`] to the documented JSON shape:
107/// `{conforms, results: [{focus_node, shape, path, message}]}`.
108fn report_json(report: &ValidationReport) -> serde_json::Value {
109 serde_json::json!({
110 "conforms": report.conforms,
111 "results": report
112 .results
113 .iter()
114 .map(|v| serde_json::json!({
115 "focus_node": v.focus_node,
116 "shape": v.shape,
117 "path": v.path,
118 "message": v.message,
119 }))
120 .collect::<Vec<_>>(),
121 })
122}
123
124#[cfg(test)]
125mod tests {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected