Domo.Changeset.validate_type
You're seeing just the function
validate_type
, go back to Domo.Changeset module for more information.
Validates field change values conforms to appropriate types defined within the schema's t() type.
It perform the validation only if a change value is not nil.
In case there's at least one error, the list of errors will be appended to the :errors
field of the changeset and the :valid?
flag will be set to false.
Similar to validate_type/1, but can work with a map changeset. Takes struct module name as struct
.
Examples
{%{}, %{name: :string, email: :string, age: :integer}}
|> cast(%{name: "Hello world", email: "some@address", age: 21}, [:name, :email, :age])
|> validate_type(User)