Domo.Changeset.validate_schemaless_type_fields
You're seeing just the function
validate_schemaless_type_fields
, go back to Domo.Changeset module for more information.
Link to this function
validate_schemaless_type_fields(changeset, struct, fields, opts \\ [])
View SourceValidates that only given fields
of the changeset conforms to appropriate
types defined within the schema's t()
type.
Function calls validate_required/2
with given fields having no nil
types in t()
.
Then it validates that each given field's value conforms to its type defined in t()
by calling validate_change/3
.
Options given as opts
are bypassed to validate_required/2
.
F.e. it can be the :trim
boolean option specifying if spaces should
be trimmed before validation.
Examples
{%{}, %{name: :string, email: :string, age: :integer}}
|> cast(%{name: "Hello world", email: "some@address"}, [:name, :email])
|> validate_schemaless_type_fields(User, [:name, :email])
In the example above :name
and :email
values are validated to conform to appropriate types in t()
.