Serialize a [`ValidationReport`] to the documented JSON shape: `{conforms, results: [{focus_node, shape, path, message}]}`.
(report: &ValidationReport)
| 106 | /// Serialize a [`ValidationReport`] to the documented JSON shape: |
| 107 | /// `{conforms, results: [{focus_node, shape, path, message}]}`. |
| 108 | fn 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)] |
| 125 | mod tests { |
nothing calls this directly
no outgoing calls
no test coverage detected