-
Notifications
You must be signed in to change notification settings - Fork 4
#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
base: main
Are you sure you want to change the base?
#93 #33
Conversation
options.required && IsNotEmpty({ | ||
message: 'Обязательно для заполнения', | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я правильно понимаю что текст "Обязательно для заполнения" больше ни в каком слу 10000 ае не будет выводиться?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
То есть мы теряем часть бизнес-логики при таком изменении? Чем она будет замещаться?
А если эта логика лишняя, то прошу пояснить почему именно.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Будет стандартное сообщение из валидаторов class-validator
Но если нужно какое-то кастомное сообщение, то по логике нужно такое добавлять к каждому валидатору из class-validator
There was a problem hiding this comment.
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 || 'Не должно быть пустым'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я правильно понимаю что этот текст ошибки нигде не будет выводиться?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
То есть мы теряем часть бизнес-логики при таком изменении? Чем она будет замещаться?
А если эта логика лишняя, то прошу пояснить почему именно.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Выше ответил + я не понимаю, почему свойство options.isFieldValidConstraintMessage отвечает именно за текст ошибки при пустом массиве и находится только в RelationIdField
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я не понимаю, почему свойство options.isFieldValidConstraintMessage отвечает именно за текст ошибки при пустом массиве и находится только в RelationIdField
Думаю стоит найти ответ на этот вопрос, в чатах или на мите.
There was a problem hiding this comment.
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)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему везде такая логика убрана, а здесь оставлена?
Нужно проверить работу валидатора для RelationField |
Исправлена логика required/nullable в field декораторах