Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UpdateModelValidator

This class validates an object against a class's validation metadata prior to updating by verifying that the primary key is present, and then running the object through a ModelValidator instance. Reference ModelValidator and the bsy-validation package.

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