diff --git a/lib/ecto/changeset.ex b/lib/ecto/changeset.ex index 4f671ddbd8..cd0daeffe9 100644 --- a/lib/ecto/changeset.ex +++ b/lib/ecto/changeset.ex @@ -2827,6 +2827,9 @@ defmodule Ecto.Changeset do The format has to be expressed as a regular expression. + The validation only runs if a change for the given `field` exists and the + change value is not `nil`. + ## Options * `:message` - the message on failure, defaults to "has invalid format". @@ -2855,6 +2858,9 @@ defmodule Ecto.Changeset do @doc """ Validates a change is included in the given enumerable. + The validation only runs if a change for the given `field` exists and the + change value is not `nil`. + ## Options * `:message` - the message on failure, defaults to "is invalid". @@ -2887,6 +2893,9 @@ defmodule Ecto.Changeset do Type of the field must be array. + The validation only runs if a change for the given `field` exists and the + change value is not `nil`. + ## Options * `:message` - the message on failure, defaults to "has an invalid entry". @@ -2926,6 +2935,9 @@ defmodule Ecto.Changeset do @doc """ Validates a change is not included in the given enumerable. + The validation only runs if a change for the given `field` exists and the + change value is not `nil`. + ## Options * `:message` - the message on failure, defaults to "is reserved". @@ -2957,6 +2969,9 @@ defmodule Ecto.Changeset do of unicode characters. Then consider using the `:count` option to limit the number of codepoints (`:codepoints`), or limit the number of bytes (`:bytes`). + The validation only runs if a change for the given `field` exists and the + change value is not `nil`. + ## Options * `:is` - the length must be exactly this value @@ -3153,6 +3168,9 @@ defmodule Ecto.Changeset do @doc """ Validates the properties of a number. + The validation only runs if a change for the given `field` exists and the + change value is not `nil`. + ## Options * `:less_than`