2021-02-11 09:22:42 +03:00
|
|
|
use std::{
|
|
|
|
env::current_dir,
|
|
|
|
error::Error,
|
2021-03-23 06:03:07 +03:00
|
|
|
fs::File,
|
2021-02-11 09:22:42 +03:00
|
|
|
io::{BufWriter, Write},
|
|
|
|
};
|
2021-01-30 18:15:47 +03:00
|
|
|
|
2021-02-20 17:36:17 +03:00
|
|
|
mod config_definition;
|
|
|
|
|
2021-01-30 18:15:47 +03:00
|
|
|
pub fn main() -> Result<(), Box<dyn Error>> {
|
2021-02-20 17:36:17 +03:00
|
|
|
let schema = schemars::schema_for!(config_definition::Config);
|
|
|
|
let schema_file_path = current_dir()?.join("schema.json");
|
|
|
|
let mut schema_file = BufWriter::new(File::create(&schema_file_path)?);
|
|
|
|
write!(
|
|
|
|
schema_file,
|
|
|
|
"{}",
|
|
|
|
serde_json::to_string_pretty(&schema).unwrap()
|
|
|
|
)?;
|
|
|
|
|
2021-01-30 18:15:47 +03:00
|
|
|
Ok(())
|
|
|
|
}
|