TaskValidator.Core.ValidationResult (TaskValidator v0.9.3)
View SourceRepresents the result of a validation operation.
This struct aggregates validation errors and warnings, providing a consistent interface for handling validation outcomes throughout the system.
Summary
Functions
Adds an error to the validation result.
Adds multiple errors to the validation result.
Adds a warning to the validation result.
Adds multiple warnings to the validation result.
Combines multiple validation results into a single result.
Gets the number of errors.
Gets errors for a specific task ID.
Creates a failed validation result.
Formats the validation result for display.
Groups errors by type for analysis.
Checks if a specific error type exists in the result.
Checks if the result has any issues (errors or warnings).
Gets the total number of issues (errors + warnings).
Creates a validation result with both errors and warnings.
Creates a successful validation result.
Gets the number of warnings.
Types
@type t() :: %TaskValidator.Core.ValidationResult{ errors: [TaskValidator.Core.ValidationError.t()], task_count: non_neg_integer(), valid?: boolean(), validated_at: DateTime.t(), warnings: [TaskValidator.Core.ValidationError.t()] }
Functions
@spec add_error(t(), TaskValidator.Core.ValidationError.t()) :: t()
Adds an error to the validation result.
@spec add_errors(t(), [TaskValidator.Core.ValidationError.t()]) :: t()
Adds multiple errors to the validation result.
@spec add_warning(t(), TaskValidator.Core.ValidationError.t()) :: t()
Adds a warning to the validation result.
@spec add_warnings(t(), [TaskValidator.Core.ValidationError.t()]) :: t()
Adds multiple warnings to the validation result.
Combines multiple validation results into a single result.
The combined result is valid only if all input results are valid. All errors and warnings are aggregated.
@spec error_count(t()) :: non_neg_integer()
Gets the number of errors.
@spec errors_for_task(t(), String.t()) :: [TaskValidator.Core.ValidationError.t()]
Gets errors for a specific task ID.
@spec failure( [TaskValidator.Core.ValidationError.t()] | TaskValidator.Core.ValidationError.t(), keyword() ) :: t()
Creates a failed validation result.
Formats the validation result for display.
@spec group_errors_by_type(t()) :: %{ required(TaskValidator.Core.ValidationError.error_type()) => [ TaskValidator.Core.ValidationError.t() ] }
Groups errors by type for analysis.
@spec has_error_type?(t(), TaskValidator.Core.ValidationError.error_type()) :: boolean()
Checks if a specific error type exists in the result.
Checks if the result has any issues (errors or warnings).
@spec issue_count(t()) :: non_neg_integer()
Gets the total number of issues (errors + warnings).
@spec new( [TaskValidator.Core.ValidationError.t()], [TaskValidator.Core.ValidationError.t()], keyword() ) :: t()
Creates a validation result with both errors and warnings.
Creates a successful validation result.
@spec warning_count(t()) :: non_neg_integer()
Gets the number of warnings.