Class ObjectType<TValue, TRequired>

Object/JSONB type definition.

Type Parameters

  • TValue = unknown

    The type of values in the record (default: unknown)

  • TRequired extends boolean = false

    Whether the field is required

Hierarchy (View Summary)

Constructors

Properties

_required: boolean
defaultValue?:
    | TypeOutput<Record<string, TValue>, TRequired>
    | () => TypeOutput<Record<string, TValue>, TRequired>
hasDefault: boolean
isSensitive: boolean
isVirtual: boolean
options: Record<string, unknown>
validators: ValidatorFunction<Record<string, TValue>>[]

Methods

  • Flag the field as sensitive so joins/exposures can omit it by default.

    Parameters

    • isSensitive: boolean = true

    Returns this

  • Validate the supplied value and return the normalized result.

    Parameters

    • value: unknown
    • fieldName: string = 'field'

    Returns TypeOutput<Record<string, TValue>, TRequired>