use jsonschema::paths::Location;
pub(crate) trait LocationExtensions: Sized {
fn parent(&self) -> Option<Self>;
}
impl LocationExtensions for Location {
fn parent(&self) -> Option<Self> {
let mut segments: Vec<_> = self.into_iter().collect();
if segments.is_empty() {
return None;
}
segments.pop();
Some(Self::from_iter(segments))
}
}