you also to use validate_change ( https://hexdocs.pm/ecto/Ecto.Changeset.html#validate_change/3 )
There is a reference in this post Validates not nil of fields only when they exist
you also to use validate_change ( https://hexdocs.pm/ecto/Ecto.Changeset.html#validate_change/3 )
There is a reference in this post Validates not nil of fields only when they exist