1use thiserror::Error;
2
3pub mod icons;
4pub mod plugin;
5pub mod system;
6pub mod validation;
7
8#[derive(Debug, Error)]
10pub enum ManifestError {
11 #[error(transparent)]
12 Json(#[from] serde_json::Error),
13 #[error(transparent)]
14 Validation(#[from] garde::Report),
15}
16
17#[test]
18fn generate_schema() {
19 use schemars::generate::SchemaSettings;
20 use std::path::Path;
21
22 let schemas_path = Path::new("schemas");
23 std::fs::create_dir_all(schemas_path).unwrap();
24
25 let schema_path = schemas_path.join("icons.json");
26 let generator = SchemaSettings::draft07().into_generator();
27 let schema = generator.into_root_schema_for::<icons::IconsManifest>();
28 std::fs::write(schema_path, serde_json::to_string_pretty(&schema).unwrap()).unwrap();
29
30 let schema_path = schemas_path.join("plugins.json");
31 let generator = SchemaSettings::draft07().into_generator();
32 let schema = generator.into_root_schema_for::<plugin::PluginManifest>();
33 std::fs::write(schema_path, serde_json::to_string_pretty(&schema).unwrap()).unwrap();
34}