PhoenixApiToolkit.Ecto.Validators.validate_plaintext
You're seeing just the function
validate_plaintext
, go back to PhoenixApiToolkit.Ecto.Validators module for more information.
Specs
validate_plaintext(Ecto.Changeset.t(), atom() | [atom()]) :: Ecto.Changeset.t()
Validates that field
(or multiple fields) contains plaintext.
Examples
For the implementation of changeset/1
, see Elixir.PhoenixApiToolkit.Ecto.Validators
.
iex> changeset(%{first_name: "Peter", last_name: "Pan"}) |> validate_plaintext([:first_name, :last_name])
#Ecto.Changeset<action: nil, changes: %{first_name: "Peter", last_name: "Pan"}, errors: [], data: %{}, valid?: true>
iex> changeset(%{first_name: "Peter{}"}) |> validate_plaintext(:first_name)
#Ecto.Changeset<action: nil, changes: %{first_name: "Peter{}"}, errors: [first_name: {"can only contain a-Z 0-9 _ . , - ! ? and whitespace", [validation: :format]}], data: %{}, valid?: false>