Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 35c3f71

Browse files
authored
Fix: create issue dto (#250)
1 parent 39c7f82 commit 35c3f71

File tree

1 file changed

+2
-42
lines changed

1 file changed

+2
-42
lines changed

packages/types/src/issue/create-issue.dto.ts

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import {
55
IsObject,
66
IsOptional,
77
IsString,
8-
ValidateBy,
98
ValidateNested,
10-
ValidationArguments,
119
} from 'class-validator';
1210

1311
import { CreateIssueRelationDto } from '../issue-relation';
@@ -28,49 +26,11 @@ export class CreateIssueDto {
2826
title: string;
2927

3028
@IsString()
31-
@ValidateBy(
32-
{
33-
name: 'eitherDescriptionOrDescriptionMarkdown',
34-
validator: {
35-
validate: (_value: string, args: ValidationArguments): boolean => {
36-
const object = args.object as CreateIssueDto;
37-
const { description, descriptionMarkdown } = object;
38-
return !!(
39-
(description && descriptionMarkdown) ||
40-
description ||
41-
descriptionMarkdown
42-
);
43-
},
44-
},
45-
},
46-
{
47-
message:
48-
'Either description or descriptionMarkdown must be provided, but not both',
49-
},
50-
)
29+
@IsOptional()
5130
description?: string;
5231

5332
@IsString()
54-
@ValidateBy(
55-
{
56-
name: 'eitherDescriptionOrDescriptionMarkdown',
57-
validator: {
58-
validate: (_value: string, args: ValidationArguments): boolean => {
59-
const object = args.object as CreateIssueDto;
60-
const { description, descriptionMarkdown } = object;
61-
return !!(
62-
(description && descriptionMarkdown) ||
63-
description ||
64-
descriptionMarkdown
65-
);
66-
},
67-
},
68-
},
69-
{
70-
message:
71-
'Either description or descriptionMarkdown must be provided, but not both',
72-
},
73-
)
33+
@IsOptional()
7434
descriptionMarkdown?: string;
7535

7636
@IsOptional()

0 commit comments

Comments
 (0)