From 09b26cf8a9111c8bf5e694379c1bcf7408fd7f5d Mon Sep 17 00:00:00 2001 From: John Kastner Date: Wed, 20 Nov 2024 15:38:53 +0000 Subject: [PATCH] Handle `None` in schema equiv for attribtues and member-of Signed-off-by: John Kastner --- cedar-drt/fuzz/src/schemas.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cedar-drt/fuzz/src/schemas.rs b/cedar-drt/fuzz/src/schemas.rs index 33fa3f753..2077564fe 100644 --- a/cedar-drt/fuzz/src/schemas.rs +++ b/cedar-drt/fuzz/src/schemas.rs @@ -428,9 +428,15 @@ impl TypeName for InternalName { impl Equiv for json_schema::ActionType { fn equiv(lhs: &Self, rhs: &Self) -> Result<(), String> { - if &lhs.attributes != &rhs.attributes { + if &lhs.attributes != &rhs.attributes + && !(lhs.attributes.as_ref().is_none_or(HashMap::is_empty) + && rhs.attributes.as_ref().is_none_or(HashMap::is_empty)) + { Err(format!("Attributes don't match")) - } else if &lhs.member_of != &rhs.member_of { + } else if &lhs.member_of != &rhs.member_of + && !(lhs.member_of.as_ref().is_none_or(Vec::is_empty) + && rhs.member_of.as_ref().is_none_or(Vec::is_empty)) + { Err(format!("Member-of doesn't match")) } else { match (&lhs.applies_to, &rhs.applies_to) {