Open lucasmazza opened 5 years ago
I think it got missed as this project changed hands around that time and it just fell through the cracks. I'd definitely be interested in supporting that if there's a good use case for it. Without JSON API having good support for creating nested records in v1.0 of the spec, what is your use case? I just want to make sure I understand how it would be used so the tests reflect that.
@beerlington we have a schema with the following relationships:
defmodule MyApp.Client do
use Ecto.Schema
import Ecto.Changeset
schema "clients" do
has_many :addresses, MyApp.Address
embeds_one :document, MyApp.Document
end
end
Our API accepts the addresses
and document
properties inside the clients
document, and we want to respond with the validation errors of those associations as expected. Ecto won't store the errors on the clients
changeset, but we need to traverse the inner Changesets using traverse_errors
to collect those errors when rendering it on the API.
I would also be interested in seeing this implemented.
What workarounds are you folks using until this is implemented?
This was reported on #249 but the issue and PR are closed without being merged and released.
EctoErrorSerializer.format/3
callschangeset.errors
directly instead of usingtraverse_errors/2
to walk through the changeset data to collect nested errors and render properly. It is possible that we can bring this fix back?