ValidateResult

Description

struct Tinman.Core.Validating.ValidateResult

Holds the results of the validation of an object graph.

See also

Validator

Public / Constants

Success


public static readonly attribute Success → (ValidateResult)

A ValidateResult object that represents success, i.e. no errors or warnings.

Public / Methods

Add


[Pure]
public method Add → (1)

other in : ValidateResult

The validation result to add.

returns → ValidateResult

The combined validation result.

Adds the given validation result to this one.

Log


public method Log → (3)

logger in : ILogger

[not-null]
The logger to use for outputting the validation messages.

errors opt : bool = true

Output ValidateMessageType.Error messages?

warnings opt : bool = true

Output ValidateMessageType.Warning messages?

Logs all validation messages to the given logger in.

Throw


[Pure]
public method Throw → (2)

source in : string

Error source tag.

message opt : string = null

Optional error message.

returns → ValidatingException

The ready-to-throw exception.

Returns a ValidatingException exception for this validation result, assuming it has failed.

To​String


public override method ToString → ()

returns → string

The string representation.

Returns the string representation of this value.

Messages are output in two blocks, first all warnings (see Warnings), then all errors (see Errors). Each message is output using IValidateMessage.ToString, where the previous warning or error of the respective block is passed in.

Public / Attributes

Errors


public readonly attribute Errors → (IValidateMessage [ ])

The validation errors.

This array will either be non-empty (validation has failed) or null (validation has succeeded).

Has​Errors


public attribute HasErrors → (get)

value : bool

true if the validation has failed, false if not.

Has the validation failed (i.e. one or more errors have occurred)?

Has​Messages


public attribute HasMessages → (get)

value : bool

true if there is at least one error or warning, false if not.

Have there been any messages (errors / warnings) during validation?

Has​Warnings


public attribute HasWarnings → (get)

value : bool

true if there were one or more warning messages, false if not.

Have there been any warnings during validation?

Messages


public readonly attribute Messages → (IValidateMessage [ ])

The validation messages (errors and warnings) or null.

This array will either be non-empty (one or more errors or warnings are present) or null (there are no errors and no warnings).

Warnings


public readonly attribute Warnings → (IValidateMessage [ ])

The validation warnings or null.

This array will either be non-empty (one or more warnings are present) or null (there are no warnings).