(class: &str)
| 13 | /// Panics if the schema file is missing or contains invalid JSON. |
| 14 | #[must_use] |
| 15 | pub 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 | /// |
no outgoing calls