Category "class-validator"

Object validation - How to validate [key: number]: string

I'm trying to write validator for JSON returned from Bugzilla API. When I'm fetching comments data, I'm getting something like this: curl https://bugzilla.mozil

@IsPhoneNumber() npm class validator how to add multiple countries code

In Nest js dto I want to validate user mobile number with multiple countries Regex. How can I do this? @IsPhoneNumber('IN', { message: (args: ValidationArg

Validation does not work with Partial<DTO> - NestJS

I want to apply server-side validation on my CRUD API. The entity in question is called Employee. I am using an employee.dto (shown below) for the create and up

Validation does not work with Partial<DTO> - NestJS

I want to apply server-side validation on my CRUD API. The entity in question is called Employee. I am using an employee.dto (shown below) for the create and up

How to inject service to validator constraint interface in nestjs using class-validator?

I'm trying to inject my users service into my validator constraint interface but it doesn't seem to work: import { ValidatorConstraintInterface, ValidatorConst

class validator not working with class transformer's type function

class Product { @Min(0, { message: 'should be positive number' }) @IsNotEmpty({ message: 'should not be empty' }) @Type(() => Number) price: number;

class-validator validate union type

I have a mongoose discriminator schema, which mean the data will be different according to one of the attributes. class Feature { name: string option: Colo

Unable to resolve signature of property decorator when called as an expression

import { isEmail, isEmpty, isPhoneNumber, Length } from "class-validator" import { Field, InputType } from "type-graphql"; @InputType() export class RegisterIn

How to validate request in typeorm controller

I have created a sample application to save data for a user. I wanted to know how to validate it before saving and showing the response in JSON. I have got a re

How to validate an array of Date with class validator?

I have an array of dates in a post request body that I want to validate: { "meals": [...], "dates": [ "2022-03-06T11:00:00.000Z", "2022-

Is it possible to validate that one of 2 parameters are present using class-validator?

Using class-validator along with NestJS I want to validate that a user provides either propertyA or a propertyB but they don't need to provide both. Currently,