Skip to main content

Decorators (common)

@Equals

import { Equals } from '@hexajs-dev/common';
@Equals(value: any)

@IsArray

import { IsArray } from '@hexajs-dev/common';
@IsArray()

@IsBoolean

import { IsBoolean } from '@hexajs-dev/common';
@IsBoolean()

@IsDateString

import { IsDateString } from '@hexajs-dev/common';
@IsDateString()

@IsDefined

Validation Decorators These are pure metadata decorators—they do NOT enforce validation at runtime. Actual validation is performed by AOT-generated validators at compile time.

import { IsDefined } from '@hexajs-dev/common';
@IsDefined()

@IsEmail

import { IsEmail } from '@hexajs-dev/common';
@IsEmail()

@IsEmpty

import { IsEmpty } from '@hexajs-dev/common';
@IsEmpty()

@IsEnum

import { IsEnum } from '@hexajs-dev/common';
@IsEnum(enumClass: any)

@IsIn

import { IsIn } from '@hexajs-dev/common';
@IsIn(values: any[])

@IsInt

import { IsInt } from '@hexajs-dev/common';
@IsInt()

@IsJSON

import { IsJSON } from '@hexajs-dev/common';
@IsJSON()

@IsLowercase

import { IsLowercase } from '@hexajs-dev/common';
@IsLowercase()

@IsNegative

import { IsNegative } from '@hexajs-dev/common';
@IsNegative()

@IsNotEmpty

import { IsNotEmpty } from '@hexajs-dev/common';
@IsNotEmpty()

@IsNotIn

import { IsNotIn } from '@hexajs-dev/common';
@IsNotIn(values: any[])

@IsNumber

import { IsNumber } from '@hexajs-dev/common';
@IsNumber()

@IsObject

import { IsObject } from '@hexajs-dev/common';
@IsObject()

@IsOptional

import { IsOptional } from '@hexajs-dev/common';
@IsOptional()

@IsPositive

import { IsPositive } from '@hexajs-dev/common';
@IsPositive()

@IsString

import { IsString } from '@hexajs-dev/common';
@IsString()

@IsUppercase

import { IsUppercase } from '@hexajs-dev/common';
@IsUppercase()

@IsUrl

import { IsUrl } from '@hexajs-dev/common';
@IsUrl()

@IsUUID

import { IsUUID } from '@hexajs-dev/common';
@IsUUID()

@Length

import { Length } from '@hexajs-dev/common';
@Length(min: number, max: number)

@Matches

import { Matches } from '@hexajs-dev/common';
@Matches(pattern: RegExp | string)

@Max

import { Max } from '@hexajs-dev/common';
@Max(value: number)

@MaxLength

import { MaxLength } from '@hexajs-dev/common';
@MaxLength(max: number)

@Min

import { Min } from '@hexajs-dev/common';
@Min(value: number)

@MinLength

import { MinLength } from '@hexajs-dev/common';
@MinLength(min: number)

@NotEquals

import { NotEquals } from '@hexajs-dev/common';
@NotEquals(value: any)

@ValidateNested

import { ValidateNested } from '@hexajs-dev/common';
@ValidateNested()

Functions

EmailField

import { EmailField } from '@hexajs-dev/common';
function EmailField(): () => (target: any, propertyKey: string | symbol | undefined) => void

Constants

BooleanField

import { BooleanField } from '@hexajs-dev/common';
const BooleanField: () => (target: any, propertyKey: string | symbol | undefined) => void;

NumberField

import { NumberField } from '@hexajs-dev/common';
const NumberField: () => (target: any, propertyKey: string | symbol | undefined) => void;

OptionalField

import { OptionalField } from '@hexajs-dev/common';
const OptionalField: () => (target: any, propertyKey: string | symbol | undefined) => void;

RequiredField

import { RequiredField } from '@hexajs-dev/common';
const RequiredField: () => (target: any, propertyKey: string | symbol | undefined) => void;

StringField

import { StringField } from '@hexajs-dev/common';
const StringField: () => (target: any, propertyKey: string | symbol | undefined) => void;