My question is do you consider adding support for a set of features known in rails as nested attributes and in ember as embedded records. The concept is that we should be able to update a record with its sub-records in one call. We use this pattern in our applications and we like it very much. There are two main reasons one is that you can structure your object model in more fine graded way without worrying that it adds much complication on client logic. Second is that it gives you transaction like behaviour on fairly large object. And moreover this objects tend to be only parts of application that we would require transaction like features.
So back to the point. To make embedded records possible one would need support in API for having single update that along updating main record fields will support:
- Adding more than one subrecord in one-many relation. The problem usually is with server generated IDs and client updating caches. One can use temporary client generated IDs here.
- Removing subrecord in any relation. Rails uses additional attribute here ‘_remove’ but this makes removing record from relation vs. deleting record undistinguishable.
- Updating subrecords fields. This is currently supported.
Are there any plans to include something like this in json:api? Can I do something to help it happen?