pub fn write_schema(path: &Path) -> Result<()>Expand description
Writes the JSON Schema to path as pretty-printed JSON.
§Errors
Returns an io::Error if the file cannot be created or written.
§Panics
Cannot panic in practice: generate_schema() builds a hand-authored
serde_json::Value tree containing only strings, booleans, arrays
and objects — no f32/f64 NaNs — which to_string_pretty cannot
fail to serialize. The expect exists only to satisfy the type
system without forcing callers to handle an unreachable Err.
§Examples
use ssg::schema::write_schema;
use tempfile::tempdir;
let dir = tempdir().unwrap();
let p = dir.path().join("schema.json");
write_schema(&p).unwrap();
assert!(p.is_file());