8000 #93 by Novtin · Pull Request #33 · steroids/nest · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

#93 #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

#93 #33

wants to merge 4 commits into from

Conversation

Novtin
Copy link
Contributor
@Novtin Novtin commented Apr 8, 2025

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

@Novtin Novtin self-assigned this Apr 8, 2025
Comment on lines -188 to -190
options.required && IsNotEmpty({
message: 'Обязательно для заполнения',
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

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

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.

Будет стандартное сообщение из валидаторов class-validator

Но если нужно какое-то кастомное сообщение, то по логике нужно такое добавлять к каждому валидатору из class-validator

Copy link
Contributor

Choose a reason for hiding this comment

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

А каким может быть решение, при котором сообщения об ошибках сохранятся в проектах, в которых люди стероиды обновят?

@@ -54,17 +53,13 @@ export function RelationIdField(options: IRelationIdFieldOptions = {}) {
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

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

@@ -21,7 +21,7 @@ export function IntegerField(options: IIntegerFieldOptions = {}) {
appType: 'integer',
jsType: 'number',
}),
options.nullable && ValidateIf((object, value) => options.isArray ? !isArrayEmpty(value) : !isEmpty(value)),
!options.required && ValidateIf((object, value) => options.isArray ? !isArrayEmpty(value) : !isEmpty(value)),
Copy link
Member

Choose a reason for hiding this comment

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

Почему везде такая логика убрана, а здесь оставлена?

@vkoktashev
Copy link
Member

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

@Novtin Novtin requested a review from vkoktashev April 24, 2025 04:33
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
0