Class Validator<TValid>Abstract

The base class of all the validators in this package. TValid is the type of any value that passes validation.

Type Parameters

  • TValid

Hierarchy

  • Validator

Constructors

  • Type Parameters

    • TValid

    Returns Validator<TValid>

Properties

cachedJsonSchema: undefined | JSONSchema7

Methods

  • Return the JSON schema for the given validator

    Returns JSONSchema7

  • Validate the given value and throw if it's not valid

    Parameters

    • value: unknown

      that is TValid

    • Optional path: readonly (string | number)[]

      The path at which the value being checked was found

    Returns TValid

  • Return true if the value is valid. #isValid is unique in that validation errors are not surfaced, so the validator may optimize for performance.

    Parameters

    • value: unknown

      value to check

    Returns value is TValid

  • Handles caching and removing undefined properties

    Returns JSONSchema7

  • Validate a given value with the assumed path, returning any errors

    Parameters

    • value: unknown

      value to validate

    • Optional path: readonly (string | number)[]

      current path of the validation

    Returns ValidationError[]

Generated using TypeDoc