In #45 there was discussion about the difference between required and exists. Required means that the field exists and isn't empty.
In the documentation for validation, one_of is described as "Sometimes you will want only one of several fields to be required. At least one of them need to be required." This sounds like what I want -- I have a couple fields and I want the user to populate one of them and leave the other one blank (or optionally populate both).
However, in my testing with form input, one_of seems to be acting like it is testing that the fields exist but isn't testing that one of them is required. If I validate.required(["field1", "field2"]) it throws an error for both fields. However, validate.one_of(["field1", "field2"]) throws no errors.
If one_of is intentionally for exists_one_of, it would be helpful to have a required_one_of (or some other name). The documentation also needs to be clarified.
In #45 there was discussion about the difference between
requiredandexists. Required means that the field exists and isn't empty.In the documentation for validation,
one_ofis described as "Sometimes you will want only one of several fields to be required. At least one of them need to be required." This sounds like what I want -- I have a couple fields and I want the user to populate one of them and leave the other one blank (or optionally populate both).However, in my testing with form input,
one_ofseems to be acting like it is testing that the fields exist but isn't testing that one of them is required. If Ivalidate.required(["field1", "field2"])it throws an error for both fields. However,validate.one_of(["field1", "field2"])throws no errors.If
one_ofis intentionally forexists_one_of, it would be helpful to have arequired_one_of(or some other name). The documentation also needs to be clarified.