Skip to content

Commit

Permalink
feat: Added support for empty selectValues in schema (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
chavda-bhavik authored Apr 17, 2024
2 parents 65c7231 + 9eb3d12 commit 5ada12a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions apps/api/src/app/common/dtos/Schema.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ export class SchemaDto {
@ApiPropertyOptional({
description: 'List of possible values for column if type is Select',
})
@ValidateIf((object) => object.type === ColumnTypesEnum.SELECT, {
message: "'selectValues' should not empty, when type is Select",
})
@IsArray({ message: "'selectValues' must be an array, when type is Select" })
@ArrayMinSize(1, { message: "'selectValues' should not empty, when type is Select" })
@Type(() => Array)
@IsOptional()
selectValues: string[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class BaseReview {
const selectValues =
Array.isArray(column.selectValues) && column.selectValues.length > 0
? [...column.selectValues, ...(column.isRequired ? [] : [''])]
: [];
: [''];
property = {
type: 'string',
enum: Array.from(new Set(selectValues)), // handle duplicate
Expand Down

0 comments on commit 5ada12a

Please sign in to comment.