A class responsible for recording information about a validation failure.

Constructors

  • Parameters

    • Optionaloptions: {
          dropped?: boolean;
          fallback?: any;
          invalidValue?: any;
          message?: string;
          unresolved?: boolean;
      } = {}
      • Optionaldropped?: boolean

        Whether the value was dropped from some parent collection.

      • Optionalfallback?: any

        The value it was replaced by, if any.

      • OptionalinvalidValue?: any

        The value that failed validation for this field.

      • Optionalmessage?: string

        The validation error message.

      • Optionalunresolved?: boolean

        Whether this failure was unresolved

    Returns DataModelValidationFailure

Properties

dropped: boolean

Whether the value was dropped from some parent collection.

elements: ElementValidationFailure[] = []

If this field contains a list of elements that are validated as part of its validation, their results are recorded here.

fallback: any

The value it was replaced by, if any.

fields: Record<string, DataModelValidationFailure> = {}

If this field contains other fields that are validated as part of its validation, their results are recorded here.

invalidValue: any

The value that failed validation for this field.

message: string

The validation error message.

unresolved: boolean

Record whether a validation failure is unresolved. This reports as true if validation for this field or any hierarchically contained field is unresolved. A failure is unresolved if the value was invalid and there was no valid fallback value available.

Methods

  • Whether this failure contains other sub-failures.

    Returns boolean

  • Return the base properties of this failure, omitting any nested failures.

    Returns { dropped: boolean; fallback: any; invalidValue: any; message: string }

  • Represent the DataModelValidationFailure as a string.

    Returns string