From 88a6048dc20a93f738de5a1db3f9abd99079360f Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 13 May 2024 16:32:23 +0200 Subject: [PATCH] fix(apb): id returns id of front for array node --- apb/src/node.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apb/src/node.rs b/apb/src/node.rs index 1380ea6..fd5f47c 100644 --- a/apb/src/node.rs +++ b/apb/src/node.rs @@ -92,9 +92,10 @@ impl Node { /// returns id of object: url for link, id for object, None if empty or array pub fn id(&self) -> Option { match self { - Node::Empty | Node::Array(_) => None, + Node::Empty => None, Node::Link(uri) => Some(uri.href().to_string()), - Node::Object(obj) => obj.id().map(|x| x.to_string()), + Node::Object(obj) => Some(obj.id()?.to_string()), + Node::Array(arr) => Some(arr.front()?.id()?.to_string()), } } }