Options
All
  • Public
  • Public/Protected
  • All
Menu

Class InsertModelValidator

Specialized validator that's used to validate objects against a class's validation schema and column metadata prior to creation. For example, when inserting a record non-nullable fields must be defined and non-null, and generated fields, like auto-incrementing primary keys, must not be defined. This differs from mutation (updating and deleting).

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Protected objectValidator

objectValidator: ObjectValidator

Methods

getValidationMetadata

  • getValidationMetadata(Entity: object): ValidationMetadata[]

validate

  • validate(obj: object, Entity: object): Promise<void>
  • Verify that each property of obj meets the requirements defined by Column and Relationship decoration, such as data type, maximum length, and nullability. If valid, then check any user-defined validation, such as email and phone number validation. (Reference the bsy-validation package, as the ObjectValidator class is used for validation.)

    Parameters

    • obj: object

      The object to validate against class Entity.

    • Entity: object

      A class that has properties decorated with @Validate. This is the schema against which obj will be validated.

    Returns Promise<void>

Generated using TypeDoc