isOptional false precludes other validators
Closed this issue · 3 comments
grosch commented
Looking at that, it appears that if I say isOptional = false then the only validator that will run is the errorOnNil
one
siemensikkema commented
I plan to write tests for this but the way I intended it is that I return the errorOnNil
, when there is:
- no value (
.none
), - when
.create
ing a new instance - where
isOptional
==false
I believe that is correct.
grosch commented
Why wouldn’t the other validations run when creating a new instance?
… On May 28, 2018, at 10:41 PM, Siemen Sikkema ***@***.***> wrote:
I plan to write tests for this but the way I intended it is that I return the errorOnNil, when there is:
no value (.none),
when .createing a new instance
where isOptional == false
I believe that is correct.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
siemensikkema commented
A Field
supports multiple validators that take a non-optional value. So they can only be run when there is an actual value. Keep in mind that the validators of the other fields will still be run!