MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / load_class_schema

Function load_class_schema

crates/openshell-ocsf/src/validation/schema.rs:15–23  ·  view source on GitHub ↗
(class: &str)

Source from the content-addressed store, hash-verified

13/// Panics if the schema file is missing or contains invalid JSON.
14#[must_use]
15pub fn load_class_schema(class: &str) -> Value {
16 let path = format!(
17 "{}/schemas/ocsf/v1.7.0/classes/{class}.json",
18 env!("CARGO_MANIFEST_DIR")
19 );
20 let data =
21 fs::read_to_string(&path).unwrap_or_else(|_| panic!("Missing vendored schema: {path}"));
22 serde_json::from_str(&data).unwrap_or_else(|e| panic!("Invalid JSON in {path}: {e}"))
23}
24
25/// Load a vendored OCSF object schema by name.
26///

Calls

no outgoing calls