Skip to content

Commit

Permalink
docs: mention the special role of undefined in mixed.oneOf (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhienle authored and jquense committed Dec 23, 2019
1 parent df4976e commit 38841c8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,9 @@ be used in the `message` argument.
Whitelist a set of values. Values added are automatically removed from any blacklist if they are in it.
The `${values}` interpolation can be used in the `message` argument.

Note that `undefined` does not fail this validator, even when `undefined` is not included in `arrayOfValues`.
If you don't want `undefined` to be a valid value, you can use `mixed.required`.

```js
let schema = yup.mixed().oneOf(['jimmy', 42]);

Expand Down

0 comments on commit 38841c8

Please sign in to comment.