-
Notifications
You must be signed in to change notification settings - Fork 838
Open
Labels
status: needs triageIssues which needs to be reproduced to be verified report.Issues which needs to be reproduced to be verified report.type: fixIssues describing a broken feature.Issues describing a broken feature.
Description
Description
I have a DTO class with a param that is an object. Ive set it to defined and optional. Somehow, if i remove the optional, the validation goes ok (returns 400), if i keep the isOptional, it returns error 500. Its not validating as expected and the application cannot deal with the null value.
Minimal code-snippet showcasing the problem
@IsDefined()
@IsNotEmptyObject()
@IsObject()
@ValidateNested()
@ApiProperty({
example: AccountDto,
description: 'Account information.',
})
@Type(() => AccountDto)
@IsOptional()
account!: AccountDto;
//request
{
account: null
}
Expected behavior
Should return error 400 bad request, since its undefined.
Actual behavior
It throws internal server error (isnt returning the error 400)
Metadata
Metadata
Assignees
Labels
status: needs triageIssues which needs to be reproduced to be verified report.Issues which needs to be reproduced to be verified report.type: fixIssues describing a broken feature.Issues describing a broken feature.