Skip to content

Commit 899aa88

Browse files
committed
fix(api-service): allow null in reaction settings DTO validation
Add @ValidateIf to skip @IsString when value is null, so setting onMessageReceived: null or onResolved: null correctly disables reactions instead of failing validation. Made-with: Cursor
1 parent cb60fc9 commit 899aa88

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apps/api/src/app/agents/dtos/agent-behavior.dto.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ApiPropertyOptional } from '@nestjs/swagger';
2-
import { IsBoolean, IsOptional, IsString, ValidateNested } from 'class-validator';
2+
import { IsBoolean, IsOptional, IsString, ValidateIf, ValidateNested } from 'class-validator';
33
import { Type } from 'class-transformer';
44

55
export class AgentReactionSettingsDto {
@@ -8,6 +8,7 @@ export class AgentReactionSettingsDto {
88
default: 'eyes',
99
})
1010
@IsOptional()
11+
@ValidateIf((_, value) => value !== null)
1112
@IsString()
1213
onMessageReceived?: string | null;
1314

@@ -16,6 +17,7 @@ export class AgentReactionSettingsDto {
1617
default: 'check',
1718
})
1819
@IsOptional()
20+
@ValidateIf((_, value) => value !== null)
1921
@IsString()
2022
onResolved?: string | null;
2123
}

0 commit comments

Comments
 (0)