feat: Initial rewrite of python render tool
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "xtask"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
repo_path = "1.2.4"
|
||||
schemars = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
crete = { path = ".." }
|
||||
@@ -0,0 +1,24 @@
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
|
||||
use crete::cluster::OptionalCluster;
|
||||
use crete::node::OptionalNode;
|
||||
use repo_path::repo_path;
|
||||
use schemars::{JsonSchema, schema_for};
|
||||
|
||||
fn write<T>(name: &str)
|
||||
where
|
||||
T: JsonSchema,
|
||||
{
|
||||
let mut path = repo_path!("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();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
write::<OptionalCluster>("cluster");
|
||||
write::<OptionalNode>("node");
|
||||
}
|
||||
Reference in New Issue
Block a user