blunt-elixir / blunt

CQRS Tools for Elixir
13 stars 2 forks source link

Pass required to cast_embed/3 not validate_required/3 #16

Open thetamind opened 1 year ago

thetamind commented 1 year ago

Ecto 3.8.0 introduced a warning that calling validate_required/3 on embeds_many has no effect. https://github.com/elixir-ecto/ecto/pull/3862

Pass :required option to cast_embed/3 instead.

warning: attempting to validate embed_many field :many with validate_required/3 which has no effect. You can pass the :required option to Ecto.Changeset.cast_embed/3 to achieve this.
  (ecto 3.8.3) lib/ecto/changeset.ex:1801: anonymous fn/6 in Ecto.Changeset.validate_required/3
  (elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
  (ecto 3.8.3) lib/ecto/changeset.ex:1800: Ecto.Changeset.validate_required/3
  (blunt 0.1.0-rc1) lib/blunt/message/changeset.ex:75: Blunt.Message.Changeset.changeset/3
  (blunt 0.1.0-rc1) lib/blunt/message/constructor.ex:68: Blunt.Message.Constructor.apply/4