From 335c843f6a817221820e5ae3a42e06f2cc5cbae3 Mon Sep 17 00:00:00 2001 From: Ryan Tate Date: Mon, 16 Dec 2024 10:15:12 -0800 Subject: [PATCH] test the constraint against each array element Signed-off-by: Ryan Tate --- src/core/presentation_definition.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/core/presentation_definition.rs b/src/core/presentation_definition.rs index 4eb18ef..2b9402b 100644 --- a/src/core/presentation_definition.rs +++ b/src/core/presentation_definition.rs @@ -228,15 +228,12 @@ impl PresentationDefinition { .iter() .flat_map(|path| path.query(credential)) .any(|value| { - match value { - // If the value is an array, test the constraint against each array element. - serde_json::Value::Array(vals) => { - if vals.iter().any(|val| validator.validate(val).is_ok()) { - return true; - } - }, - _ => (), + if let serde_json::Value::Array(vals) = value { + if vals.iter().any(|val| validator.validate(val).is_ok()) { + return true; + } } + validator.validate(value).is_ok() }), // Allow for fields without validators to pass through.