ja_serializer icon indicating copy to clipboard operation
ja_serializer copied to clipboard

Handling nested params

Open pollingj opened this issue 8 years ago • 3 comments

Just started using the new to_attributes, finding it really useful. Any thoughts on how nested params could be handled with it, or would you see that being handled outside of this?

I'm just thinking in terms of this blog post - http://blog.plataformatec.com.br/2015/08/working-with-ecto-associations-and-embeds/

pollingj avatar May 16 '16 14:05 pollingj

Honestly, I am not sure how this should be handled. The JSON-API spec had some extensions available for bulk create, as well as some discussion around this sort of thing. Personally the only place I have done this I ended up using some suggestions from a JSON-API issues I can no longer find.

I think until there is a specified format for this in the JSON-API spec it is premature to implement anything here. It may also be the case that if support comes as an extension there may need to be significant thought and work put into determining if and how extension support should be added to JaSerializer.

For the time being this would be a great place to discuss different strategies and how to implement them for Ecto.

alanpeabody avatar May 16 '16 16:05 alanpeabody

Any update on this?

aizotov avatar May 03 '19 16:05 aizotov

@aizotov it sounds like there may be support for this in JSON:API v1.1. Once that is finalized then we'd be interested in doing something in JaSerializer.

Unfortunately I haven't found any way of doing it in the 1.0 spec that I really like or could recommend. Sometimes I can redesign the endpoint to not require nested data, but there's always those exceptions where you need to do something custom.

beerlington avatar May 03 '19 17:05 beerlington