(json: &Value, path: &Option<String>)
| 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)] |
| 185 | pub 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, |
no outgoing calls