Skip to main content
Module

x/leaves/mod.ts>validator.Validator

A Web framework For Deno with Decorator and middleware
Latest
class validator.Validator
import { validator } from "https://deno.land/x/leaves@v0.1.5/mod.ts";
const { Validator } = validator;

Validator performs validation of the given object based on its metadata.

Properties

private
coreValidate

Performs validation of the given object based on decorators or validation schema. Common method for validateOrReject and validate methods.

Methods

validate(object: Object, options?: ValidatorOptions): Promise<ValidationError[]>

Performs validation of the given object based on decorators used in given object class.

validate(
schemaName: string,
object: Object,
options?: ValidatorOptions,
): Promise<ValidationError[]>

Performs validation of the given object based on validation schema.

validateOrReject(object: Object, options?: ValidatorOptions): Promise<void>

Performs validation of the given object based on decorators used in given object class and reject on error.

validateOrReject(
schemaName: string,
object: Object,
options?: ValidatorOptions,
): Promise<void>

Performs validation of the given object based on validation schema and reject on error.

validateSync(object: Object, options?: ValidatorOptions): ValidationError[]

Performs validation of the given object based on decorators used in given object class. NOTE: This method completely ignores all async validations.

validateSync(
schemaName: string,
object: Object,
options?: ValidatorOptions,
): ValidationError[]

Performs validation of the given object based on validation schema.