Skip to content

Commit

Permalink
Merge pull request #564 from mapping-commons/update-validator29112024
Browse files Browse the repository at this point in the history
Add more logging to validator and change some comments/msges
  • Loading branch information
matentzn authored Dec 2, 2024
2 parents 5b18459 + 4b0a1fe commit e625411
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/sssom/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ def print_linkml_report(report: ValidationReport, fail_on_error: bool = True):
else:
for result in report.results:
validation_errors += 1
if result.severity == Severity.ERROR:
if (result.severity == Severity.FATAL) or (result.severity == Severity.ERROR):
logging.error(result.message)
elif result.severity == Severity.WARN:
logging.error(result.message)
elif result.severity == Severity.INFO:
logging.info(result.message)

if fail_on_error and validation_errors:
raise ValidationError(f"You mapping set has {validation_errors} validation errors!")
Expand Down Expand Up @@ -101,7 +105,6 @@ def validate_json_schema(msdf: MappingSetDataFrame, fail_on_error: bool = True)
mapping_set_dict = json_dumper.to_dict(mapping_set)

report = validator.validate(mapping_set_dict, "mapping set")
# TODO fail_on_error: False because of https://github.com/linkml/linkml/issues/2164
print_linkml_report(report, fail_on_error)


Expand Down Expand Up @@ -146,11 +149,10 @@ def check_all_prefixes_in_curie_map(msdf: MappingSetDataFrame, fail_on_error: bo
severity=Severity.ERROR,
instance=None,
instantiates=None,
message=f"Missing {prefix}",
message=f"Missing prefix: {prefix}",
)
)
report = ValidationReport(results=validation_results)
# TODO fail_on_error: False because of https://github.com/linkml/linkml/issues/2164
print_linkml_report(report, fail_on_error)


Expand Down

0 comments on commit e625411

Please sign in to comment.