A class responsible for recording information about a validation failure.

Constructors

Properties

invalidValue: any

The value that failed validation for this field.

fallback: any

The value it was replaced by, if any.

dropped: boolean

Whether the value was dropped from some parent collection.

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.

fields: Record<string, DataModelValidationFailure> = {}

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

elements: ElementValidationFailure[] = []

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

Methods

  • Whether this failure contains other sub-failures.

    Returns boolean

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

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

    • invalidValue: any
    • fallback: any
    • dropped: boolean
    • message: string
  • Represent the DataModelValidationFailure as a string.

    Returns string

  • Format a DataModelValidationFailure instance as a string message.

    Parameters

    Returns string

    The formatted failure string