Skip to content

Commit

Permalink
🔊 More Validation infos (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
lord-haffi authored May 23, 2023
1 parent e1a6740 commit 26af4e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/bomf/validation/core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def __init__(
self.mapped_validator = mapped_validator
self.validator_set = validation_manager
self.error_id = error_id
self.message_detail = message_detail
self.provided_params = provided_params


# pylint: disable=too-few-public-methods
Expand Down
13 changes: 11 additions & 2 deletions src/bomf/validation/core/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ async def _execute_validators(
self.info.tasks[mapped_validator] = self.info.current_task
await self._execute_sync_validator(mapped_validator)

async def validate(self, *data_sets: DataSetT) -> ValidationResult[DataSetT]:
async def validate(self, *data_sets: DataSetT, log_summary: bool = False) -> ValidationResult[DataSetT]:
"""
Validates each of the provided data set instances onto the registered validators.
Any errors occurring during validation will be collected the validation process will not be cancelled.
Expand Down Expand Up @@ -355,4 +355,13 @@ async def validate(self, *data_sets: DataSetT) -> ValidationResult[DataSetT]:
else:
await self._execute_validators(validator_execution_order)

return ValidationResult(self, error_handlers)
validation_result = ValidationResult(self, error_handlers)
if log_summary:
validation_logger.info(
"Validation Summary: %i succeeded, %i failed, %i errors. %s",
validation_result.num_succeeds,
validation_result.num_fails,
validation_result.num_errors_total,
str(validation_result.num_errors_per_id),
)
return validation_result

0 comments on commit 26af4e4

Please sign in to comment.