diff --git a/cove_rdls/lib/utils.py b/cove_rdls/lib/utils.py index 0eaed00..ef0dbd4 100644 --- a/cove_rdls/lib/utils.py +++ b/cove_rdls/lib/utils.py @@ -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":