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

Function load_api_registries_from_dir

crates/openshell-prover/src/credentials.rs:323–343  ·  view source on GitHub ↗
(registry_dir: &Path)

Source from the content-addressed store, hash-verified

321}
322
323fn load_api_registries_from_dir(registry_dir: &Path) -> Result<HashMap<String, ApiCapability>> {
324 let mut api_registries = HashMap::new();
325 let apis_dir = registry_dir.join("apis");
326 if apis_dir.is_dir() {
327 let entries = std::fs::read_dir(&apis_dir)
328 .into_diagnostic()
329 .wrap_err_with(|| format!("reading directory {}", apis_dir.display()))?;
330 for entry in entries {
331 let entry = entry.into_diagnostic()?;
332 let path = entry.path();
333 if path.extension().is_some_and(|ext| ext == "yaml") {
334 let contents = std::fs::read_to_string(&path)
335 .into_diagnostic()
336 .wrap_err_with(|| format!("reading {}", path.display()))?;
337 let api = parse_api_registry(&contents, &path.display().to_string())?;
338 api_registries.insert(api.api.clone(), api);
339 }
340 }
341 }
342 Ok(api_registries)
343}
344
345/// Load credentials with API registries from the embedded registry.
346pub fn load_credential_set_embedded(credentials_path: &Path) -> Result<CredentialSet> {

Callers 1

Calls 2

parse_api_registryFunction · 0.85
pathMethod · 0.80

Tested by

no test coverage detected