Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
50 views

I'm researching that can I use i18n for the messages of validation exceptions. For example: create-user.dto.ts export default class createUserDto { @MinLength(5) @IsString() name: string; }...
Mehmet KÖSMEN's user avatar
0 votes
1 answer
58 views

Consider following Dtos: export class Child { @ApiProperty({ type: String, isArray: true, }) name: string; @ApiProperty({ type: Number, isArray: true, }) age: number; } ...
Tu Le Anh's user avatar
  • 101
0 votes
0 answers
33 views

I am working on a NestJS project where I use class-validator to validate incoming DTOs. I have a custom validator @IsAccessPointExists() that checks if an access point exists in the database. The ...
Aslan Gurbanov's user avatar
1 vote
1 answer
68 views

I´m trying to validate the body of a route on NestJS and i´m using the class-validator package, my route is receiving the data as multipat because this route also accepts a file upload. Here is the ...
DMinatto's user avatar
1 vote
0 answers
94 views

I am working with NestJS and trying to apply the IsEnum decorator to an optional property. However, I am encountering an error. I am using "class-validator": "^0.14.1" and my DTO ...
varsha kumari's user avatar
1 vote
1 answer
128 views

I try to send login credentials to my NestJS API. API uses class-validator to validate incoming requests' bodies. // auth.controller.ts @Post('login') async login(@Res({ passthrough: true }) response: ...
brizgalka's user avatar
1 vote
0 answers
84 views

I have a POST /login route in my Express application where I'm using a payload validation middleware before the controller, structured as follows: profileRouter.post( "/login", ...
Koyejo's user avatar
  • 47
2 votes
1 answer
325 views

I am building a NestJS application with a pagination API that includes filtering and searching capabilities. To handle this, I created an abstract class, PaginationAbstract, which accepts two generic ...
Saeed Ghofrani's user avatar
0 votes
1 answer
80 views

I use: @UsePipes(new ValidationPipe({ transform: true })) to transform query param criteria to specific types, but it doesn't work for numbers, can you explain me why? Version of @bx/nestjs-commons - ...
Paweł Grabowski's user avatar
-1 votes
1 answer
258 views

I've created a controller that receives a POST/ ... request. one of the parameters is optional and it's for example called contentType. in the service i check if the contentType is equal to something ...
Yaron's user avatar
  • 143
0 votes
2 answers
73 views

I am using validateIf() to check if the paymentService is equal to some enum value defined in my code. But it does not validate and throws an error . @ApiProperty({ required: true }) @...
Shehryar Tanoli's user avatar
0 votes
1 answer
115 views

I'm trying to apply a validation using class-validator to make possible that some props can be @IsOptional, but if all of them is null, throw an exception. Thinking in some approach like this: @...
Wilson de Freitas's user avatar
0 votes
1 answer
63 views

I'm writing input validation for an event handler. The payload can be either an Order object or null. I need some help on how to allow null payloads in this setup, as they are currently rejected. Here ...
thijsfranck's user avatar
1 vote
1 answer
217 views

We generally work as, doing validation and doing all sort of validation in validator and we expect that if the request reaches controller it has already been validated againsts all the application ...
Jamal Ahmed's user avatar
2 votes
0 answers
683 views

I am using tsoa with class-validator in express js Now when i define DTO with class-validator and define type for body in tsoa route, it only validates the datataype of the body object values & if ...
Dharmik soni's user avatar
0 votes
0 answers
64 views

I have the following DTO export class UpsertSubscription { @Expose() @ValidateIf((o) => !o.monthly && !o.yearly) @IsNumber({}, { message: 'tiers.priceMustBeANumber' }) @Min(0, { ...
Omar Bahutair's user avatar
2 votes
0 answers
564 views

I'm working with NestJS and using class-validator to validate data. I have an array of objects in my DTO, but I need to ensure that empty objects (objects with no properties) are eliminated from the ...
Azman Amin's user avatar
1 vote
1 answer
136 views

I have this: import * as val from 'class-validator'; import {ObjectId as MongoId} from 'mongodb'; @val.ValidatorConstraint({async: false}) export class IsTraceValidConstraint ...
Alexander Mills's user avatar
0 votes
3 answers
6k views

I just ran into a pretty simple issue, this definition normally should have worked perfectly and pass the validation as price field in JSON is already sent in decimal format as you can figure below, ...
berk's user avatar
  • 119
0 votes
0 answers
92 views

Here is what I want to achieve. My current QueryUserDto is: import { ApiHideProperty } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; import { IsEmpty, IsEnum, IsMongoId, ...
Faizan Ashiq's user avatar
1 vote
1 answer
3k views

I've been investigating the topic for a long time. I see the ready solution is absent that works well in NestJS because transformation does not work before validation. If we enable transformation in ...
Victor Shelepen's user avatar
1 vote
1 answer
1k views

I have a DTO that looks like this: export class UpdateXXXDto { @IsString() @IsNotEmpty() field1: string; @IsOptional() @IsString() field2: string; @IsOptional() @IsString() field3: ...
Lafi's user avatar
  • 1,352
1 vote
0 answers
262 views

I try this approach but when I enter input that shouldn't pass when validate it return [] import { validate } from 'class-validator'; import { plainToClass } from 'class-transformer'; import { MyDTO } ...
Dewvie's user avatar
  • 77
1 vote
1 answer
1k views

I am new to Nest.js and have a good understanding of the overall syntax. However, while creating one of the controllers, I encountered an issue related to the validation of data parsed by the @Headers ...
Shivam Yadav's user avatar
0 votes
1 answer
114 views

Maybe I don't understand the DTO, but I want it to check if at least one attribute is sent by the request. How can I do it? Here is my dto: //import libs export class WorkspaceDto { @IsString() ...
green_dino's user avatar

1
2 3 4 5
9