Open parkan opened 8 years ago
hrm... so I've got the brain-dead version of this working (accept id and meta
dictionary and write the cell with no schema verification, etc). But it looks like the chain folding in the reader api is happening backwards... so the most recently written update cell gets applied first, and the first cell is applied last
will push a branch once that's fixed :)
Sounds like we're missing a reversed
!
the more serious issue is that the apply_update_cell
clobbers any existing value instead of merging if it's a dictionary... so if an update cell has e.g.
{
"meta": {
"data": {
"foo": "bar"
}
}
}
it will overwrite all the existing meta.data
😛
pretty simple to merge the cell['meta']
into object['meta']
instead. For keys in both, the value in the chain cell will win. I've got that working, but I haven't done anything about arrays yet... if you wanted to e.g. add a keyword, and the update cell has an array with one string in it, it will overwrite the existing keywords array, which might not be what you expect...
@yusefnapora I think @autoencoder has some general-purpose recursive merging code that respects nulls and empty values in the indexer schema utils
(similar to jQuery's $.extend(...
)
sweet, we should maybe pull those into the client
Should take canonical id and new object and attach new chain cell