Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/deno_class_validator/src/index.ts>Validator

Decorator-based property validation for classes.
Latest
class Validator
Re-export
import { Validator } from "https://deno.land/x/deno_class_validator@v1.0.0/src/index.ts";

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

Methods

private
coreValidate(
objectOrSchemaName: object | string,
objectOrValidationOptions: object | ValidationOptions,
maybeValidatorOptions?: ValidatorOptions,
): Promise<ValidationError[]>

Performs validation of the given object based on decorators or validation schema. Common method for validateOrReject and validate 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.