Ecto.Changeset - How do I make validation errors in embedded schemas show up on the parent?

Hi, thanks for your quick reply! Yes, I did find PolymorphicEmbed.traverse_errors/2 and I tried it (I even examined its implementation), but it can’t iterate over errors in a child changeset that doesn’t exist :sweat_smile:

I’ve created a minimal working example in a GitHub repo here just to illustrate the point a bit better:

See lib/schema.ex and test/schema_test.exs to see what I mean. I’ve added some tests that show the current behaviour and the behaviour that would be desirable (and that would be more akin to what Ecto does for embeds_many).

Do you want to continue this conversation here, or should I make an issue on the PolymorphicEmbed repo and continue there?

1 Like