Skip to content

Conversation

Novtin
Copy link
Contributor

@Novtin Novtin commented Apr 8, 2025

Исправлена логика required/nullable в field декораторах

@Novtin Novtin self-assigned this Apr 8, 2025
options.nullable = true;
}

const arrayNotEmptyMessage = options.isFieldValidConstraintMessage || 'Не должно быть пустым';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я правильно понимаю что этот текст ошибки нигде не будет выводиться?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

То есть мы теряем часть бизнес-логики при таком изменении? Чем она будет замещаться?

А если эта логика лишняя, то прошу пояснить почему именно.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Выше ответил + я не понимаю, почему свойство options.isFieldValidConstraintMessage отвечает именно за текст ошибки при пустом массиве и находится только в RelationIdField

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я не понимаю, почему свойство options.isFieldValidConstraintMessage отвечает именно за текст ошибки при пустом массиве и находится только в RelationIdField

Думаю стоит найти ответ на этот вопрос, в чатах или на мите.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему свойство options.isFieldValidConstraintMessage отвечает именно за текст ошибки при пустом массиве и находится только в RelationIdField

Получилось найти ответ на этот вопрос?

@vkoktashev
Copy link
Member

Нужно проверить работу валидатора для RelationField

@Novtin Novtin requested a review from vkoktashev April 24, 2025 04:33
@Novtin
Copy link
Contributor Author

Novtin commented Jul 22, 2025

Нужно проверить работу валидатора для RelationField

@vkoktashev Проверил для этого случая, всё работает: если не передавать many, всё ок, если передать many не массив или в массиве у объекта не будет name, то выдаст ошибку

export class PostManyDto {
    @ExtendField(PostManyModel, {
        required: false,
    })
    id: number;

    @ExtendField(PostManyModel)
    name: string;
}

export class PostDto {
    @ExtendField(PostModel, {
        required: false,
    })
    id: number;

    @ExtendField(PostModel, {
        required: false,
    })
    title: string;

    @ExtendField(PostModel, {
        relationClass: () => PostManyDto,
        extendValidators: true,
        isArray: true,
        required: false,
    })
    many: PostManyDto[];
}

@Novtin Novtin requested a review from perlexed July 22, 2025 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants