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

Function load_object_schema

crates/openshell-ocsf/src/validation/schema.rs:31–39  ·  view source on GitHub ↗
(object: &str)

Source from the content-addressed store, hash-verified

29/// Panics if the schema file is missing or contains invalid JSON.
30#[must_use]
31pub fn load_object_schema(object: &str) -> Value {
32 let path = format!(
33 "{}/schemas/ocsf/v1.7.0/objects/{object}.json",
34 env!("CARGO_MANIFEST_DIR")
35 );
36 let data =
37 fs::read_to_string(&path).unwrap_or_else(|_| panic!("Missing vendored schema: {path}"));
38 serde_json::from_str(&data).unwrap_or_else(|e| panic!("Invalid JSON in {path}: {e}"))
39}
40
41/// Validate that all required fields from the schema are present in the event JSON.
42///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected