Skip to content

Commit

Permalink
add note about using try_validator instead of validator
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Tate <[email protected]>
  • Loading branch information
Ryanmtate committed Oct 7, 2024
1 parent 24395df commit 344055c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/presentation_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ impl PresentationDefinition {
// skip optional fields
.filter(|field| field.is_required())
.map(|field| {
// NOTE: using `try_validator` here instead of `validator` to
// ensure there is a valid validator for the field, and not
// an empty option that has not been checked.
//
// There could be an optimistic check on validator, to check
// if it has indeed been initialized, but this might be better
// solved in a subsequent PR where the validation is always
// constructed on deserialization or construction.
match field.try_validator() {
Some(Ok(validator)) => {
let is_valid = field
Expand Down

0 comments on commit 344055c

Please sign in to comment.