ml-archive/submissions

isOptional false precludes other validators

Closed this issue · 3 comments

https://github.com/nodes-vapor/submissions/blob/69ca301fa0f7b532e9acf410e8e825e40be206b3/Sources/Submissions/Field.swift#L30-L32

Looking at that, it appears that if I say isOptional = false then the only validator that will run is the errorOnNil one

I plan to write tests for this but the way I intended it is that I return the errorOnNil, when there is:

  1. no value (.none),
  2. when .createing a new instance
  3. where isOptional == false

I believe that is correct.

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!