435 questions
0
votes
0
answers
51
views
nestjs use i18n in decorators of class-validator without indicate one by one
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;
}...
0
votes
1
answer
62
views
How to validate nested array of object by groups in Nestjs with class-validator
Consider following Dtos:
export class Child {
@ApiProperty({
type: String,
isArray: true,
})
name: string;
@ApiProperty({
type: Number,
isArray: true,
})
age: number;
}
...
0
votes
0
answers
36
views
How to assign validation result to a field using class-validator in NestJS?
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 ...
1
vote
1
answer
69
views
class-validator whitelisting properties of object inside array
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 ...
1
vote
0
answers
94
views
Issue with IsEnum Decorator on an Optional Property in Nestjs
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 ...
1
vote
1
answer
129
views
Unable to POST data using Nuxt's useFetch()
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: ...
1
vote
0
answers
84
views
Express middleware for DTO validation throws undefined TypeError on valid payload
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",
...
2
votes
1
answer
326
views
NestJs Class validation for generic class
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 ...