Skip to content
ModularityKit.Mutator ModularityKit.Mutator Docs
  • Home
  • Core
  • Governance
  • Redis
  • API
Search Results for

    Show / Hide Table of Contents

    Class ValidationResult

    Encapsulates the result of a mutation validation, including errors, warnings, and informational messages.

    Inheritance
    object
    ValidationResult
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: ModularityKit.Mutator.Abstractions.Results
    Assembly: ModularityKit.Mutator.dll
    Syntax
    public sealed class ValidationResult
    Remarks

    A ValidationResult collects detailed validation feedback during mutation processing. It distinguishes between three severity levels:

    • Errors - critical issues that prevent mutation execution.
    • Warnings - non-blocking issues that may indicate potential problems.
    • Info - informational messages about validation context or suggestions.

    The IsValid property returns true only when no errors are present. Static factory methods (Success(), WithError(string, string, string?), WithErrors(params ValidationError[])) provide convenient creation patterns.

    Properties

    | Edit this page View Source

    Errors

    List of validation errors that prevent mutation execution.

    Declaration
    public IReadOnlyList<ValidationError> Errors { get; }
    Property Value
    Type Description
    IReadOnlyList<ValidationError>
    | Edit this page View Source

    Info

    List of informational validation messages.

    Declaration
    public IReadOnlyList<ValidationInfo> Info { get; }
    Property Value
    Type Description
    IReadOnlyList<ValidationInfo>
    | Edit this page View Source

    IsValid

    Indicates whether the validation passed (no errors).

    Declaration
    public bool IsValid { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Warnings

    List of validation warnings (non-blocking issues).

    Declaration
    public IReadOnlyList<ValidationWarning> Warnings { get; }
    Property Value
    Type Description
    IReadOnlyList<ValidationWarning>

    Methods

    | Edit this page View Source

    AddError(ValidationError)

    Adds a ValidationError instance directly.

    Declaration
    public void AddError(ValidationError error)
    Parameters
    Type Name Description
    ValidationError error

    The validation error to add.

    | Edit this page View Source

    AddError(string, string, string?)

    Adds validation error with the specified path, message, and optional code.

    Declaration
    public void AddError(string path, string message, string? code = null)
    Parameters
    Type Name Description
    string path

    Path to the invalid property or field.

    string message

    Description of the validation error.

    string code

    Optional error code for categorization or localization.

    | Edit this page View Source

    AddInfo(ValidationInfo)

    Adds a ValidationInfo instance directly.

    Declaration
    public void AddInfo(ValidationInfo info)
    Parameters
    Type Name Description
    ValidationInfo info

    The informational message to add.

    | Edit this page View Source

    AddInfo(string, string)

    Adds an informational validation message.

    Declaration
    public void AddInfo(string path, string message)
    Parameters
    Type Name Description
    string path

    Path to the property or concept for this informational message.

    string message

    The informational message.

    | Edit this page View Source

    AddWarning(ValidationWarning)

    Adds a ValidationWarning instance directly.

    Declaration
    public void AddWarning(ValidationWarning warning)
    Parameters
    Type Name Description
    ValidationWarning warning

    The validation warning to add.

    | Edit this page View Source

    AddWarning(string, string, string?)

    Adds validation warning with the specified path, message, and optional code.

    Declaration
    public void AddWarning(string path, string message, string? code = null)
    Parameters
    Type Name Description
    string path

    Path to the property or field causing the warning.

    string message

    Description of the warning.

    string code

    Optional code for categorization or localization.

    | Edit this page View Source

    Success()

    Returns a successful (empty) validation result.

    Declaration
    public static ValidationResult Success()
    Returns
    Type Description
    ValidationResult

    A ValidationResult with no errors, warnings, or info.

    | Edit this page View Source

    WithError(string, string, string?)

    Creates a validation result with a single error.

    Declaration
    public static ValidationResult WithError(string path, string message, string? code = null)
    Parameters
    Type Name Description
    string path

    Path to the invalid property or field.

    string message

    Description of the error.

    string code

    Optional error code for categorization or localization.

    Returns
    Type Description
    ValidationResult

    A ValidationResult with the specified error.

    | Edit this page View Source

    WithErrors(params ValidationError[])

    Creates a validation result with multiple errors.

    Declaration
    public static ValidationResult WithErrors(params ValidationError[] errors)
    Parameters
    Type Name Description
    ValidationError[] errors

    The validation errors to include.

    Returns
    Type Description
    ValidationResult

    A ValidationResult with the specified errors.

    • Edit this page
    • View Source
    In this article
    ModularityKit.Mutator Generated from XML docs and published from main. Back to top