modkit/gts/schemas.rs
1use crate::gts::BaseModkitPluginV1;
2use tracing::info;
3
4/// Returns the core GTS schemas provided by the modkit framework.
5///
6/// These are base types that other modules' plugin systems depend on
7///
8/// This function is called by `types_registry` during initialization to register
9/// these core types before any dependent modules can register their derived schemas.
10///
11/// NOTE: This is temporary logic until <https://github.com/hypernetix/hyperspot/issues/156> is resolved
12///
13/// # Errors
14///
15/// Returns an error if the schema JSON cannot be parsed.
16pub fn get_core_gts_schemas() -> anyhow::Result<Vec<serde_json::Value>> {
17 info!("Generating core GTS schemas");
18
19 let mut schemas = Vec::new();
20
21 // BaseModkitPluginV1 schema (gts.x.core.modkit.plugin.v1~)
22 // This is the base type for all plugin schemas in the modkit framework.
23 let schema_str = BaseModkitPluginV1::<()>::gts_schema_with_refs_as_string();
24 let schema_json: serde_json::Value = serde_json::from_str(&schema_str)?;
25 schemas.push(schema_json);
26
27 info!("Core GTS schemas generated: gts.x.core.modkit.plugin.v1~");
28 Ok(schemas)
29}