Add schema_generator for generating JSON schemas (#23991)
This PR adds a `schema_generator` crate that can be used to generate our various JSON schemas for publishing elsewhere. Currently it does the simplest thing possible and just prints the JSON schema to stdout. We can make this a but more robust later. I also removed the schema-printing facilities from the `theme_importer`, as they don't really make sense there. Release Notes: - N/A
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use schemars::schema_for;
|
||||
use theme::{IconThemeFamilyContent, ThemeFamilyContent};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
struct Args {}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
env_logger::init();
|
||||
|
||||
let _args = Args::parse();
|
||||
|
||||
let theme_family_schema = schema_for!(ThemeFamilyContent);
|
||||
println!("Theme Schema:");
|
||||
println!("{}", serde_json::to_string_pretty(&theme_family_schema)?);
|
||||
|
||||
let icon_theme_family_schema = schema_for!(IconThemeFamilyContent);
|
||||
println!("Icon Theme Schema:");
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&icon_theme_family_schema)?
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user