MCPcopy Create free account
hub / github.com/eventuallyconsultant/codegenr / fetch_reference_value

Function fetch_reference_value

codegenr/src/resolver.rs:170–188  ·  view source on GitHub ↗
(json: &Value, path: &Option<String>)

Source from the content-addressed store, hash-verified

168 let mut part = json;
169 for p in parts.filter(|p| !p.trim().is_empty()) {
170 if let Value::Object(o) = part {
171 let key = p.to_string();
172 part = o.get(p).ok_or_else(|| ResolverError::KeyNotFound { key, part: part.clone() })?;
173 } else {
174 let key = p.to_string();
175 return Err(ResolverError::NotAnObject(key));
176 }
177 }
178 Ok(part.clone())
179 }
180 None => Ok(json.clone()),
181 }
182}
183
184#[derive(Debug)]
185pub struct RefInfo {
186 /// Path of the reference to import in the destination file
187 pub path: Option<String>,
188 /// True if the reference is nested in the same document
189 pub is_nested: bool,
190 /// File path of the document containing the reference
191 pub document_path: DocumentPath,

Callers 2

resolve_refs_recurseFunction · 0.85
resolve_reference_testFunction · 0.85

Calls

no outgoing calls

Tested by 1

resolve_reference_testFunction · 0.68