ayon-backend
ayon-backend copied to clipboard
Selective patching of entity.data
Story
The current implementation of patching entity data field supports updating dictionary values at a single depth level. While users can set values like data["something"] = "value"
, the API does not support updating nested dictionary values such as data["something"]["nested"] = value
. This limitation restricts the flexibility and efficiency of data updates, especially when dealing with complex data structures.
Proposed solution
Enable Nested Patching:
- Modify the patch functionality to allow for deeper nested updates using a dot notation. For example, updating with
data = {"something.nested": value}
should directly target and modify the nested key. - Allow setting a nested value to
None
as a means to unset that specific key.
- Allow setting a nested value to
None
as a means to unset that specific key.
I'm not sure if that's the best way to do this if None
is also a valid value for that key? I wonder if we should have a dedicated value or special syntax for unsetting a key like that. I believe MongoDB has something like $unset
, see e.g. here?