Interface IValidationContainerContext<TValue, TRawValue>

Represents the context for validation execution within the container.

interface IValidationContainerContext<TValue, TRawValue = TValue> {
    cancellationToken: null | CancellationToken;
    handled: boolean;
    rawValue: TRawValue;
    validationResult: IValidationResultBuilder;
    validationResultInfo:
        | null
        | Partial<
            Pick<
                IValidationResultItem,
                "key"
                | "objectType"
                | "fieldName"
                | "objectName",
            >,
        >;
    value: TValue;
    addError(value: Omit<ValidationContainerResultItem, "type">): void;
    addInfo(value: Omit<ValidationContainerResultItem, "type">): void;
    addResult(value: ValidationResult | ValidationContainerResultItem): void;
    addWarning(value: Omit<ValidationContainerResultItem, "type">): void;
}

Type Parameters

  • TValue

    Type of the resulting value for validation.

  • TRawValue = TValue

    Type of the raw value for validation. Defaults to TValue.

Properties

cancellationToken: null | CancellationToken

An object through which an asynchronous operation can be canceled.

handled: boolean

Indicates whether the validation result has been processed.

rawValue: TRawValue

The raw value for validation.

validationResult: IValidationResultBuilder

Builder for creating validation results.

validationResultInfo:
    | null
    | Partial<
        Pick<
            IValidationResultItem,
            "key"
            | "objectType"
            | "fieldName"
            | "objectName",
        >,
    >

Additional information about validation of the object.

value: TValue

The value to be validated.

Methods

  • Adds a validation result value to the validationResult in the context with ValidationResultType.Error type.

    Parameters

    Returns void

    • The added value will be modified by incorporating additional information from the validationResultInfo object, if such information is provided.
    • The handled property will automatically be set to true.
  • Adds a validation result value to the validationResult in the context with ValidationResultType.Warning type.

    Parameters

    Returns void

    The added value will be modified by incorporating additional information from the validationResultInfo object, if such information is provided.

MMNEPVFCICPMFPCPTTAAATR