use std::{fs::File, io::Write}; use crete::{cluster::Cluster, node::OptionalNode}; use repo_path_lib::repo_dir; use schemars::{JsonSchema, schema_for}; fn write(name: &str) where T: JsonSchema, { let mut path = repo_dir().join("schemas").join(name); path.add_extension("json"); let mut file = File::create(path).unwrap(); let schema = serde_json::to_string_pretty(&schema_for!(T)).unwrap(); file.write_all(schema.as_bytes()).unwrap(); } // TODO: Create directory if it does not exist fn main() { write::("cluster"); write::("node"); }