Skip to content

Commit

Permalink
cove_rdls/lib/utils.py: Add filtering of "duplicate" errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed (ODSC) committed Sep 3, 2023
1 parent 45545e8 commit 061afde
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cove_rdls/lib/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
from collections import defaultdict


def filter_duplicates(validation_errors):
out = {}
for key in validation_errors:
for error in validation_errors[key]:
filtered = []
paths = []
if error['validator'] == 'minProperties':
if error['path'] not in paths:
paths.append(error['path'])
filtered.append(error)
else:
filtered.append(error)
out[key] = filtered
return out


def group_validation_errors(validation_errors):
validation_errors_grouped = defaultdict(dict)
validation_errors = filter_duplicates(validation_errors)
for key in validation_errors:
vtype = validation_errors[key][0]["validator"]
if vtype == "required":
Expand Down

0 comments on commit 061afde

Please sign in to comment.