Skip to content

Commit

Permalink
Update src/core/presentation_definition.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Jacob <[email protected]>
  • Loading branch information
Ryanmtate and cobward authored Dec 16, 2024
1 parent f48a5c8 commit 8797db8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/core/presentation_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,17 @@ impl PresentationDefinition {
.path
.iter()
.flat_map(|path| path.query(credential))
.any(|value| match value {
serde_json::Value::Array(vals) => {
vals.iter().any(|val| validator.validate(val).is_ok())
.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;
}
},
_ => (),
}
_ => validator.validate(value).is_ok(),
validator.validate(value).is_ok()
}),
// Allow for fields without validators to pass through.
_ => true,
Expand Down

0 comments on commit 8797db8

Please sign in to comment.