Skip to content

ObjectValidator

github-actions[bot] edited this page Nov 17, 2024 · 2 revisions
API / ObjectValidator<TValidatable, TValidationError> class

Represents a base implementation for an object validator.

Implements IObjectValidator<TValidatable, TValidationError>.

class ObjectValidator<TValidatable extends IValidatable<TValidationError> | INotifyPropertiesChanged, TValidationError = string>
    implements IObjectValidator<TValidatable, TValidationError>

Source reference: src/validation/objectValidator/ObjectValidator.ts:26.

Generic Parameters

  • TValidatable - The instance type that is being validated.

    Type constraints: IValidatable<TValidationError> & INotifyPropertiesChanged.

  • TValidationError - The concrete type for representing validation errors (strings, enums, numbers etc.).

    Default value: string.

Constructors

Properties

  • readonly target - Gets the object that is being validated.
  • readonly triggers - Gets the validation triggers that have been configured.
  • readonly validators - Gets the validators that have been configured.

Methods

  • add - Configures the given validators and validates the target afterwards.
  • reset - Resets the validator configuraiton, removes all triggers and validators and sets the error on the target to null.
  • validate - Validates the target using the currently configured validators. Validation does get triggered when the

Inheritance Hierarchy

  • ObjectValidator<TValidatable, TValidationError>
Clone this wiki locally